-
-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Selenium tests in Firefox #1168
Conversation
tests/selenium/pbtest.py
Outdated
self.js = self.driver.execute_script | ||
|
||
super(PBSeleniumTest, self).run(result) | ||
if result._excinfo: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a dirty hack to get a nice @repeat_if_failed
decorator working. It only works with pytest. It should be removed once the tests are more consistent.
Firefox tests pass! 🎉 🎈 The pbtest.py stuff could be cleaned up some. But this is mostly ready for review. |
Green checks! ✓✓✓✓✓✓✓✓✓✓✓✓✓ |
|
||
@pbtest.repeat_if_failed(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test now gets re-run if it fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So now instead of the whole test suite getting re-run for this flaky test, only tests with this decorator get re-run. Which should greatly improve the speed of the travis runs.
get_sc_domains_js = "return JSON.stringify(badger.storage."\ | ||
"getBadgerStorageObject('supercookie_domains').getItemClones())" | ||
supercookieDomains = json.loads(self.js(get_sc_domains_js)) | ||
return origin in supercookieDomains | ||
|
||
@pbtest.repeat_if_failed(5) | ||
def test_should_detect_ls_of_third_party_frame(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also gets re-run.
@@ -42,6 +44,9 @@ def test_page_title(self): | |||
" expected (%s)" | |||
% (self.driver.title, localized_title)) | |||
|
|||
|
|||
@unittest.skipIf(os.environ.get('BROWSER') == 'firefox', | |||
"selenium move_to is currently broken in firefox") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make an issue to eventually remove this once this PR is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good
Wow this is a huge PR and a huge amount of work! I just gave it a first pass and all is looking well so far, I'll take a second pass at it right now. |
This looks good to me. @ghostwords might want to take a second look, but I'm going to merge for now. Any other fixes can happen in follow pull requests AFAIC. Thanks! |
Currently the support for FireFoxe's WebExtensions in selenium is lacking. As of today there is no way to install a WebExtension #1181 with selenium, or geckodriver #211. Fortunately there is a way to install them using
web-ext
.The strategy in this PR is to get selenium working for us:
web-ext
geckodriver
to the running instance of firefoxselenium.webdirver.Remote
togeckodriver
xvfb
so we can run it on traviscloses #1009 🎉
I was experimenting with
xvfb
earlier today, so that step might not be too hard.Have y'all seen anyone else who has this working yet? This solution is kind of a hack, but it is only temporary until selenium gets up to speed.