Bug 1414776 - [fxui] Change testcases from mozqa.com to badssl.com and mixed-content-tests-mozilla.org. draft
authorHenrik Skupin <mail@hskupin.info>
Tue, 24 Jul 2018 16:09:02 +0200
changeset 822017 23491680f5e925ed4025b0ca2a7ae285563720df
parent 821963 1e5fa52a612e8985e12212d1950a732954e00e45
child 822018 2e6d777dc8ce8770a7cce55a3eb083a4a81aed32
push id117255
push userbmo:hskupin@gmail.com
push dateTue, 24 Jul 2018 14:38:26 +0000
bugs1414776
milestone63.0a1
Bug 1414776 - [fxui] Change testcases from mozqa.com to badssl.com and mixed-content-tests-mozilla.org. MozReview-Commit-ID: DadY39FdZQT
testing/firefox-ui/tests/functional/security/test_dv_certificate.py
testing/firefox-ui/tests/functional/security/test_ev_certificate.py
testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
testing/firefox-ui/tests/functional/security/test_mixed_script_content_blocking.py
testing/firefox-ui/tests/functional/security/test_security_notification.py
testing/firefox-ui/tests/functional/security/test_ssl_disabled_error_page.py
testing/firefox-ui/tests/functional/security/test_ssl_status_after_restart.py
testing/firefox-ui/tests/functional/security/test_submit_unencrypted_info_warning.py
testing/firefox-ui/tests/functional/security/test_unknown_issuer.py
testing/firefox-ui/tests/functional/security/test_untrusted_connection_error_page.py
testing/firefox-ui/tests/puppeteer/test_security.py
testing/firefox-ui/tests/puppeteer/test_toolbars.py
testing/marionette/puppeteer/firefox/firefox_puppeteer/api/security.py
--- a/testing/firefox-ui/tests/functional/security/test_dv_certificate.py
+++ b/testing/firefox-ui/tests/functional/security/test_dv_certificate.py
@@ -10,17 +10,17 @@ from marionette_harness import Marionett
 class TestDVCertificate(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestDVCertificate, self).setUp()
 
         self.locationbar = self.browser.navbar.locationbar
         self.identity_popup = self.browser.navbar.locationbar.identity_popup
 
-        self.url = 'https://ssl-dv.mozqa.com'
+        self.url = 'https://mozilla-intermediate.badssl.com'
 
     def tearDown(self):
         try:
             self.browser.switch_to()
             self.identity_popup.close(force=True)
             self.puppeteer.windows.close_all([self.browser])
         finally:
             super(TestDVCertificate, self).tearDown()
