Skip to content

Commit 8f86e9b

Browse files
authored
Merge pull request #113 from mozilla/as/https-first-mode-private-browsing
As/https first mode in private browsing
2 parents f06eed8 + b201a87 commit 8f86e9b

File tree

3 files changed

+34
-6
lines changed

3 files changed

+34
-6
lines changed

tests/address_bar_and_search/test_google_withads_url_bar_us.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import time
1+
from time import sleep
22

33
import pytest
44
from selenium.webdriver import Firefox
@@ -23,9 +23,9 @@ def test_google_withads_url_bar_us(driver: Firefox):
2323
util = Utilities()
2424

2525
nav.search("iphone")
26-
time.sleep(5)
26+
sleep(5)
2727
about_telemetry = AboutTelemetry(driver).open()
28-
time.sleep(5)
28+
sleep(5)
2929

3030
# Click on Raw JSON, switch tab and click on Raw Data
3131
about_telemetry.get_element("category-raw").click()

tests/address_bar_and_search/test_sap_google_adclick.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import time
1+
from time import sleep
22

33
import pytest
44
from selenium.webdriver import Firefox
@@ -25,11 +25,11 @@ def test_sap_google_adclick(driver: Firefox):
2525
# search and click on an ad
2626
nav.search("iphone")
2727
nav.get_element("search-result").click()
28-
time.sleep(2)
28+
sleep(2)
2929

3030
# Click on Raw JSON, switch tab and click on Raw Data
3131
about_telemetry = AboutTelemetry(driver).open()
32-
time.sleep(2)
32+
sleep(2)
3333
about_telemetry.get_element("category-raw").click()
3434
about_telemetry.switch_to_new_tab()
3535
about_telemetry.get_element("rawdata-tab").click()
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.support.wait import WebDriverWait
4+
5+
HTTP_URL = "http://example.com"
6+
7+
8+
@pytest.fixture()
9+
def add_prefs():
10+
return [
11+
("browser.privatebrowsing.autostart", True),
12+
("dom.security.https_first_pbm", True),
13+
]
14+
15+
16+
def test_https_first_mode_in_private_browsing(driver: Firefox):
17+
"""
18+
C1362731 Check that https First Mode is properly enabled and working in Private Browsing
19+
"""
20+
21+
# Navigate to the HTTP URL
22+
driver.get(HTTP_URL)
23+
24+
# Wait for the URL to be redirected to HTTPS
25+
assert WebDriverWait(driver, 10).until(
26+
lambda d: d.current_url.startswith("https://"),
27+
message=f"Final URL should use HTTPS, but was: {driver.current_url}",
28+
)

0 commit comments

Comments
 (0)