Bug 1280878 - Update safebrowing_notification test for changed Google URL.
MozReview-Commit-ID: 7jkbKM9FLXg
--- a/testing/firefox-ui/tests/functional/security/test_safe_browsing_notification.py
+++ b/testing/firefox-ui/tests/functional/security/test_safe_browsing_notification.py
@@ -21,23 +21,23 @@ class TestSafeBrowsingNotificationBar(Fi
# since these errors are not reported
'button_property': None,
'report_page': None,
'unsafe_page': 'https://www.itisatrap.org/firefox/unwanted.html'
},
# Phishing URL info
{
'button_property': 'safebrowsing.notADeceptiveSiteButton.label',
- 'report_page': 'www.google.com/safebrowsing/report_error',
+ 'report_page': 'google.com/safebrowsing/report_error',
'unsafe_page': 'https://www.itisatrap.org/firefox/its-a-trap.html'
},
# Malware URL object
{
'button_property': 'safebrowsing.notAnAttackButton.label',
- 'report_page': 'www.stopbadware.org',
+ 'report_page': 'stopbadware.org',
'unsafe_page': 'https://www.itisatrap.org/firefox/its-an-attack.html'
}
]
self.prefs.set_pref('browser.safebrowsing.phishing.enabled', True)
self.prefs.set_pref('browser.safebrowsing.malware.enabled', True)
# Give the browser a little time, because SafeBrowsing.jsm takes a while
@@ -88,51 +88,60 @@ class TestSafeBrowsingNotificationBar(Fi
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(
- expected.element_present(By.ID, 'main-feature'))
+ 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.utils.permissions.remove('https://www.itisatrap.org', 'safe-browsing')
# Check the not a forgery or attack button in the notification bar
def check_not_badware_button(self, button_property, report_page):
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(
- lambda mn: report_page in mn.get_url())
+ 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(
- lambda mn: self.browser.default_homepage in mn.get_url())
+ 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(
- expected.element_stale(button))
+ expected.element_stale(button),
+ message='The notification bar has not been closed',
+ )