Closed Bug 1191023 Opened 6 years ago Closed 6 years ago

test_settings_do_not_track.py: "NoSuchElementException: Unable to locate element: //li/label[span[@data-l10n-id="doNotTrackActions"]]"

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: onelson, Assigned: martijn.martijn)

References

Details

Attachments

(1 file)

Description:
test_settings_do_not_track.py is failing consistently today, on being unable to find an element it was previously referencing. 

* http://jenkins1.qa.scl3.mozilla.com/view/UI/job/flame-kk-319.mozilla-central.nightly.ui.functional.non-smoke.1/388/HTML_Report/
* http://jenkins1.qa.scl3.mozilla.com/view/UI/job/flame-kk.ui.adhoc/853/HTML_Report/

Repro Steps:
1) Update phone to 20150804030313
2) Open the Settings app
3) Open 'Do Not Track' settings
4) Observe 'do not track' options

Actual:
Test exits, can't find options

Expected: 
Test modifies options and asserts accurate behavior


Traceback (most recent call last):
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/.env/local/lib/python2.7/site-packages/marionette_client-0.16-py2.7.egg/marionette/marionette_test.py", line 296, in run
testMethod()
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/tests/python/gaia-ui-tests/gaiatest/tests/functional/settings/test_settings_do_not_track.py", line 28, in test_enable_do_not_track_via_settings_app
do_not_track_settings.tap_disallow_tracking()
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/tests/python/gaia-ui-tests/gaiatest/apps/settings/regions/do_not_track.py", line 25, in tap_disallow_tracking
*self._disallow_tracking_checkbox_locator)
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/.env/local/lib/python2.7/site-packages/marionette_driver-0.9-py2.7.egg/marionette_driver/marionette.py", line 1589, in find_element
response = self._send_message('findElement', 'value', **kwargs)
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/.env/local/lib/python2.7/site-packages/marionette_driver-0.9-py2.7.egg/marionette_driver/decorators.py", line 36, in _
return func(*args, **kwargs)
File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/.env/local/lib/python2.7/site-packages/marionette_driver-0.9-py2.7.egg/marionette_driver/marionette.py", line 715, in _send_message
    self._handle_error(response)
  File "/var/jenkins/1/workspace/flame-kk.ui.adhoc/.env/local/lib/python2.7/site-packages/marionette_driver-0.9-py2.7.egg/marionette_driver/marionette.py", line 751, in _handle_error
    raise errors.lookup(status)(message, stacktrace=stacktrace)
NoSuchElementException: NoSuchElementException: Unable to locate element: //li/label[span[@data-l10n-id="doNotTrackActions"]]


Environmental Variables:
Device firmware (base) 	L1TC000118D0
Device firmware (date) 	04 Aug 2015 10:32:54
Device firmware (incremental) 	eng.cltbld.20150804.063236
Device firmware (release) 	4.4.2
Device identifier 	flame
Device memory 	219772 kB
Device serial 	e477d887
Device uptime 	0 days 0 hours 2 minutes 15 seconds
Gaia date 	03 Aug 2015 23:57:37
Gaia revision 	caba8b26c52d
Gecko build 	20150804030213
Gecko revision 	5b54831761b1
Gecko version 	42.0a1

Reproducible manually: No

Repro frequency: 5/5
Looks like this commit may have broken it, the file 'do_not_track.html' is no longer referencing 'span' when identifying it's radio controls. Probably need to modify our CSS_SELECTORS for these buttons.

* https://github.com/mozilla-b2g/gaia/commit/cffb0c75e995cc3f5e47ead7f6d4d837dcc8ce0f
Assignee: nobody → martijn.martijn
Blocks: 1185269
Attachment #8645081 - Flags: review?(npark)
Attachment #8645081 - Flags: review?(jlorenzo)
Comment on attachment 8645081 [details] [review]
[gaia] mwargers:1191023 > mozilla-b2g:master

locally ran and passed, looks good to me.
Attachment #8645081 - Flags: review?(npark) → review+
Comment on attachment 8645081 [details] [review]
[gaia] mwargers:1191023 > mozilla-b2g:master

We already have this workaround at 3 other places than this patch. I think it's the right time to factorize the workaround, until bug 1113742 is fixed.
Attachment #8645081 - Flags: review?(jlorenzo)
By the way, having less XPATH locators is awesome! CSS selectors looks simpler and are faster to execute by Marionette.
I see 2 benefits:
1. Duplication is removed. When I looked for the places where the workaround was used, I did a grep on "arguments[0].wrappedJSObject.checked" and found only the last 2 places you mentioned[1]. So, the day we'll be able to remove the factorized function, IDEs will be able to say that the function doesn't exist anymore, and will show all the places where the function was used. This will help removing the workaround
2. As you mentioned, we don't use the workaround the same way each time, which causes some readability issues. To prevent that:


def is_gaia_custom_checkbox_checked(self, element):
    return self.marionette.execute_script("return arguments[0].wrappedJSObject.checked", [element])

 # TODO: Remove me once bug 1113742 is fixed
def wait_on_check_state_for_gaia_custom_checkbox(self, element, checked=True):
    Wait(self.marionette).until(lambda m: self.is_gaia_custom_checkbox_checked is checked)


With that, we should be able to change the 4 places, including the places where the selector is hardcoded within the javascript (unless I missed something).


[1] I could have checked on the bug number in the comment, but I don't know why, I didn't :s
Flags: needinfo?(jlorenzo)
I see that https://www.w3.org/Bugs/Public/show_bug.cgi?id=26147 was fixed, which would allow bug 1113742 to be fixed, afaik. I needino-ed David Burns on that bug to see how that could be fixed.
Depends on: 1113742
Comment on attachment 8645081 [details] [review]
[gaia] mwargers:1191023 > mozilla-b2g:master

Ok, I think this is what you want.
The only thing I did different was, is using the names "is_custom_element_checked" and "wait_for_custom_element_checked_state" for the methods, because I think that's more in line with what's used for other methods.
Attachment #8645081 - Flags: review?(npark)
Attachment #8645081 - Flags: review?(jlorenzo)
Attachment #8645081 - Flags: review+
Comment on attachment 8645081 [details] [review]
[gaia] mwargers:1191023 > mozilla-b2g:master

the factorization seems straightforward, LGTM.
Attachment #8645081 - Flags: review?(npark) → review+
Comment on attachment 8645081 [details] [review]
[gaia] mwargers:1191023 > mozilla-b2g:master

It looks good to me.
Attachment #8645081 - Flags: review?(jlorenzo) → review+
Merged: https://github.com/mozilla-b2g/gaia/commit/983cb95ff55c133db3f737db435d7d93b777a662
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Depends on: 1195383
Depends on: 1196231
You need to log in before you can comment on or make changes to this bug.