Closed Bug 865232 Opened 11 years ago Closed 6 years ago

Get is_displayed() in Marionette working as well as is reasonably possible, relative to life, happiness and human mortality

Categories

(Remote Protocol :: Marionette, defect)

Other
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: zcampbell, Unassigned)

References

Details

(Keywords: pi-marionette-displayed, Whiteboard: [displayed][affects=b2g])

Tracking bug for getting the is_displayed() method of Marionette working correctly.
Depends on: 862927, 837725, 813561, 845547
Depends on: 813583
Rather than trying to handle all possible permutations of style properties, is it possible to do something simpler?  I.e.,

 - find the element's coordinates using getClientBoundingRect
 - using these coordinates in calls to getElementFromPoint to determine if the element is visible in the current viewport; if yes, return true
 - if false, iterate over the element's DOM parents, and perform the same checks; if they return true, see if the parent is a scrollable element, and if so, return true.  if this iteration goes all way to the document root without finding a visible scrollable parent, return false

This would seem to work in all the CSS transform cases, but I'm not sure if there are other cases this would fail.
(In reply to Jonathan Griffin (:jgriffin) from comment #1)
> This would seem to work in all the CSS transform cases, but I'm not sure if
> there are other cases this would fail.

Perhaps that would work for things that only rely on transforms but when we start getting into the world of overflows then it gets very tricky.

My opinion, baised as it is so take it with a grain of salt, is fix the atoms in the Selenium tree and export the atoms into our tree. The Selenium isShown/isDisplayed atom is battle tested. 

We are eventually going to have to support the same level of functionality without having to do a lot of work would prefer not to rewrite this.
If you start Everything.Me, the 'dock' is hidden (the 4 icons along the bottom of the homescreen for dialler, sms, contacts and browser). 
However, is_displayed() still returns true for it even though it's no longer visible.

The element I'm checking against is: ("class name", "dockWrapper")
Depends on: 872561
I'm blocked by this, everything inside the native UI is returning marionette.errors.ElementNotVisibleException: Element is not visible
Here's my py session:

# on b2g device, goto native.123done.org, click sign in button
# sign into native UI 1 time, with a new user, validate user
# sign in again, leave native UI open
m = Marionette('localhost', 2828)
m.start_session()
n_ui = m.find_element('css selector', 'iframe[src*="firefoxos"]')
m.switch_to_frame(n_ui)
pp = m.find_element('link text', 'Privacy Policy')
pp.is_displayed()
# returns False, but it's I can see it on the phone
# I can't click on it or other controls, most everything is is_displayed = False
added dependency and better STR 875467
Depends on: 875467
Currently discussing visibility of elements with Roc. Brain is exploding with use cases we dont handle but hopefully with his guidance we can get a proper solution.
After discussing things with roc there are a number of missing use cases for the way that we, both a-team and the webdriver project, so will be discussing this at the W3C Meeting later in the week. 

Unfortunately I may need to close some of the bugs and document the issues.
Summary: Get is_displayed() working perfectly in Marionette → Get is_displayed() in Marionette working as well as is reasonably possible, relative to life, happiness and human mortality
Bug 912873 is added for blocking this.  Since JS marionette client runs way faster, when is_displayed() function gives a signal of displayed but it actually not displayed. The test failed thereafter.
Blocks: 912873
No longer blocks: 937053
Depends on: 937053
Whiteboard: [displayed]
Depends on: 1013222
Whiteboard: [displayed] → [displayed][affects=b2g]
My stab at defining element visibility in WebDriver may be interesting in this context: https://www.w3.org/Bugs/Public/attachment.cgi?id=1517&action=diff

It's not a perfect algorithm and does have known problems.
Depends on: 1101504
Depends on: 1157254
It was unfortunately decided by the WebDriver WG that the only
interoperable solution was to continue relying on the atom.  The
atom has, however, in the mean time been upgraded to the latest
version from Selenium.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
The upgrade happened on bug 1375660.
Resolution: FIXED → WORKSFORME
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.