Bug 1321480: Make Firefox Puppeteer use Marionette's "page load" timeout
This is being used instead of a self-defined Browser.timeout.
MozReview-Commit-ID: 5zAqI38AdHs
--- a/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py
+++ b/testing/firefox-ui/tests/functional/private_browsing/test_about_private_browsing.py
@@ -48,13 +48,13 @@ class TestAboutPrivateBrowsing(Puppeteer
self.assertTrue(pb_window.is_private)
def tab_opener(tab):
with tab.marionette.using_context('content'):
link = tab.marionette.find_element(By.ID, 'learnMore')
link.click()
tab = pb_window.tabbar.open_tab(trigger=tab_opener)
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda _: tab.location == self.pb_url)
finally:
pb_window.close()
--- a/testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
+++ b/testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
@@ -40,17 +40,17 @@ class TestMixedScriptContentBlocking(Pup
else:
color, identity, state = (
'rgb(255, 0, 0)',
'unknownIdentity mixedActiveContent',
'unblocked'
)
# First call to Wait() needs a longer timeout due to the reload of the web page.
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda _: self.locationbar.identity_box.get_attribute('className') == identity,
message='Expected identity "{}" not found'.format(identity)
)
with self.marionette.using_context('content'):
for identifier, description in self.test_elements:
el = self.marionette.find_element(By.ID, identifier)
Wait(self.marionette).until(
--- a/testing/firefox-ui/tests/functional/security/test_safe_browsing_notification.py
+++ b/testing/firefox-ui/tests/functional/security/test_safe_browsing_notification.py
@@ -89,17 +89,17 @@ class TestSafeBrowsingNotificationBar(Pu
time.sleep(1)
self.check_ignore_warning_button(unsafe_page)
self.check_x_button()
def check_ignore_warning_button(self, unsafe_page):
button = self.marionette.find_element(By.ID, 'ignoreWarningButton')
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
expected.element_present(By.ID, 'main-feature'),
message='Expected target element "#main-feature" has not been found',
)
self.assertEquals(self.marionette.get_url(), self.browser.get_final_url(unsafe_page))
# Clean up here since the permission gets set in this function
self.puppeteer.utils.permissions.remove('https://www.itisatrap.org', 'safe-browsing')
@@ -108,42 +108,42 @@ class TestSafeBrowsingNotificationBar(Pu
with self.marionette.using_context('chrome'):
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
label = self.browser.get_property(button_property)
button = (self.marionette.find_element(By.ID, 'content')
.find_element('anon attribute', {'label': label}))
self.browser.tabbar.open_tab(lambda _: button.click())
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: report_page in mn.get_url(),
message='The expected safe-browsing report page has not been opened',
)
with self.marionette.using_context('chrome'):
self.browser.tabbar.close_tab()
def check_get_me_out_of_here_button(self):
with self.marionette.using_context('chrome'):
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
label = self.browser.get_property('safebrowsing.getMeOutOfHereButton.label')
button = (self.marionette.find_element(By.ID, 'content')
.find_element('anon attribute', {'label': label}))
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: self.browser.default_homepage in mn.get_url(),
message='The default home page has not been loaded',
)
def check_x_button(self):
with self.marionette.using_context('chrome'):
# TODO: update to use safe browsing notification bar class when bug 1139544 lands
button = (self.marionette.find_element(By.ID, 'content')
.find_element('anon attribute', {'value': 'blocked-badware-page'})
.find_element('anon attribute',
{'class': 'messageCloseButton close-icon tabbable'}))
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
expected.element_stale(button),
message='The notification bar has not been closed',
)
--- a/testing/firefox-ui/tests/functional/security/test_safe_browsing_warning_pages.py
+++ b/testing/firefox-ui/tests/functional/security/test_safe_browsing_warning_pages.py
@@ -64,48 +64,48 @@ class TestSafeBrowsingWarningPages(Puppe
# Wait for the DOM to receive events for about:blocked
time.sleep(1)
self.check_ignore_warning_button(unsafe_page)
def check_get_me_out_of_here_button(self, unsafe_page):
button = self.marionette.find_element(By.ID, "getMeOutButton")
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: self.browser.default_homepage in mn.get_url())
def check_report_button(self, unsafe_page):
# Get the URL of the support site for phishing and malware. This may result in a redirect.
with self.marionette.using_context('chrome'):
url = self.marionette.execute_script("""
Components.utils.import("resource://gre/modules/Services.jsm");
return Services.urlFormatter.formatURLPref("app.support.baseURL")
+ "phishing-malware";
""")
button = self.marionette.find_element(By.ID, "reportButton")
button.click()
# Wait for the button to become stale, whereby a longer timeout is needed
# here to not fail in case of slow connections.
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
expected.element_stale(button))
# Wait for page load to be completed, so we can verify the URL even if a redirect happens.
# TODO: Bug 1140470: use replacement for mozmill's waitforPageLoad
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: mn.execute_script('return document.readyState == "DOMContentLoaded" ||'
' document.readyState == "complete";')
)
# check that our current url matches the final url we expect
self.assertEquals(self.marionette.get_url(), self.browser.get_final_url(url))
def check_ignore_warning_button(self, unsafe_page):
button = self.marionette.find_element(By.ID, 'ignoreWarningButton')
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
expected.element_present(By.ID, 'main-feature'))
self.assertEquals(self.marionette.get_url(), self.browser.get_final_url(unsafe_page))
# Clean up by removing safe browsing permission for unsafe page
self.puppeteer.utils.permissions.remove('https://www.itisatrap.org', 'safe-browsing')
--- a/testing/firefox-ui/tests/functional/security/test_ssl_disabled_error_page.py
+++ b/testing/firefox-ui/tests/functional/security/test_ssl_disabled_error_page.py
@@ -51,10 +51,10 @@ class TestSSLDisabledErrorPage(Puppeteer
short_description.get_property('textContent'))
self.assertIn('mozqa.com', short_description.get_property('textContent'))
# Verify that the "Restore" button appears and works
reset_button = self.marionette.find_element(By.ID, 'prefResetButton')
reset_button.click()
# With the preferences reset, the page has to load correctly
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
expected.element_present(By.LINK_TEXT, 'http://quality.mozilla.org'))
--- a/testing/firefox-ui/tests/functional/security/test_submit_unencrypted_info_warning.py
+++ b/testing/firefox-ui/tests/functional/security/test_submit_unencrypted_info_warning.py
@@ -41,25 +41,25 @@ class TestSubmitUnencryptedInfoWarning(P
message = self.browser.get_property('formPostSecureToInsecureWarning.message')
message = message.replace('##', '\n\n')
# Wait for the warning, verify the expected text matches warning, accept the warning
warning = Alert(self.marionette)
try:
Wait(self.marionette,
ignored_exceptions=NoAlertPresentException,
- timeout=self.browser.timeout_page_load).until(
+ timeout=self.marionette.timeout.page_load).until(
lambda _: warning.text == message)
finally:
warning.accept()
# Wait for the search box to become stale, then wait for the page to be reloaded.
Wait(self.marionette).until(expected.element_stale(searchbox))
# TODO: Bug 1140470: use replacement for mozmill's waitforPageLoad
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: mn.execute_script('return document.readyState == "DOMContentLoaded" ||'
' document.readyState == "complete";')
)
# Check that search_term contains the test string.
search_term = self.marionette.find_element(By.ID, 'search-term')
self.assertEqual(search_term.get_property('textContent'), self.test_string)
--- a/testing/firefox-ui/tests/functional/security/test_untrusted_connection_error_page.py
+++ b/testing/firefox-ui/tests/functional/security/test_untrusted_connection_error_page.py
@@ -26,10 +26,10 @@ class TestUntrustedConnectionErrorPage(P
self.assertRaises(MarionetteException, self.marionette.navigate, self.url)
# Wait for the DOM to receive events
time.sleep(1)
button = self.marionette.find_element(By.ID, "returnButton")
button.click()
- Wait(self.marionette, timeout=self.browser.timeout_page_load).until(
+ Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
lambda mn: target_url == self.marionette.get_url())
--- a/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
+++ b/testing/puppeteer/firefox/firefox_puppeteer/ui/browser/window.py
@@ -40,19 +40,16 @@ class BrowserWindow(BaseWindow):
]
def __init__(self, *args, **kwargs):
super(BrowserWindow, self).__init__(*args, **kwargs)
self._navbar = None
self._tabbar = None
- # Timeout for loading remote web pages
- self.timeout_page_load = 30
-
@property
def default_homepage(self):
"""The default homepage as used by the current locale.
:returns: The default homepage for the current locale.
"""
return self._prefs.get_pref('browser.startup.homepage', interface='nsIPrefLocalizedString')