Skip to content

Commit 57a33ab

Browse files
committed
Merge branch 'main' into as/cc-dropdown
2 parents 2dc0c95 + b43de03 commit 57a33ab

File tree

6 files changed

+75
-4
lines changed

6 files changed

+75
-4
lines changed

modules/browser_object_navigation.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ class Navigation(BasePage):
2222
"History": "^",
2323
"Actions": ">",
2424
}
25+
VALID_SEARCH_MODES = {
26+
"Google",
27+
"eBay",
28+
"Amazon.com",
29+
"Bing",
30+
"DuckDuckGo",
31+
"Wikipedia (en)",
32+
}
2533

2634
def expect_in_content(self, condition) -> BasePage:
2735
"""Like BasePage.expect, but guarantee we're looking at CONTEXT_CONTENT"""
@@ -171,6 +179,36 @@ def click_in_awesome_bar(self) -> BasePage:
171179
self.awesome_bar.click()
172180
return self
173181

182+
def click_search_mode_switcher(self) -> BasePage:
183+
"""
184+
click search mode switcher
185+
"""
186+
with self.driver.context(self.driver.CONTEXT_CHROME):
187+
self.search_mode_switcher = self.get_element("searchmode-switcher")
188+
self.search_mode_switcher.click()
189+
return self
190+
191+
def set_search_mode(self, search_mode: str) -> BasePage:
192+
"""
193+
set new search location if search_mode in VALID_SEARCH_MODES
194+
195+
Parameter:
196+
search_mode (str): search mode to be selected
197+
198+
Raises:
199+
StopIteration: if a valid search mode is not found in the list of valid elements.
200+
"""
201+
# check if search_mode is valid, otherwise raise error.
202+
if search_mode not in self.VALID_SEARCH_MODES:
203+
raise ValueError("search location is not valid.")
204+
# switch to chrome context
205+
with self.driver.context(self.driver.CONTEXT_CHROME):
206+
# get list of all valid search modes and filter by label
207+
self.get_element(
208+
"search-mode-switcher-option", labels=[search_mode]
209+
).click()
210+
return self
211+
174212
def context_click_in_awesome_bar(self) -> BasePage:
175213
self.set_awesome_bar()
176214
actions = ActionChains(self.driver)

modules/data/navigation.components.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,6 @@
322322
"strategy": "id",
323323
"groups": []
324324
},
325-
326325
"bookmarks-type-dropdown": {
327326
"selectorData": "editBMPanel_folderMenuList",
328327
"strategy": "id",
@@ -569,7 +568,6 @@
569568
"searchmode-switcher-settings": {
570569
"selectorData": "searchmode-switcher-popup-search-settings-button",
571570
"strategy": "id",
572-
573571
"groups": []
574572
},
575573

modules/page_object_prefs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,11 +394,12 @@ def click_popup_panel_button(self, field: str) -> BasePage:
394394
self.get_element("panel-popup-button", labels=[field]).click()
395395
return self
396396

397-
def select_https_only_setting(self, option_id: HttpsOnlyStatus) -> BasePage:
397+
def select_https_only_setting(self, option_id: "HttpsOnlyStatus") -> BasePage:
398398
"""
399399
Click the HTTPS Only option given
400400
"""
401401
self.find_in_settings("HTTPS")
402+
self.element_clickable(option_id)
402403
self.click_on(option_id)
403404
self.element_attribute_contains(option_id, "checked", "")
404405
return self
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.support import expected_conditions as EC
4+
5+
from modules.browser_object import Navigation
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "1365151"
11+
12+
13+
@pytest.mark.parametrize(
14+
"search_mode",
15+
["Google", "eBay", "Bing", "DuckDuckGo", "Wikipedia (en)", "Amazon.com"],
16+
)
17+
def test_search_engine_selector_and_validator(driver: Firefox, search_mode: str):
18+
"""
19+
Select Appropriate search engine and go to site, asserting that the correct search engine was used.
20+
21+
Parameters:
22+
driver (FireFox): webdriver used for communicating with the browser.
23+
search_mode (str): search parameter selected from the awesome bar.
24+
"""
25+
nav = Navigation(driver)
26+
url_element_search_mode = search_mode.split()[0].lower()
27+
nav.click_search_mode_switcher()
28+
nav.set_search_mode(search_mode)
29+
nav.search("soccer")
30+
nav.expect_in_content(EC.url_contains(url_element_search_mode))
31+
assert url_element_search_mode in driver.current_url
32+
nav.clear_awesome_bar()

tests/scrolling_panning_zooming/test_zoom_text_only.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def temp_selectors():
4141

4242

4343
@pytest.mark.ci
44+
@pytest.mark.unstable
4445
def test_zoom_text_only_from_settings(driver: Firefox, temp_selectors):
4546
"""
4647
C545733.1: Verify that ticking the zoom text only box would only affect the scale of text.
@@ -74,6 +75,7 @@ def test_zoom_text_only_from_settings(driver: Firefox, temp_selectors):
7475
about_prefs.click_on("zoom-text-only")
7576

7677

78+
@pytest.mark.unstable
7779
def test_zoom_text_only_after_restart(driver: Firefox, temp_selectors):
7880
"""
7981
C545733.2: Verify that the zoom text only option works after restart

tests/security_and_privacy/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ def add_prefs():
1414
@pytest.fixture()
1515
def set_prefs(add_prefs: dict):
1616
"""Set prefs"""
17-
prefs = []
17+
prefs = [("browser.urlbar.scotchBonnet.enableOverride", True)]
1818
prefs.extend(add_prefs)
1919
return prefs

0 commit comments

Comments
 (0)