Skip to content

Commit d790b88

Browse files
committed
Merge branch 'main' into tw/clear-cookies
2 parents b8629b1 + 582b6e5 commit d790b88

File tree

4 files changed

+61
-1
lines changed

4 files changed

+61
-1
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pypom = "*"
1616
jsonpath-ng = "*"
1717
pillow = "*"
1818
pyfxa = "*"
19+
pytest-rerunfailures = "*"
1920

2021
[dev-packages]
2122
werkzeug = "*"

ci_pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ markers = [
1616
testpaths = [
1717
"tests"
1818
]
19-
addopts = "-vs --ci -m 'not incident and not unstable' --html=artifacts/report.html"
19+
addopts = "-vs --ci --reruns 2 --reruns-delay 1 -m 'not incident and not unstable' --html=artifacts/report.html"
2020

2121
[tool.ruff]
2222
target-version = "py310"

tests/address_bar_and_search/test_sap_google_adclick.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import time
22

3+
import pytest
34
from selenium.webdriver import Firefox
45

56
from modules.browser_object_navigation import Navigation
@@ -8,6 +9,7 @@
89
from modules.util import Utilities
910

1011

12+
@pytest.mark.unstable
1113
def test_sap_google_adclick(driver: Firefox):
1214
"""
1315
C1365108, Test SAP Google adclick - URL bar - US
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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_tabbar import TabBar
8+
9+
PHISHING_URL = "http://www.itisatrap.org/firefox/its-a-trap.html"
10+
MALWARE_URL = "http://www.itisatrap.org/firefox/its-an-attack.html"
11+
12+
13+
@pytest.fixture()
14+
def add_prefs():
15+
return [
16+
("browser.safebrowsing.malware.enabled", True),
17+
("browser.safebrowsing.phishing.enabled", True),
18+
]
19+
20+
21+
def get_error_title(driver, url):
22+
"""
23+
Navigate to the given URL and return the error title text.
24+
"""
25+
driver.get(url)
26+
error_title_element = WebDriverWait(driver, 10).until(
27+
EC.presence_of_element_located((By.ID, "errorTitleText"))
28+
)
29+
return error_title_element.get_attribute("innerText")
30+
31+
32+
def test_phishing_and_malware_warning_errors(driver: Firefox):
33+
"""
34+
C1901393: - This tests that when a user accesses websites suspected of phishing or malware, a warning page is
35+
displayed.
36+
"""
37+
# Create the object
38+
tabs = TabBar(driver)
39+
40+
# Test phishing warning page
41+
phishing_error_title = get_error_title(driver, PHISHING_URL)
42+
assert phishing_error_title == "Deceptive site ahead", (
43+
f"Expected error title 'Deceptive site ahead' not found at {PHISHING_URL}. "
44+
f"Actual: {phishing_error_title}"
45+
)
46+
47+
# Open a new tab
48+
tabs.new_tab_by_button()
49+
tabs.wait_for_num_tabs(2)
50+
driver.switch_to.window(driver.window_handles[1])
51+
52+
# Test malware warning page
53+
malware_error_title = get_error_title(driver, MALWARE_URL)
54+
assert malware_error_title == "Visiting this website may harm your computer", (
55+
f"Expected error title 'Visiting this website may harm your computer' not found at {MALWARE_URL}. "
56+
f"Actual: {malware_error_title}"
57+
)

0 commit comments

Comments
 (0)