Closed Bug 1188521 Opened 9 years ago Closed 9 years ago

Improve select() method in base.py

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: martijn.martijn, Assigned: martijn.martijn)

References

()

Details

In select method, we have this code:
http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/apps/base.py#105
106         # cheeky Select wrapper until Marionette has its own
107         # due to the way B2G wraps the app's select box we match on text
108         _close_button_locator = (By.CSS_SELECTOR, 'button.value-option-confirm')
109 
110         li = self.find_select_item(match_string)
111         li.tap()
112 
113         # Tap close and wait for it to hide
114         if tap_close:
115           self.marionette.find_element(*_close_button_locator).tap()
116         self.wait_for_select_closed(*_close_button_locator)

This is potentially prone to failures, because this is closing the select dialog and when this also causes the displayed app to close, then Marionette will spew out NoSuchWindowException errors when calling something like self.apps.displayed_app.name.

Immediately calling self.apps.switch_to_displayed_app() seems to paper over the issue often, but I think this can also cause failures (intermittent), so we should use existing workaround method here.

Like we do here:
http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/apps/contacts/regions/contact_form.py#207
207         # Workaround for bug 1109213, where tapping on the button inside the app itself
208         # makes Marionette spew out NoSuchWindowException errors
209         element = self.marionette.find_element(*self._done_button_locator)
210         x = element.rect['x'] + element.rect['width']//2
211         y = element.rect['y'] + element.rect['height']//2
212         self.marionette.switch_to_frame()
213         statusbar = self.marionette.find_element(*self._statusbar_locator)
214         self.marionette.find_element(*self._screen_locator).tap(x, y + statusbar.rect['height'])
215 
216         self.apps.switch_to_displayed_app()

It's not ideal, because we're switching context, so we need to make sure this wouldn't somehow break existing tests, I guess.

The same goes for http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/apps/base.py#118

There is also this weird wait_for_select_closed method, that probably needs to be take care of too: http://mxr.mozilla.org/gaia/source/tests/python/gaia-ui-tests/gaiatest/apps/base.py#93
This is a problem in test_rocketbar_add_collection_save_bookmark.py
I tested this with an alarm test and with test_rocketbar_add_collection_save_bookmark.py, but I couldn't reproduce this issue, so I think this is invalid.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.