Skip to content

Commit 5f0eea3

Browse files
committed
merge changes in
2 parents d39c1a5 + 944254f commit 5f0eea3

File tree

3 files changed

+64
-1
lines changed

3 files changed

+64
-1
lines changed

modules/data/about_prefs.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@
135135
"groups": []
136136
},
137137

138+
"firefox-suggest-nonsponsored": {
139+
"selectorData": "firefoxSuggestNonsponsored",
140+
"strategy": "id",
141+
"groups": []
142+
},
143+
144+
"firefox-suggest-sponsored": {
145+
"selectorData": "firefoxSuggestSponsored",
146+
"strategy": "id",
147+
"groups": []
148+
},
149+
138150
"home-new-tabs-dropdown": {
139151
"selectorData": "newTabMode",
140152
"strategy": "id",

modules/data/navigation.components.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,12 @@
162162
]
163163
},
164164

165+
"sponsored-suggestion": {
166+
"selectorData": "urlbarView-row-body-description",
167+
"strategy": "class",
168+
"groups": []
169+
},
170+
165171
"firefox-suggest": {
166172
"selectorData": "div.urlbarView-row[label=\"Firefox Suggest\"] > span.urlbarView-row-inner",
167173
"strategy": "css",
@@ -197,4 +203,4 @@
197203
"strategy": "css",
198204
"groups": []
199205
}
200-
}
206+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import time
2+
3+
import pytest
4+
from selenium.webdriver import Firefox
5+
6+
from modules.browser_object_navigation import Navigation
7+
from modules.page_object_about_prefs import AboutPrefs
8+
from modules.util import BrowserActions
9+
10+
11+
@pytest.fixture()
12+
def add_prefs():
13+
return [
14+
("browser.search.region", "US"),
15+
]
16+
17+
18+
@pytest.mark.slow
19+
def test_preferences_all_toggles_enabled(driver: Firefox):
20+
"""
21+
C1618400: Preferences - All toggles buttons Enabled
22+
"""
23+
# instantiate objects
24+
nav = Navigation(driver).open()
25+
about_prefs = AboutPrefs(driver, category="search").open()
26+
u = BrowserActions(driver)
27+
28+
# Check if toggles are enabled
29+
nonsponsored_checkbox = about_prefs.get_element("firefox-suggest-nonsponsored")
30+
assert nonsponsored_checkbox.is_selected(), f"Checkbox with selector '{nonsponsored_checkbox}' is not checked"
31+
sponsors_checkbox = about_prefs.get_element("firefox-suggest-sponsored")
32+
assert sponsors_checkbox.is_selected(), f"Checkbox with selector '{sponsors_checkbox}' is not checked"
33+
34+
# Check if sponsored suggestion is displayed. Using long sleeps otherwise sponsored suggestions won't be displayed
35+
time.sleep(20)
36+
u.search("iphone", with_enter=False)
37+
time.sleep(20)
38+
with (driver.context(driver.CONTEXT_CHROME)):
39+
assert nav.get_elements("sponsored-suggestion")
40+
41+
# Check if a non-sponsored suggestion is displayed
42+
u.search("wiki", with_enter=False)
43+
with (driver.context(driver.CONTEXT_CHROME)):
44+
assert not nav.get_elements("sponsored-suggestion")
45+
assert nav.get_element("firefox-suggest").is_displayed()

0 commit comments

Comments
 (0)