summaryrefslogtreecommitdiffstats
path: root/testing/firefox-ui/tests/functional/security/test_mixed_content_page.py
blob: c146b46f4fa188b0c8dc9a1137ebb0cb20c3cc22 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# 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 firefox_puppeteer import PuppeteerMixin
from marionette_harness import MarionetteTestCase


class TestMixedContentPage(PuppeteerMixin, MarionetteTestCase):
    def setUp(self):
        super(TestMixedContentPage, self).setUp()

        self.locationbar = self.browser.navbar.locationbar
        self.identity_popup = self.locationbar.identity_popup

        self.url = 'https://mozqa.com/data/firefox/security/mixedcontent.html'

    def tearDown(self):
        try:
            self.identity_popup.close(force=True)
        finally:
            super(TestMixedContentPage, self).tearDown()

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

        self.assertEqual(self.locationbar.identity_box.get_property('className'),
                         'unknownIdentity mixedDisplayContent')

        # Open the identity popup
        self.locationbar.open_identity_popup()

        # Only the insecure label is visible in the main view
        secure_label = self.identity_popup.view.main.secure_connection_label
        self.assertEqual(secure_label.value_of_css_property('display'), 'none')

        insecure_label = self.identity_popup.view.main.insecure_connection_label
        self.assertNotEqual(insecure_label.value_of_css_property('display'), 'none')

        # TODO: Bug 1177417 - Needs to open and close the security view, but a second
        # click on the expander doesn't hide the security view
        # self.identity_popup.view.main.expander.click()
        # Wait(self.marionette).until(lambda _: self.identity_popup.view.security.selected)

        # Only the insecure label is visible in the security view
        secure_label = self.identity_popup.view.security.secure_connection_label
        self.assertEqual(secure_label.value_of_css_property('display'), 'none')

        insecure_label = self.identity_popup.view.security.insecure_connection_label
        self.assertNotEqual(insecure_label.value_of_css_property('display'), 'none')

        # owner is not visible
        owner = self.identity_popup.view.security.owner
        self.assertEqual(owner.value_of_css_property('display'), 'none')