1
1
import pytest
2
+ from selenium .common .exceptions import TimeoutException
2
3
from selenium .webdriver import Firefox
3
4
4
5
from modules .browser_object import Navigation , PanelUi
5
- from modules .page_object import AboutConfig , AboutPrefs , GenericPage
6
+ from modules .page_object import AboutPrefs , GenericPage
6
7
7
8
8
9
@pytest .fixture ()
@@ -13,6 +14,16 @@ def test_case():
13
14
@pytest .fixture ()
14
15
def temp_selectors ():
15
16
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
+ },
16
27
"yahoo-logo" : {
17
28
"selectorData" : "sfp-placeholder" ,
18
29
"strategy" : "id" ,
@@ -24,13 +35,13 @@ def temp_selectors():
24
35
"groups" : [],
25
36
},
26
37
"duckduckgo-logo" : {
27
- "selectorData" : "minimal-homepage_logoHorizontal__Q_hjO " ,
28
- "strategy" : "class " ,
38
+ "selectorData" : "img[alt='DuckDuckGo Logo'] " ,
39
+ "strategy" : "css " ,
29
40
"groups" : [],
30
41
},
31
42
"duckduckgo-tagline" : {
32
- "selectorData" : "minimal-homepage_taglineText__owJPH " ,
33
- "strategy" : "class " ,
43
+ "selectorData" : "//span[contains(@class, ' minimal')] " ,
44
+ "strategy" : "xpath " ,
34
45
"groups" : [],
35
46
},
36
47
}
@@ -40,16 +51,51 @@ def temp_selectors():
40
51
WEBSITE_2 = "https://start.duckduckgo.com/"
41
52
42
53
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
+
43
87
@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
+ ):
46
91
"""
47
92
C545733.1: Verify that ticking the zoom text only box would only affect the scale of text.
48
93
Verify setting the default zoom level applies the chosen zoom level to all websites.
94
+
95
+ Arguments:
96
+ web_page: instance of generic page.
49
97
"""
50
98
# Initializing objects
51
- web_page = GenericPage (driver , url = WEBSITE_1 ).open ()
52
- web_page .elements |= temp_selectors
53
99
nav = Navigation (driver )
54
100
55
101
# Save the original positions of elements for comparison
@@ -75,18 +121,16 @@ def test_zoom_text_only_from_settings(driver: Firefox, temp_selectors):
75
121
about_prefs .click_on ("zoom-text-only" )
76
122
77
123
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
+ ):
80
127
"""
81
128
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" )
86
129
130
+ Arguments:
131
+ web_page: instance of generic page.
132
+ """
87
133
# Initializing objects
88
- web_page = GenericPage (driver , url = WEBSITE_1 ).open ()
89
- web_page .elements |= temp_selectors
90
134
nav = Navigation (driver )
91
135
92
136
# Save the original positions of elements for comparison
0 commit comments