Intermittent test_safe_browsing_warning_pages.py patch (
bug 1334996)
MozReview-Commit-ID: B48fa8FMeCk
--- 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
@@ -86,26 +86,36 @@ class TestSafeBrowsingWarningPages(Puppe
# 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.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.marionette.timeout.page_load).until(
- lambda mn: mn.execute_script('return document.readyState == "DOMContentLoaded" ||'
- ' document.readyState == "complete";')
- )
+ #Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+ # lambda mn: mn.execute_script('return document.readyState == "DOMContentLoaded" ||'
+ # ' document.readyState == "complete";')
+ #)
+ if not self.wait_url(self.marionette.get_url(), self.browser.get_final_url(url)):
+ exit()
# 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.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')
+
+ def wait_url(self, actual_url, checked_url):
+ ## will look for target URL from current time to 500 secs and poll every 5 secs
+ mustend=time.time() + 500
+ while time.time() < mustend:
+ if actual_url == checked_url : return True
+ time.sleep(5)
+ return
\ No newline at end of file