@@ -36,18 +36,19 @@ class TestDVCertificate(PuppeteerMixin, 
         self.locationbar.open_identity_popup()
 
         # Check the identity popup doorhanger
         self.assertEqual(self.identity_popup.element.get_attribute('connection'), 'secure')
 
         cert = self.browser.tabbar.selected_tab.certificate
 
         # The shown host equals to the certificate
-        self.assertEqual(self.identity_popup.view.main.host.get_property('textContent'),
-                         cert['commonName'])
+        self.assertRegexpMatches(self.identity_popup.view.main.host.get_property('textContent'),
+                                 '.*badssl\.com$')
+        self.assertRegexpMatches(cert['commonName'], '.*badssl\.com$')
 
         # Only the secure label is visible in the main view
         secure_label = self.identity_popup.view.main.secure_connection_label
         self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
 
         insecure_label = self.identity_popup.view.main.insecure_connection_label
         self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
 
@@ -70,16 +71,16 @@ class TestDVCertificate(PuppeteerMixin, 
         def opener(mn):
             self.identity_popup.view.security.more_info_button.click()
 
         page_info_window = self.browser.open_page_info_window(opener)
         deck = page_info_window.deck
 
         self.assertEqual(deck.selected_panel, deck.security)
 
-        self.assertEqual(deck.security.domain.get_property('value'),
-                         cert['commonName'])
+        self.assertRegexpMatches(deck.security.domain.get_property('value'),
+                                 '.*badssl\.com$')
 
         self.assertEqual(deck.security.owner.get_property('value'),
                          page_info_window.localize_property('securityNoOwner'))
 
         self.assertEqual(deck.security.verifier.get_property('value'),
                          cert['issuerOrganization'])
--- a/testing/firefox-ui/tests/functional/security/test_ev_certificate.py
+++ b/testing/firefox-ui/tests/functional/security/test_ev_certificate.py
@@ -10,17 +10,17 @@ from marionette_harness import Marionett
 class TestEVCertificate(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestEVCertificate, self).setUp()
 
         self.locationbar = self.browser.navbar.locationbar
         self.identity_popup = self.locationbar.identity_popup
 
-        self.url = 'https://ssl-ev.mozqa.com/'
+        self.url = 'https://extended-validation.badssl.com'
 
     def tearDown(self):
         try:
             self.browser.switch_to()
             self.identity_popup.close(force=True)
             self.puppeteer.windows.close_all([self.browser])
         finally:
             super(TestEVCertificate, self).tearDown()
--- a/testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
+++ b/testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
@@ -2,24 +2,25 @@
 # 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 firefox_puppeteer import PuppeteerMixin
 from marionette_harness import MarionetteTestCase
 
 
 class TestMixedContentPage(PuppeteerMixin, MarionetteTestCase):
+
     def setUp(self):
         super(TestMixedContentPage, self).setUp()
 
         self.marionette.set_pref('security.mixed_content.upgrade_display_content', False)
         self.locationbar = self.browser.navbar.locationbar
         self.identity_popup = self.locationbar.identity_popup
 
-        self.url = 'https://mozqa.com/data/firefox/security/mixedcontent.html'
+        self.url = 'https://mixed.badssl.com'
 
     def tearDown(self):
         try:
             self.identity_popup.close(force=True)
         finally:
             super(TestMixedContentPage, self).tearDown()
 
     def test_mixed_content(self):
--- 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
@@ -7,17 +7,17 @@ from marionette_driver import By, Wait
 from marionette_harness import MarionetteTestCase
 
 
 class TestMixedScriptContentBlocking(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestMixedScriptContentBlocking, self).setUp()
 
-        self.url = 'https://mozqa.com/data/firefox/security/mixed_content_blocked/index.html'
+        self.url = 'https://mixed-content-tests-mozilla.org/mozqa/mixed_content_blocked/'
 
         self.test_elements = [
             ('result1', 'Insecure script one'),
             ('result2', 'Insecure script from iFrame'),
             ('result3', 'Insecure plugin'),
             ('result4', 'Insecure stylesheet'),
         ]
 
--- a/testing/firefox-ui/tests/functional/security/test_security_notification.py
+++ b/testing/firefox-ui/tests/functional/security/test_security_notification.py
@@ -12,21 +12,21 @@ from marionette_harness import Marionett
 
 class TestSecurityNotification(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestSecurityNotification, self).setUp()
 
         self.urls = [
             # Invalid cert page
-            'https://ssl-expired.mozqa.com',
+            'https://expired.badssl.com',
             # Secure page
-            'https://ssl-ev.mozqa.com/',
+            'https://extended-validation.badssl.com',
             # Insecure page
-            'http://no-ssl.mozqa.com'
+            'http://http.badssl.com'
         ]
 
         self.identity_box = self.browser.navbar.locationbar.identity_box
 
     def test_invalid_cert(self):
         with self.marionette.using_context('content'):
             # Go to a site that has an invalid (expired) cert
             self.assertRaises(MarionetteException, self.marionette.navigate, self.urls[0])
--- 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
@@ -10,17 +10,17 @@ from marionette_driver.errors import Mar
 from marionette_harness import MarionetteTestCase
 
 
 class TestSSLDisabledErrorPage(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestSSLDisabledErrorPage, self).setUp()
 
-        self.url = 'https://tlsv1-0.mozqa.com'
+        self.url = 'https://tls-v1-0.badssl.com:1010'
 
         self.puppeteer.utils.sanitize({"sessions": True})
 
         # Disable SSL 3.0, TLS 1.0 and TLS 1.1 for secure connections
         # by forcing the use of TLS 1.2
         # see: http://kb.mozillazine.org/Security.tls.version.*#Possible_values_and_their_effects
         self.marionette.set_pref('security.tls.version.min', 3)
         self.marionette.set_pref('security.tls.version.max', 3)
@@ -44,17 +44,17 @@ class TestSSLDisabledErrorPage(Puppeteer
             title = self.marionette.find_element(By.CLASS_NAME, 'title-text')
             nss_failure2title = self.browser.localize_entity('nssFailure2.title')
             self.assertEquals(title.get_property('textContent'), nss_failure2title)
 
             # Verify the error message is correct
             short_description = self.marionette.find_element(By.ID, 'errorShortDescText')
             self.assertIn('SSL_ERROR_UNSUPPORTED_VERSION',
                           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.marionette.timeout.page_load).until(
-                expected.element_present(By.LINK_TEXT, 'http://quality.mozilla.org'))
+            el = Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
+                expected.element_present(By.TAG_NAME, 'h1'))
+            self.assertIn('tls-v1-0', el.get_property('innerText'))
--- a/testing/firefox-ui/tests/functional/security/test_ssl_status_after_restart.py
+++ b/testing/firefox-ui/tests/functional/security/test_ssl_status_after_restart.py
@@ -9,29 +9,24 @@ from marionette_harness import Marionett
 
 class TestSSLStatusAfterRestart(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestSSLStatusAfterRestart, self).setUp()
 
         self.test_data = (
             {
-                'url': 'https://ssl-dv.mozqa.com',
+                'url': 'https://mozilla-intermediate.badssl.com',
                 'identity': '',
                 'type': 'secure'
             },
             {
-                'url': 'https://ssl-ev.mozqa.com/',
-                'identity': 'Mozilla Corporation',
+                'url': 'https://extended-validation.badssl.com',
+                'identity': 'Mozilla Foundation',
                 'type': 'secure-ev'
-            },
-            {
-                'url': 'https://ssl-ov.mozqa.com/',
-                'identity': '',
-                'type': 'secure'
             }
         )
 
         # Set browser to restore previous session
         self.marionette.set_pref('browser.startup.page', 3)
         # Disable rcwn to make cache behavior deterministic
         self.marionette.set_pref('network.http.rcwn.enable', False)
 
--- 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
@@ -9,17 +9,17 @@ from marionette_driver.marionette import
 from marionette_harness import MarionetteTestCase
 
 
 class TestSubmitUnencryptedInfoWarning(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestSubmitUnencryptedInfoWarning, self).setUp()
 
-        self.url = 'https://ssl-dv.mozqa.com/data/firefox/security/unencryptedsearch.html'
+        self.url = 'https://mixed-form.badssl.com/'
         self.test_string = 'mozilla'
 
         # Disable rcwn to make cache behavior deterministic
         self.marionette.set_pref('network.http.rcwn.enabled', False)
         self.marionette.set_pref('security.warn_submit_insecure', True)
 
     def tearDown(self):
         try:
@@ -28,18 +28,18 @@ class TestSubmitUnencryptedInfoWarning(P
         finally:
             super(TestSubmitUnencryptedInfoWarning, self).tearDown()
 
     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')
+            searchbox = self.marionette.find_element(By.ID, 'value')
+            button = self.marionette.find_element(By.CSS_SELECTOR, 'button')
 
             # 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.localize_property('formPostSecureToInsecureWarning.message')
             message = message.replace('##', '\n\n')
@@ -58,11 +58,10 @@ class TestSubmitUnencryptedInfoWarning(P
             Wait(self.marionette).until(expected.element_stale(searchbox))
 
             # 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";')
             )
 
-            # 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)
+            self.assertEqual('http://http.badssl.com/resources/form-submitted.html',
+                             self.marionette.get_url())
--- a/testing/firefox-ui/tests/functional/security/test_unknown_issuer.py
+++ b/testing/firefox-ui/tests/functional/security/test_unknown_issuer.py
@@ -9,17 +9,17 @@ from marionette_driver.errors import Mar
 from marionette_harness import MarionetteTestCase
 
 
 class TestUnknownIssuer(MarionetteTestCase):
 
     def setUp(self):
         super(TestUnknownIssuer, self).setUp()
 
-        self.url = 'https://ssl-unknownissuer.mozqa.com'
+        self.url = 'https://untrusted-root.badssl.com/'
 
     def test_unknown_issuer(self):
         with self.marionette.using_context('content'):
             # Go to a site that has a cert with an unknown issuer
             self.assertRaises(MarionetteException, self.marionette.navigate, self.url)
 
             # Wait for the DOM to receive events
             time.sleep(1)
--- 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
@@ -10,17 +10,17 @@ from marionette_driver.errors import Mar
 from marionette_harness import MarionetteTestCase
 
 
 class TestUntrustedConnectionErrorPage(PuppeteerMixin, MarionetteTestCase):
 
     def setUp(self):
         super(TestUntrustedConnectionErrorPage, self).setUp()
 
-        self.url = 'https://ssl-selfsigned.mozqa.com'
+        self.url = 'https://self-signed.badssl.com'
 
         # Disable rcwn to make cache behavior deterministic
         self.marionette.set_pref('network.http.rcwn.enabled', False)
 
     def tearDown(self):
         try:
             self.marionette.clear_pref('network.http.rcwn.enabled')
         finally:
--- a/testing/firefox-ui/tests/puppeteer/test_security.py
+++ b/testing/firefox-ui/tests/puppeteer/test_security.py
@@ -5,37 +5,35 @@
 from firefox_puppeteer import PuppeteerMixin
 from firefox_puppeteer.errors import NoCertificateError
 from marionette_harness import MarionetteTestCase
 
 
 class TestSecurity(PuppeteerMixin, MarionetteTestCase):
 
     def test_get_address_from_certificate(self):
-        url = 'https://ssl-ev.mozqa.com'
+        url = 'https://extended-validation.badssl.com'
 
         with self.marionette.using_context(self.marionette.CONTEXT_CONTENT):
             self.marionette.navigate(url)
 
         cert = self.browser.tabbar.tabs[0].certificate
         self.assertIn(cert['commonName'], url)
-        self.assertEqual(cert['organization'], 'Mozilla Corporation')
+        self.assertEqual(cert['organization'], 'Mozilla Foundation')
         self.assertEqual(cert['issuerOrganization'], 'DigiCert Inc')
 
         address = self.puppeteer.security.get_address_from_certificate(cert)
         self.assertIsNotNone(address)
         self.assertIsNotNone(address['city'])
         self.assertIsNotNone(address['country'])
-        self.assertIsNotNone(address['postal_code'])
         self.assertIsNotNone(address['state'])
-        self.assertIsNotNone(address['street'])
 
     def test_get_certificate(self):
         url_http = self.marionette.absolute_url('layout/mozilla.html')
-        url_https = 'https://ssl-ev.mozqa.com'
+        url_https = 'https://extended-validation.badssl.com'
 
         # Test EV certificate
         with self.marionette.using_context(self.marionette.CONTEXT_CONTENT):
             self.marionette.navigate(url_https)
         cert = self.browser.tabbar.tabs[0].certificate
         self.assertIn(cert['commonName'], url_https)
 
         # HTTP connections do not have a SSL certificate
--- a/testing/firefox-ui/tests/puppeteer/test_toolbars.py
+++ b/testing/firefox-ui/tests/puppeteer/test_toolbars.py
@@ -202,17 +202,17 @@ class TestAutoCompleteResults(PuppeteerM
 
 class TestIdentityPopup(PuppeteerMixin, MarionetteTestCase):
     def setUp(self):
         super(TestIdentityPopup, self).setUp()
 
         self.locationbar = self.browser.navbar.locationbar
         self.identity_popup = self.locationbar.identity_popup
 
-        self.url = 'https://ssl-ev.mozqa.com'
+        self.url = 'https://extended-validation.badssl.com'
 
         with self.marionette.using_context('content'):
             self.marionette.navigate(self.url)
 
     def tearDown(self):
         try:
             self.identity_popup.close(force=True)
         finally:
--- a/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/security.py
+++ b/testing/marionette/puppeteer/firefox/firefox_puppeteer/api/security.py
@@ -21,19 +21,17 @@ class Security(BaseLib):
         The returned address may be `None` in case of no address found, or a dictionary
         with the following entries: `city`, `country`, `postal_code`, `state`, `street`.
 
         :param certificate: A JSON object representing the certificate, which can usually be
          retrieved via the current tab: `self.browser.tabbar.selected_tab.certificate`.
 
         :returns: Address details as dictionary
         """
-        regex = re.compile('.*?L=(?P<city>.+?),ST=(?P<state>.+?),C=(?P<country>.+?)'
-                           ',postalCode=(?P<postal_code>.+?),STREET=(?P<street>.+?)'
-                           ',serial')
+        regex = re.compile('.*?L=(?P<city>.+?),ST=(?P<state>.+?),C=(?P<country>.+?),')
         results = regex.search(certificate['subjectName'])
 
         return results.groupdict() if results else results
 
     def get_certificate_for_page(self, tab_element):
         """The SSL certificate assiciated with the loaded web page in the given tab.
 
         :param tab_element: The inner tab DOM element.