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

Commit

Permalink
Bug 1132710 - Convert Mozmill test testSubmitUnencryptedInfoWarning t…
Browse files Browse the repository at this point in the history
…o Marionette. r=whimboo
  • Loading branch information
galgeek authored and whimboo committed Mar 9, 2015
1 parent e0f8f91 commit 36ed081
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions firefox_puppeteer/ui/windows.py
Expand Up @@ -407,6 +407,7 @@ class BrowserWindow(BaseWindow):
'chrome://branding/locale/browserconfig.properties',
'chrome://browser/locale/browser.properties',
'chrome://browser/locale/preferences/preferences.properties',
'chrome://global/locale/browser.properties',
]

def __init__(self, *args, **kwargs):
Expand Down
1 change: 1 addition & 0 deletions firefox_ui_tests/remote/security/manifest.ini
Expand Up @@ -2,4 +2,5 @@
[test_safe_browsing_warning_pages.py]
[test_security_notification.py]
[test_ssl_disabled_error_page.py]
[test_submit_unencrypted_info_warning.py]
[test_unknown_issuer.py]
@@ -0,0 +1,52 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

from marionette_driver import By, expected, Wait

from marionette_driver.errors import NoAlertPresentException
from marionette_driver.marionette import Alert

from firefox_ui_harness.testcase import FirefoxTestCase


class TestSubmitUnencryptedInfoWarning(FirefoxTestCase):

def setUp(self):
FirefoxTestCase.setUp(self)

self.url = 'https://ssl-dv.mozqa.com/data/firefox/security/unencryptedsearch.html'
self.test_string = 'mozilla'

self.prefs.set_pref('security.warn_submit_insecure', True)

def test_submit_unencrypted_info_warning(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.url)

# Get the page's search box and submit button.
searchbox = self.marionette.find_element(By.ID, 'q')
button = self.marionette.find_element(By.ID, 'submit')

# Use the page's search box to submit information.
searchbox.send_keys(self.test_string)
button.click()

# Get the expected warning text and replace its two instances of "##" with "\n\n".
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).until(
lambda _: warning.text == message)
finally:
warning.accept()

# Wait while the page updates
self.wait_for_condition(expected.element_stale(searchbox))

# Check that search_term contains the test string.
search_term = self.marionette.find_element(By.ID, 'search-term')
self.assertEqual(search_term.get_attribute('textContent'), self.test_string)

0 comments on commit 36ed081

Please sign in to comment.