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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
# 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_driver import Wait
from marionette_harness import MarionetteTestCase
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'
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()
def test_dv_cert(self):
with self.marionette.using_context('content'):
self.marionette.navigate(self.url)
self.assertEqual(self.locationbar.identity_box.get_property('className'),
'verifiedDomain')
# Open the identity popup
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'])
# 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')
self.identity_popup.view.main.expander.click()
Wait(self.marionette).until(
lambda _: self.identity_popup.view.security.selected,
message='Security view of identity popup has not been selected.')
# Only the secure label is visible in the security view
secure_label = self.identity_popup.view.security.secure_connection_label
self.assertNotEqual(secure_label.value_of_css_property('display'), 'none')
insecure_label = self.identity_popup.view.security.insecure_connection_label
self.assertEqual(insecure_label.value_of_css_property('display'), 'none')
verifier_label = self.browser.localize_property('identity.identified.verifier')
self.assertEqual(self.identity_popup.view.security.verifier.get_property('textContent'),
verifier_label.replace("%S", cert['issuerOrganization']))
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.assertEqual(deck.security.owner.get_property('value'),
page_info_window.localize_property('securityNoOwner'))
self.assertEqual(deck.security.verifier.get_property('value'),
cert['issuerOrganization'])
|