summaryrefslogtreecommitdiffstats
path: root/testing/firefox-ui/tests/functional/security/test_untrusted_connection_error_page.py
blob: 0dbce1c8fc13851c55275c939bd2b9c990d7f2a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 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/.

import time

from firefox_puppeteer import PuppeteerMixin
from marionette_driver import By, Wait
from marionette_driver.errors import MarionetteException
from marionette_harness import MarionetteTestCase


class TestUntrustedConnectionErrorPage(PuppeteerMixin, MarionetteTestCase):

    def setUp(self):
        super(TestUntrustedConnectionErrorPage, self).setUp()

        self.url = 'https://ssl-selfsigned.mozqa.com'

    def test_untrusted_connection_error_page(self):
        self.marionette.set_context('content')

        # In some localized builds, the default page redirects
        target_url = self.browser.get_final_url(self.browser.default_homepage)

        self.assertRaises(MarionetteException, self.marionette.navigate, self.url)

        # Wait for the DOM to receive events
        time.sleep(1)

        button = self.marionette.find_element(By.ID, "returnButton")
        button.click()

        Wait(self.marionette, timeout=self.marionette.timeout.page_load).until(
            lambda mn: target_url == self.marionette.get_url())