Skip to content

Commit c71e61a

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Test insertion point no search terms display
1 parent 26a7fef commit c71e61a

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3168,6 +3168,13 @@ Description: Status panel URL label
31683168
Location: newtab page bottom left corner on link hover
31693169
Path to .json: modules/data/navigation.components.json
31703170
```
3171+
```
3172+
Selector Name: searchmode-engine
3173+
Selector Data: toolbarbutton#urlbar-searchmode-switcher[label*='{engine}, pick a search engine']
3174+
Description: Searchmode engine label
3175+
Location: Address bar searchmode engine label
3176+
Path to .json: modules/data/navigation.components.json
3177+
```
31713178
#### panel_ui
31723179
```
31733180
Selector name: panel-ui-button

modules/browser_object_navigation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -827,3 +827,15 @@ def verify_status_panel_url(self, expected_url: str):
827827
assert expected_url in actual_url, (
828828
f"Expected '{expected_url}' in status panel URL, got '{actual_url}'"
829829
)
830+
831+
@BasePage.context_chrome
832+
def verify_engine_returned(self, engine: str) -> None:
833+
"""
834+
Verify that the given search engine is visible in the search mode switcher.
835+
"""
836+
engine_locator = (
837+
self.elements["searchmode-engine"]["selectorData"].format(engine=engine)
838+
)
839+
self.wait.until(
840+
EC.visibility_of_element_located((By.CSS_SELECTOR, engine_locator))
841+
)

modules/data/navigation.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,5 +609,11 @@
609609
"selectorData": "statuspanel-label",
610610
"strategy": "id",
611611
"groups": []
612+
},
613+
614+
"searchmode-engine": {
615+
"selectorData": "toolbarbutton#urlbar-searchmode-switcher[label*='{engine}, pick a search engine']",
616+
"strategy": "css",
617+
"groups": []
612618
}
613619
}

modules/page_base.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,17 @@ def perform_key_combo(self, *keys) -> Page:
190190

191191
return self
192192

193+
@context_chrome
194+
def perform_key_combo_chrome(self, *keys) -> Page:
195+
"""
196+
Perform a keyboard shortcut in the browser chrome context (e.g., address bar).
197+
This method should be used for actions that target browser UI elements such as the
198+
awesome bar or toolbar buttons — not web content.
199+
Example:
200+
self.perform_key_combo_chrome(Keys.COMMAND, "c") # Copy from address bar
201+
"""
202+
return self.perform_key_combo(*keys)
203+
193204
def load_element_manifest(self, manifest_loc):
194205
"""Populate self.elements with the parse of the elements JSON"""
195206
logging.info(f"Loading element manifest: {manifest_loc}")
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import pytest
2+
from selenium.webdriver import Firefox, Keys
3+
4+
from modules.browser_object_navigation import Navigation
5+
6+
7+
TEXT = "Moza"
8+
DEFAULT_ENGINE = "Google"
9+
10+
@pytest.fixture()
11+
def test_case():
12+
return "3028716"
13+
14+
15+
@pytest.mark.parametrize("engine", ["Bing"])
16+
def test_insertion_point_no_search_terms_display(driver: Firefox, engine):
17+
"""
18+
C3028716 - Verify that Insertion Point without search terms is correctly displayed
19+
"""
20+
# Instantiate objects
21+
nav = Navigation(driver)
22+
23+
# Click on the USB and select one of the engines
24+
nav.click_search_mode_switcher()
25+
nav.set_search_mode(engine)
26+
27+
# Click on the url bar
28+
nav.click_in_awesome_bar()
29+
30+
# Press [backspace/Delete in macOS]
31+
nav.perform_key_combo_chrome(Keys.BACKSPACE)
32+
33+
# Check that the selected engine is returned to using default engine
34+
nav.verify_engine_returned(DEFAULT_ENGINE)
35+
36+
# Type anything in the url bar (example fire)
37+
nav.type_in_awesome_bar(TEXT)
38+
39+
# Check that there is no Bing "Search Mode", search suggestions populate with default engine
40+
nav.verify_engine_returned(DEFAULT_ENGINE)
41+
42+
# Press enter key
43+
nav.perform_key_combo_chrome(Keys.ENTER)
44+
45+
# Check that the search is done for "moza" using the default search engine
46+
nav.verify_engine_returned(DEFAULT_ENGINE)

0 commit comments

Comments
 (0)