Skip to content

Commit d7daaa5

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Merge branch 'main' into Hani/address_doorhanger_captures_email_telephone
2 parents 83206b4 + b967f89 commit d7daaa5

File tree

2 files changed

+70
-19
lines changed

2 files changed

+70
-19
lines changed

tests/scrolling_panning_zooming/conftest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,15 @@ def suite_id():
77

88

99
@pytest.fixture()
10-
def set_prefs():
10+
def add_prefs():
11+
return []
12+
13+
14+
@pytest.fixture()
15+
def set_prefs(add_prefs: dict):
1116
"""Set prefs"""
12-
return [
17+
prefs = [
1318
("browser.aboutConfig.showWarning", False),
1419
]
20+
prefs.extend(add_prefs)
21+
return prefs

tests/scrolling_panning_zooming/test_zoom_text_only.py

Lines changed: 61 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import pytest
2+
from selenium.common.exceptions import TimeoutException
23
from selenium.webdriver import Firefox
34

45
from modules.browser_object import Navigation, PanelUi
5-
from modules.page_object import AboutConfig, AboutPrefs, GenericPage
6+
from modules.page_object import AboutPrefs, GenericPage
67

78

89
@pytest.fixture()
@@ -13,6 +14,16 @@ def test_case():
1314
@pytest.fixture()
1415
def temp_selectors():
1516
return {
17+
"yahoo-reject-cookie": {
18+
"selectorData": "button[name='reject']",
19+
"strategy": "css",
20+
"groups": [],
21+
},
22+
"yahoo-consent-page-scroll": {
23+
"selectorData": "scroll-down-btn",
24+
"strategy": "id",
25+
"groups": [],
26+
},
1627
"yahoo-logo": {
1728
"selectorData": "sfp-placeholder",
1829
"strategy": "id",
@@ -24,13 +35,13 @@ def temp_selectors():
2435
"groups": [],
2536
},
2637
"duckduckgo-logo": {
27-
"selectorData": "minimal-homepage_logoHorizontal__Q_hjO",
28-
"strategy": "class",
38+
"selectorData": "img[alt='DuckDuckGo Logo']",
39+
"strategy": "css",
2940
"groups": [],
3041
},
3142
"duckduckgo-tagline": {
32-
"selectorData": "minimal-homepage_taglineText__owJPH",
33-
"strategy": "class",
43+
"selectorData": "//span[contains(@class, 'minimal')]",
44+
"strategy": "xpath",
3445
"groups": [],
3546
},
3647
}
@@ -40,16 +51,51 @@ def temp_selectors():
4051
WEBSITE_2 = "https://start.duckduckgo.com/"
4152

4253

54+
@pytest.fixture()
55+
def add_prefs():
56+
"""
57+
Set the pref to zoom text only (simulate after restart)
58+
"""
59+
return [("browser.zoom.full", False)]
60+
61+
62+
@pytest.fixture()
63+
def web_page(driver: Firefox, temp_selectors):
64+
"""
65+
return instance of generic page with a given website
66+
"""
67+
generic_page = GenericPage(driver, url=WEBSITE_1)
68+
generic_page.elements |= temp_selectors
69+
generic_page.open()
70+
yield generic_page
71+
72+
73+
@pytest.fixture()
74+
def reject_consent_page(web_page: GenericPage):
75+
"""
76+
reject consent page. scroll to rejection button if necessary.
77+
"""
78+
try:
79+
if web_page.element_clickable("yahoo-consent-page-scroll"):
80+
web_page.click_on("yahoo-consent-page-scroll")
81+
web_page.wait.until(lambda _: web_page.element_clickable("yahoo-reject-cookie"))
82+
web_page.click_on("yahoo-reject-cookie")
83+
except TimeoutException:
84+
pass
85+
86+
4387
@pytest.mark.ci
44-
@pytest.mark.unstable
45-
def test_zoom_text_only_from_settings(driver: Firefox, temp_selectors):
88+
def test_zoom_text_only_from_settings(
89+
driver: Firefox, web_page: GenericPage, reject_consent_page
90+
):
4691
"""
4792
C545733.1: Verify that ticking the zoom text only box would only affect the scale of text.
4893
Verify setting the default zoom level applies the chosen zoom level to all websites.
94+
95+
Arguments:
96+
web_page: instance of generic page.
4997
"""
5098
# Initializing objects
51-
web_page = GenericPage(driver, url=WEBSITE_1).open()
52-
web_page.elements |= temp_selectors
5399
nav = Navigation(driver)
54100

55101
# Save the original positions of elements for comparison
@@ -75,18 +121,16 @@ def test_zoom_text_only_from_settings(driver: Firefox, temp_selectors):
75121
about_prefs.click_on("zoom-text-only")
76122

77123

78-
@pytest.mark.unstable
79-
def test_zoom_text_only_after_restart(driver: Firefox, temp_selectors):
124+
def test_zoom_text_only_after_restart(
125+
driver: Firefox, web_page: GenericPage, reject_consent_page
126+
):
80127
"""
81128
C545733.2: Verify that the zoom text only option works after restart
82-
"""
83-
# Set the pref to zoom text only (simulate after restart)
84-
about_config = AboutConfig(driver)
85-
about_config.toggle_true_false_config("browser.zoom.full")
86129
130+
Arguments:
131+
web_page: instance of generic page.
132+
"""
87133
# Initializing objects
88-
web_page = GenericPage(driver, url=WEBSITE_1).open()
89-
web_page.elements |= temp_selectors
90134
nav = Navigation(driver)
91135

92136
# Save the original positions of elements for comparison

0 commit comments

Comments
 (0)