Closed Bug 920944 Opened 11 years ago Closed 11 years ago

Two instances of the Homescreen app can be launched when running b2gperf

Categories

(Firefox OS Graveyard :: Gaia::Homescreen, defect)

defect
Not set
major

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: davehunt, Assigned: alive)

References

Details

(Whiteboard: [qa-automation-blocked])

Attachments

(1 file)

Our automated tests attempt to launch the Homescreen app, which until recently has just allowed us to retrieve the app object so we can target it, however it now launches a second version of the Homescreen...

It would appear that the origin returned by WindowManager.getDisplayedApp() is now 'homescreen' where it used to be 'app://homescreen.gaiamobile.org' the origin of the second instance is 'app://homescreen.gaiamobile.org'.

This is currently blocking us from gathering FPS results for the Homescreen.
Cristian pointed me to this commit:
https://github.com/mozilla-b2g/gaia/commit/78bc6641ec930e7cdad66c0da8cf186bb0fc31ea#L2R9

Alive: Is there a way we can get the origin to match the running/displayed app again?
Flags: needinfo?(alive)
(In reply to Dave Hunt (:davehunt) from comment #1)
> Cristian pointed me to this commit:
> https://github.com/mozilla-b2g/gaia/commit/
> 78bc6641ec930e7cdad66c0da8cf186bb0fc31ea#L2R9
> 
> Alive: Is there a way we can get the origin to match the running/displayed
> app again?

Hey, we shouldn't backup the patch because homescreen is replaceable now.
If homescreen app is replaced by another homescreen app, you would still get the wrong origin anyway.

I won't suggest to hardcode origin stuff here.
Flags: needinfo?(alive)
Shortly, the origin of homescreen app should be virtualized since we have supported multiple homescreen now.
In normal use case instead of an automated test, there shouldn't be more than one homescreen app.
I will kill the previous one before invoking second in homescreen-launcher.

If this (two homescreen app at the same time) does happen on real device, let me know, indeed a bug.

But if no, I think this is an invalid test case because it looks to me the test is dependent on system app code.
This is reproducible on device, albeit via automation tools. I wasn't suggesting backing anything out, but we need a way to locate and switch to the Homescreen app so we can obtain FPS metrics for swiping through the pages of apps.

At the moment we use launchWithName [1], which compares the app found by the name with the running apps. If it finds it, we switch to the running app and return an object that represents the app. At the moment we are instead launching a second copy of the homescreen app.

[1] https://github.com/mozilla-b2g/gaia/blob/106001c4e0ab9253001bed815c03f46b8dd046f0/tests/python/gaia-ui-tests/gaiatest/atoms/gaia_apps.js#L186
I did try switching to simply locating the app by name, but there was no reference to the app frame, which makes switching to the correct context difficult...
I need to trace gaia_app.js to fix this.
Assignee: nobody → alive
Summary: Two instances of the Homescreen app can be launched → Two instances of the Homescreen app can be launched when running b2gperf
To get the appWindow object, try window.HomescreenLauncher.getHomescreen().
It returns the homescreenWindow object if it's already launched, or create new one according to homescreen settings when there's no one. We shouldn't rely on origin anymore since it's going to be abandoned. It's not a real identifier to an app.
OK I reproduced and I see this:

raceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/b2gperf/b2gperf.py", line 362, in test_scrollfps
    self.scroll_app(app_name)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/b2gperf/b2gperf.py", line 436, in scroll_app
    landing_page = self.marionette.find_element('id', 'landing-page')
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/marionette/marionette.py", line 631, in find_element
    response = self._send_message('findElement', 'value', **kwargs)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/marionette/marionette.py", line 350, in _send_message
    self._handle_error(response)
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/marionette/marionette.py", line 371, in _handle_error
    raise NoSuchElementException(message=message, status=status, stacktrace=stacktrace)
NoSuchElementException: Unable to locate element: landing-page
Homescreen: [0/1]
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/b2gperf/b2gperf.py", line 386, in test_scrollfps
    raise Exception('Exceeded failure threshold for gathering results!')
Exception: Exceeded failure threshold for gathering results!
Fix b2gperf by adding homescreen name back.

Please note b2gperf is still breaking after this patch,
because homescreen app doesn't have '#landing-page' element right now.

Also I don't have a test because I don't know how to write test for test..
Attachment #810685 - Flags: review?(timdream)
What the patch fixes: Two homescreen instance when running b2gperf.
Dave please ask crdlc to help the locating homescreen element part.
Blocks: 921328
Comment on attachment 810685 [details]
https://github.com/mozilla-b2g/gaia/pull/12479

Please make sure tests passes.
Attachment #810685 - Flags: review?(timdream) → review+
Comment on attachment 810685 [details]
https://github.com/mozilla-b2g/gaia/pull/12479

Dave, please check this works after your work is done in https://bugzilla.mozilla.org/show_bug.cgi?id=921328
Attachment #810685 - Flags: feedback?(dave.hunt)
Comment on attachment 810685 [details]
https://github.com/mozilla-b2g/gaia/pull/12479

This is working for me after applying the patch. I also re-triggered the Travis job that failed, and it passed! Thanks!
Attachment #810685 - Flags: feedback?(dave.hunt) → feedback+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: