Closed
Bug 938061
Opened 11 years ago
Closed 11 years ago
Write a test to open Settings app from Utility tray
Categories
(Firefox OS Graveyard :: Gaia::UI Tests, defect)
Tracking
(b2g-v1.2 affected)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
b2g-v1.2 | --- | affected |
People
(Reporter: zcampbell, Assigned: jhammink)
References
Details
Attachments
(2 files, 7 obsolete files)
Testcase test setup: none should be req'd 1. Open utility tray 2. Tap 'Settings' button 3. Wait for and assert the Settings app to be the displayed app. This test can be enabled for TBPL, Travis and device testing in the respective manifests.
Assignee | ||
Comment 1•11 years ago
|
||
Are there other utility tray tests that can be used as a reference?
Assignee | ||
Comment 2•11 years ago
|
||
aha, ok: test_system_notification_bar.py lines 28 - 30: utility_tray = system.open_utility_tray() utility_tray.wait_for_notification_container_displayed() mhmyes...
Reporter | ||
Comment 3•11 years ago
|
||
Yes I think for this test, aside from tapping the button itself, you can mostly get away with cannibalizing other tests for working code snippets :)
Assignee | ||
Comment 4•11 years ago
|
||
On a more basic note, is there a way to list available buttons or actionable DOM elements in the current context? https://marionette_client.readthedocs.org/en/latest/index.html#dom-element-methods offers some clues but I'm not quite there yet. In previous automation frameworks I've used, there have been tools to browse the object hierarchy.
Comment 5•11 years ago
|
||
The closest we have for that, I think, is the AppManager, which is available in Aurora and Nightly and was demoed at the Summit. It actually works quite well for inspecting the DOM, although it doesn't provide an actual list of actionable DOM elements. Bebe wrote up some excellent instructions for using it. If you don't have those perhaps you can ping him for a copy.
Assignee | ||
Comment 6•11 years ago
|
||
Thanks for giving me the time to work on this! Shoutout to all those who want to take this test from me - please don't! I need to ramp up on this to learn. Thank you.
Assignee | ||
Comment 7•11 years ago
|
||
I've emailed Bebe - asking for those instructions. Bebe, if you could send those along, it would be really helpful!
Reporter | ||
Comment 8•11 years ago
|
||
Actually the instructions in "Help" (MDN) are pretty good already!
Assignee | ||
Comment 9•11 years ago
|
||
Are they? I can't find very much on APIs and methods there.
Assignee | ||
Comment 10•11 years ago
|
||
I guess the assumption is that there is some expertise in Selenium required. Still I wish that methods, etc were more discoverable. This is hard going.
Assignee | ||
Comment 11•11 years ago
|
||
ok, I may need some help on the last bit. I can't seem to find the right thing to wait for to show that settings app is in focus. I've browsed the DOM for settings app using app manager but most of those strings are localized so I don't know what to search for to wait. Can someone have a look?
Assignee | ||
Comment 12•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(bob.silverberg)
Assignee | ||
Comment 13•11 years ago
|
||
figured out what to wait for, but the assert is wrong. Attaching latest version. CCing Raymond, who helped me on the last step.
Assignee | ||
Comment 14•11 years ago
|
||
Attachment #8337150 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Flags: needinfo?(bob.silverberg) → needinfo?(mozbugs.retornam)
Reporter | ||
Comment 15•11 years ago
|
||
Comment on attachment 8337170 [details] test_quick_settings.py > #tap the settings button > self.marionette.find_element("id", "quick-settings-full-app").tap() You will want to put this into the utility_tray.py app as a method and include the locator in it too. tap_settings_button() or however you choose to name it. > > #wait for settings app to launch Here we are switching apps so things get a bit tricky inside b2g but from the test side we are only interested in the Settings app coming to the top frame so the user can then use it. We use this type of wait: self.wait_for_condition(lambda m: self.apps.displayed_app.name == "Settings") This makes sure that the Settings app is definitely the one which has come to the fore. that is pretty much it for this test!
Updated•11 years ago
|
Flags: needinfo?(mozbugs.retornam)
Assignee | ||
Comment 16•11 years ago
|
||
So I've updated my test script to include the last wait. I've attached it for posterity :)
Still need to figure out this next part:
> #tap the settings button
> self.marionette.find_element("id", "quick-settings-full-app").tap()
You will want to put this into the utility_tray.py app as a method and include the locator in it too.
tap_settings_button() or however you choose to name it.
Assignee | ||
Comment 17•11 years ago
|
||
Can you please show me an example of how this is done?
Assignee | ||
Comment 18•11 years ago
|
||
Understood that https://github.com/mozilla-b2g/gaia/blob/v1.2/tests/python/gaia-ui-tests/gaiatest/apps/system/regions/utility_tray.py?source=cc Is the file to be changed, and I think you mean something needs to be changed in the first section, but I'm unclear as to what specifically. Please understand I'm new to Selenium.
Flags: needinfo?(zcampbell)
Assignee | ||
Comment 19•11 years ago
|
||
Attachment #8337170 -
Attachment is obsolete: true
Assignee | ||
Comment 20•11 years ago
|
||
Attachment #8338140 -
Attachment is obsolete: true
Assignee | ||
Comment 21•11 years ago
|
||
Assignee | ||
Comment 22•11 years ago
|
||
Ok, if no one minds, I'd like to attach these files here for review. I think I did it right. I know this isn't the "right" way to do this, but I want to make sure I know what I'm doing before we go back and forth on the pull requests. Thanks.
Reporter | ||
Comment 23•11 years ago
|
||
John, that's exactly it! I haven't run it but it looks right. The only nit I have is that settings_heading is no longer used in the test file so you can remove that. When you create your pull request, also add the file into tests/functional/settings/manifest.ini (note these are all in alphabetical order) as this will tell the test runner to run it on device/desktop. No special tags (eg wifi) are needed for this test.
Flags: needinfo?(zcampbell)
Assignee | ||
Comment 24•11 years ago
|
||
Ok, I've removed that line from the testcase and checked it. It works! I'll need to check it still against 1.3 first. I'll go through the steps and get the pull request going today or tomorrow.
Assignee | ||
Comment 25•11 years ago
|
||
Assignee | ||
Comment 26•11 years ago
|
||
By the way, should we be writing tests against 1.3 at this point or is 1.2 still ok?
Reporter | ||
Comment 27•11 years ago
|
||
Looking good John. We mostly write tests against v1.3 and then uplift it into v1.2 to closely follow the general Gaia workflow. Most tests work on both branches, though and I would be surprised if this is different. If you could make the pull request against 1.3 (master) branch that would be ideal.
Assignee | ||
Comment 28•11 years ago
|
||
Ok, learning - and working on it - now.
Assignee | ||
Comment 29•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #8339550 -
Flags: review?(zcampbell)
Assignee | ||
Comment 30•11 years ago
|
||
isn't it supposed to add a link to the pull request here? Ugg, confusing.
Assignee | ||
Comment 31•11 years ago
|
||
So I noticed on the pull request link that the travis build failed. What happened?
Assignee | ||
Comment 32•11 years ago
|
||
Need-infoing Zac. Not sure if this is necessary to get on your radar (possibly not) but wanted to resolve whatever the issue is in travis.
Flags: needinfo?(zcampbell)
Assignee | ||
Comment 33•11 years ago
|
||
...and actually learn what the issue is so I can fix it in the future.
Reporter | ||
Comment 34•11 years ago
|
||
Actually your test passed fine! I can see it on Travis at the bottom here: https://travis-ci.org/mozilla-b2g/gaia/jobs/14628383 That means it's all fine. There are some small tweaks to do to the code syntax but I'll note them in the pull request.
Flags: needinfo?(zcampbell)
Reporter | ||
Comment 35•11 years ago
|
||
I've finished the comments in the pull request John. Functionally it's fine; the comments are just around style and layout to fit the standard of the rest of the test code. Cheers!
Reporter | ||
Comment 36•11 years ago
|
||
Comment on attachment 8339550 [details] [review] pointer to github pull request for 938061 r-, nitpick on syntax but functionally Ok. re-set the r? when you have updated it! Also,if you can, make the changes all in one commit so it is easier for the sheriffs and us to manage.
Attachment #8339550 -
Flags: review?(zcampbell) → review-
Assignee | ||
Comment 37•11 years ago
|
||
Reset what r, where? The pull request is updated, Zac. I had some trouble squashing commits. Please let me know if everything is OK.
Assignee | ||
Updated•11 years ago
|
Attachment #8339550 -
Flags: review- → review?(zcampbell)
Assignee | ||
Comment 38•11 years ago
|
||
I should mention that I was unable to run tests after updating my pull request. File "/usr/local/bin/gaiatest", line 5, in <module> from pkg_resources import load_entry_point File "build/bdist.macosx-10.7-intel/egg/pkg_resources.py", line 2793, in <module> File "build/bdist.macosx-10.7-intel/egg/pkg_resources.py", line 673, in require def subscribe(self, callback): File "build/bdist.macosx-10.7-intel/egg/pkg_resources.py", line 576, in resolve plugin_env, full_env=None, installer=None, fallback=True pkg_resources.DistributionNotFound: gaiatest==0.18 I know it's not my changes because I did a second clone of gaia and ran a different test that worked before, and still saw the issue.
Assignee | ||
Comment 39•11 years ago
|
||
Ok, Bob Silverberg helped me get set up with virtualenv again, so my tests are again running with gaiatests 0.19. Thank you Bob! Another problem has popped up when I run the test: TEST-UNEXPECTED-FAIL | test_quick_settings.py test_quick_settings.TestQuickSettingsButton.test_quick_settings_button | AttributeError: 'UtilityTray' object has no attribute 'tap_settings_button' But file apps/system/regions/utility_tray.py has such a method: def tap_settings_button(self): self.marionette.find_element(*self._quicksettings_app_locator).tap() which points to this locator: _quicksettings_app_locator = (By.ID, 'quick-settings-full-app') So not sure what happened there, unless the ID suddenly changed in yesterday's gaia build. I'll break out the app damager tomorrow and eyeball this, but maybe there is something else happening?
Assignee | ||
Comment 40•11 years ago
|
||
OK, squashed everything to one commit (I think) and the test is working again. Let's get this in!
Assignee | ||
Updated•11 years ago
|
Attachment #8339550 -
Flags: review?(zcampbell) → review?(bob.silverberg)
Comment 41•11 years ago
|
||
Comment on attachment 8339550 [details] [review] pointer to github pull request for 938061 r+ assuming the code formatting issues get fixed
Attachment #8339550 -
Flags: review?(bob.silverberg) → review+
Assignee | ||
Comment 42•11 years ago
|
||
Comment on attachment 8339550 [details] [review] pointer to github pull request for 938061 https://github.com/mozilla-b2g/gaia/pull/14378
Assignee | ||
Comment 43•11 years ago
|
||
Comment on attachment 8339550 [details] [review] pointer to github pull request for 938061 https://github.com/mozilla-b2g/gaia/pull/14378
Attachment #8339550 -
Flags: review+ → review?(bob.silverberg)
Assignee | ||
Comment 44•11 years ago
|
||
Comment on attachment 8339550 [details] [review] pointer to github pull request for 938061 https://github.com/mozilla-b2g/gaia/pull/14378
Assignee | ||
Comment 45•11 years ago
|
||
pull request: https://github.com/mozilla-b2g/gaia/pull/14378
Attachment #8338150 -
Attachment is obsolete: true
Attachment #8338152 -
Attachment is obsolete: true
Attachment #8338843 -
Attachment is obsolete: true
Attachment #8339550 -
Attachment is obsolete: true
Attachment #8339550 -
Flags: review?(bob.silverberg)
Attachment #8342722 -
Flags: review?(bob.silverberg)
Comment 46•11 years ago
|
||
Comment on attachment 8342722 [details] [review] latest pull request Landed on master in https://github.com/mozilla-b2g/gaia/commit/d2471af1a99a193107c539950ce965663d0b765c
Attachment #8342722 -
Flags: review?(bob.silverberg) → review+
Comment 48•11 years ago
|
||
Pointer to Github pull-request
Updated•11 years ago
|
Attachment #8343745 -
Flags: review?(florin.strugariu)
Attachment #8343745 -
Flags: review?(bob.silverberg)
Updated•11 years ago
|
Attachment #8343745 -
Flags: review?(florin.strugariu) → review+
Comment 49•11 years ago
|
||
Comment on attachment 8343745 [details] Pointer to Github pull request: https://github.com/mozilla-b2g/gaia/pull/14464 Let's merge it when the tree opens.
Attachment #8343745 -
Flags: review?(bob.silverberg) → review+
Comment 50•11 years ago
|
||
Merged: Master: https://github.com/mozilla-b2g/gaia/commit/d2471af1a99a193107c539950ce965663d0b765c V1.2 https://github.com/mozilla-b2g/gaia/commit/36cecf807fb7788f5b0146a6b9ebcaef78499b0f
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•