Skip to content

Commit 698fd99

Browse files
committed
Create test for tls protocol
1 parent 8600804 commit 698fd99

File tree

6 files changed

+74
-2
lines changed

6 files changed

+74
-2
lines changed

modules/data/navigation.components.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,5 +202,23 @@
202202
"selectorData": "protections-popup-no-trackers-found-description",
203203
"strategy": "id",
204204
"groups": []
205+
},
206+
207+
"lock-icon": {
208+
"selectorData": "identity-icon",
209+
"strategy": "id",
210+
"groups": []
211+
},
212+
213+
"connection-secure-button": {
214+
"selectorData": "identity-popup-security-button",
215+
"strategy": "id",
216+
"groups": []
217+
},
218+
219+
"more-information-button": {
220+
"selectorData": "identity-popup-more-info",
221+
"strategy": "id",
222+
"groups": []
205223
}
206224
}

tests/security_and_privacy/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ def set_prefs(add_prefs: dict):
1111
"""Set prefs"""
1212
prefs = []
1313
prefs.extend(add_prefs)
14-
return prefs
14+
return prefs

tests/security_and_privacy/test_blocking_cryptominers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
import pytest
44
from selenium.webdriver import Firefox
5+
56
from modules.browser_object_navigation import Navigation
67
from modules.page_object_about_prefs import AboutPrefs
78

89
CRYPTOMINERS_URL = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
910

11+
1012
@pytest.fixture()
1113
def add_prefs():
1214
return []
1315

16+
1417
def test_blocking_cryptominers(driver: Firefox):
1518
# instantiate objects
1619
nav = Navigation(driver).open()

tests/security_and_privacy/test_cryptominers_blocked_and_shown_in_info_panel.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
import pytest
44
from selenium.webdriver import Firefox
5+
56
from modules.browser_object_navigation import Navigation
67

78
CRYPTOMINERS_URL = "https://senglehardt.com/test/trackingprotection/test_pages/fingerprinting_and_cryptomining.html"
89

10+
911
@pytest.fixture()
1012
def add_prefs():
1113
return []

tests/security_and_privacy/test_no_trackers_detected.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import pytest
22
from selenium.webdriver import Firefox
3+
34
from modules.browser_object_navigation import Navigation
45

56
NOTRACKERS_URL = "http://example.com/"
67

8+
79
@pytest.fixture()
810
def add_prefs():
911
return []
@@ -20,4 +22,4 @@ def test_no_trackers_detected(driver: Firefox):
2022
# Click on the shield icon and verify that trackers are detected
2123
with driver.context(driver.CONTEXT_CHROME):
2224
nav.get_element("shield-icon").click()
23-
assert nav.get_element("no-trackers-detected").is_displayed()
25+
assert nav.get_element("no-trackers-detected").is_displayed()
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.common.by import By
4+
from selenium.webdriver.support import expected_conditions as EC
5+
from selenium.webdriver.support.wait import WebDriverWait
6+
7+
from modules.browser_object_navigation import Navigation
8+
9+
TLS_URL = "https://tls-v1-2.badssl.com:1012/"
10+
11+
12+
@pytest.fixture()
13+
def add_prefs():
14+
return []
15+
16+
17+
def test_tls_v1_2_protocol(driver: Firefox):
18+
"""
19+
C192739 - TLS v1.2 protocol is handled correctly and returns the proper information
20+
"""
21+
nav = Navigation(driver)
22+
driver.get(TLS_URL)
23+
24+
tls_content = WebDriverWait(driver, 10).until(
25+
EC.presence_of_element_located((By.ID, "content"))
26+
)
27+
28+
expected_content = "tls-v1-2.\nbadssl.com"
29+
assert (
30+
tls_content.text == expected_content
31+
), f"Expected '{expected_content}' but found '{tls_content.text}' at {TLS_URL}"
32+
33+
with driver.context(driver.CONTEXT_CHROME):
34+
nav.get_element("lock-icon").click()
35+
nav.get_element("connection-secure-button").click()
36+
nav.get_element("more-information-button").click()
37+
38+
driver.switch_to.window(driver.window_handles[-1])
39+
40+
technical_details = WebDriverWait(driver, 10).until(
41+
EC.presence_of_element_located((By.ID, "security-technical-shortform"))
42+
)
43+
44+
expected_technical_details = "Connection Encrypted (TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, 128 bit keys, TLS 1.2)"
45+
assert (
46+
technical_details.get_attribute("value") == expected_technical_details
47+
), f"Expected '{expected_technical_details}' but found '{technical_details.get_attribute('value')}'"

0 commit comments

Comments
 (0)