This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1132710 - Convert Mozmill test testSubmitUnencryptedInfoWarning t…
…o Marionette. r=whimboo
- Loading branch information
Showing
3 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
firefox_ui_tests/remote/security/test_submit_unencrypted_info_warning.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |