Closed Bug 876680 Opened 11 years ago Closed 10 years ago

el.tap() and click() do not work on settings changing language

Categories

(Remote Protocol :: Marionette, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: AndreiH, Unassigned)

References

Details

(Whiteboard: [touch])

Both el.tap() and click() don't work on the settings menu for changing language.

marionette.tap(el) works.

This test
https://github.com/mozilla/gaia-ui-tests/blob/master/gaiatest/tests/settings/test_settings_change_language.py#L31
is accessing this element:
https://github.com/mozilla-b2g/gaia/blob/v1.0.1/apps/settings/index.html#L2592
Depends on: 869034
Blocks: 869034
No longer depends on: 869034
marionette.tap(el) worked because it would tap it without verifying if it was in the viewport, it would only check the is_displayed() value.

el.tap() on the other hand will check if it is in the viewport, and if not, will call 'scrollIntoView(true)' on the element, bringing it to the top of the viewport. The problem here is that once we call scrollIntoView(true), the element is at (0,0) of the document, which actually hides most of the element under the 'Settings' header. All the tap/mouse events then get dispatched to the center of the element which is under an overlay and are thus ignored. If we change this to scrollIntoView(false) and put the element at the bottom of the screen, the tap events are successful.

I think the ideal thing to do is if the element is not in the viewport, we should scroll the element to the center of the screen. This is generally how users scroll and tap elements, and it will avoid the case of header/footer overlays. We can also try to scroll the element into the viewport until we detect that it is not obfuscated, but this seems a bit difficult with our is_displayed() issues right now, but perhaps that would be the right thing to do.

dburns, what's your input in this case?
Flags: needinfo?(dburns)
(In reply to Malini Das [:mdas] from comment #1)
> I think the ideal thing to do is if the element is not in the viewport, we

I meant to say, "if the element is not in the viewport, or if it is hidden under an element"
el.tap() works by using "arguments[0].scrollIntoView(false)" hack
(In reply to Malini Das [:mdas] from comment #1)
> 
> I think the ideal thing to do is if the element is not in the viewport, we
> should scroll the element to the center of the screen. 

I think probably the best thing to do is scroll to a place within reason. E.g. we can't scroll an element that is the last element or the first element on the page.

We may need to have a look at using the first rect available from getClientRects (https://developer.mozilla.org/en-US/docs/Web/API/element.getClientRects) and click/tap that instead
Flags: needinfo?(dburns)
Whiteboard: [touch]
So old, such old builds!
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.