Ensure that Homescreen is ready before interacting with it

RESOLVED FIXED

Status

Firefox OS
Gaia::UI Tests
P3
normal
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: bsilverberg, Assigned: zac)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
While I was working on the marketplace-tests-gaia issues with launching Marketplace, I encountered an intermittent error when trying to launch Marketplace Dev via the app icon, which seems to suggest that it's possible that we are trying to interact with the Homescreen app before it is ready.

The error was:

JavascriptException: TypeError: window.wrappedJSObject.GridManager is undefined

So I think it might be a good idea to wait for that to be defined before attempting to interact with the Homescreen.  I will be submitting a pull request to do just that.

The full stack trace is:

test_login_marketplace (test_marketplace_login.TestMarketplaceLogin) ... ERROR

======================================================================
ERROR: None
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/marionette_client-0.7.1-py2.7.egg/marionette/marionette_test.py", line 143, in run
    testMethod()
  File "/Users/bsilverberg/gitRepos/marketplace-tests-gaia/marketplacetests/tests/test_marketplace_login.py", line 33, in test_login_marketplace
    self.marketplace.launch()
  File "/Users/bsilverberg/gitRepos/marketplace-tests-gaia/marketplacetests/marketplace/app.py", line 51, in launch
    if homescreen.is_app_installed(self.name):
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/gaiatest-0.21.2-py2.7.egg/gaiatest/apps/homescreen/app.py", line 42, in is_app_installed
    for i in range(self.homescreen_get_total_pages_number):
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/gaiatest-0.21.2-py2.7.egg/gaiatest/apps/homescreen/app.py", line 101, in homescreen_get_total_pages_number
    return pageHelper.getTotalPagesNumber();""")
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/marionette_client-0.7.1-py2.7.egg/marionette/marionette.py", line 1025, in execute_script
    filename=os.path.basename(frame[0]))
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/marionette_client-0.7.1-py2.7.egg/marionette/marionette.py", line 577, in _send_message
    self._handle_error(response)
  File "/Users/bsilverberg/.virtualenvs/marketplace-tests-gaia/lib/python2.7/site-packages/marionette_client-0.7.1-py2.7.egg/marionette/marionette.py", line 612, in _handle_error
    raise JavascriptException(message=message, status=status, stacktrace=stacktrace)
JavascriptException: TypeError: window.wrappedJSObject.GridManager is undefined
	stacktrace:
	execute_script @app.py, line 101
	inline javascript, line 925
	src: "        var pageHelper = window.wrappedJSObject.GridManager.pageHelper;"
TEST-UNEXPECTED-FAIL | test_marketplace_login.py test_marketplace_login.TestMarketplaceLogin.test_login_marketplace |
----------------------------------------------------------------------
Ran 1 test in 106.021s

FAILED (errors=1)
(Reporter)

Comment 1

4 years ago
I think I was mistaken about this being an issue. I made a change to the tests which didn't require a change to the Homescreen app and that seems to have addressed this issue. I'm going to leave this open for a bit in case it comes back, but will close it later if it seems to be a non-issue.
(Assignee)

Comment 2

4 years ago
We will need this when we speed up the startup which I'm working on in another bug.
Assignee: bob.silverberg → zcampbell
Priority: -- → P1
(Assignee)

Updated

4 years ago
Status: NEW → ASSIGNED
(Assignee)

Updated

4 years ago
Priority: P1 → P3
(Assignee)

Comment 3

4 years ago
A method is available now:
https://github.com/mozilla-b2g/gaia/commit/5f4b2af6143dc64fd0d3b08893289351bb007f87
Status: ASSIGNED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.