Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

Bug 1237396 - Convert testSafeBrowsing_initialDownload Mozmill test to Marionette. r=whimboo, maja_zf #328

Closed

Conversation

jrbenny35
Copy link

Hoping everything checks out on this, as it is my first ever contribution on github. Please feel free to tear it up!

@whimboo
Copy link
Contributor

whimboo commented Feb 12, 2016

So you run into timeout issues, this is most likely because you do not wait long enough or even better let Firefox download the files earlier. For the latter please read through the bug and check comment 5. Setting this preference should help us a lot here.


from firefox_puppeteer.testcases import FirefoxTestCase

from firefox_puppeteer.ui.browser.window import BrowserWindow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read https://www.python.org/dev/peps/pep-0008/#imports in how the coding style for imports should look like.

@jrbenny35
Copy link
Author

@whimboo Would you suggest both a 5 min timout and the nextupdatetime variable set?

@whimboo
Copy link
Contributor

whimboo commented Feb 12, 2016

For setting the preference you can use the following method: http://firefox-puppeteer.readthedocs.org/en/latest/api/prefs.html#firefox_puppeteer.api.prefs.Preferences.set_pref

@whimboo
Copy link
Contributor

whimboo commented Feb 12, 2016

5 minutes is definitely too long. With the preferences set the files should appear within seconds. Maybe you record some timings to see how fast they download?

self.test_url = 'https://mozqa.com'

# Set Browser Preferences
self.prefs.set_pref('browser.safebrowsing.provider.google.lastupdatetime', 1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that browser.safebrowsing.provider.google.lastupdatetime is not needed (sorry about that, it was my fault for mentioning it in the first place).

# Set Browser Preferences
self.prefs.set_pref('browser.safebrowsing.provider.google.nextupdatetime', 1)
self.prefs.set_pref('browser.safebrowsing.provider.mozilla.nextupdatetime', 1)
self.prefs.set_pref('browser.safebrowsing.provider.mozilla.lastupdatetime', 1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lastupdatetime shouldn't be necessary.

@@ -11,6 +11,7 @@ tags = local
tags = local
[test_safe_browsing_notification.py]
[test_safe_browsing_warning_pages.py]
[test_safe_browsing_primary_download.py]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please sort the files alphabetically.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benny, this still needs a correction.


def test_safe_browsing(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.test_url)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we have to navigate to this page? I don't see that this would trigger the download of the wanted files.

@jrbenny35
Copy link
Author

I hope this is everything!

@jrbenny35
Copy link
Author

@whimboo Please let me know if the platform list variable name is okay

import os
import sys

from marionette_driver import By, Wait
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: By is also not used in this test, so no need to import it.

@whimboo whimboo closed this Dec 2, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants