|
| 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_RSA_WITH_AES_256_GCM_SHA384, 256 bit keys, " |
| 45 | + "TLS 1.2)") |
| 46 | + assert ( |
| 47 | + technical_details.get_attribute("value") == expected_technical_details |
| 48 | + ), f"Expected '{expected_technical_details}' but found '{technical_details.get_attribute('value')}'" |
0 commit comments