Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions SELECTOR_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,13 @@ Description: Status panel URL label
Location: newtab page bottom left corner on link hover
Path to .json: modules/data/navigation.components.json
```
```
Selector Name: searchmode-engine
Selector Data: toolbarbutton#urlbar-searchmode-switcher[label*='{engine}, pick a search engine']
Description: Searchmode engine label
Location: Address bar searchmode engine label
Path to .json: modules/data/navigation.components.json
```
#### panel_ui
```
Selector name: panel-ui-button
Expand Down
12 changes: 12 additions & 0 deletions modules/browser_object_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,15 @@ def verify_status_panel_url(self, expected_url: str):
assert expected_url in actual_url, (
f"Expected '{expected_url}' in status panel URL, got '{actual_url}'"
)

@BasePage.context_chrome
def verify_engine_returned(self, engine: str) -> None:
"""
Verify that the given search engine is visible in the search mode switcher.
"""
engine_locator = (
self.elements["searchmode-engine"]["selectorData"].format(engine=engine)
)
self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, engine_locator))
)
7 changes: 7 additions & 0 deletions modules/data/navigation.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -609,5 +609,12 @@
"selectorData": "statuspanel-label",
"strategy": "id",
"groups": []
},

"searchmode-engine": {
"selectorData": "toolbarbutton#urlbar-searchmode-switcher[label*='{engine}, pick a search engine']",
"strategy": "css",
"groups": []
}

}
60 changes: 60 additions & 0 deletions tests/address_bar_and_search/test_searchmode_change_tab.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import pytest
from selenium.webdriver import Firefox

from modules.browser_object_navigation import Navigation
from modules.browser_object_tabbar import TabBar

TEXT = "Fire"


@pytest.fixture()
def test_case():
return "3028732"


@pytest.mark.parametrize("engine1, engine2", [("Bing", "DuckDuckGo")])
def test_searchmode_change_tab(driver: Firefox, engine1, engine2):
"""
C3028732 - Verify that searchmode with change tab works correctly
"""

# Instantiate objects
nav = Navigation(driver)
tabs = TabBar(driver)

# Click on the USB
nav.click_search_mode_switcher()

# Click on Bing engine
nav.set_search_mode(engine1)

# "Search Mode" is visible in URL bar for Bing
nav.verify_engine_returned(engine1)

# Open a new tab and click on the USB
nav.open_and_switch_to_new_window("tab")
nav.click_search_mode_switcher()

# Click on the Duckduckgo engine
nav.set_search_mode(engine2)

# "Search Mode" is visible in URL bar for duckduckgo
nav.verify_engine_returned(engine2)

# Go back to tab from step #2
tabs.click_tab_by_index(1)

# Type any word and hit enter
nav.search(TEXT)

# Check search is done using Bing engine
nav.verify_engine_returned(engine1)

# Go back to the tab from step #4
tabs.click_tab_by_index(2)

# Type any word and hit enter
nav.search(TEXT)

# Check that search is done using the duckduckgo engine
nav.verify_engine_returned(engine2)