Skip to content
Open
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: 6 additions & 1 deletion SELECTOR_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -3273,7 +3273,12 @@ Description: Searchbar search engine button
Location: Searchbar
Path to .json: modules/data/navigation.components.json
```
searchbar-search-engine
```
Selector Name: search-mode-chicklet
Selector Data: label.searchmode-switcher-title
Description: Search mode chicklet
Location: Address bar search mode
Path to .json: modules/data/navigation.components.json
#### panel_ui
```
Selector name: panel-ui-button
Expand Down
13 changes: 13 additions & 0 deletions modules/browser_object_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ def wait_for_suggestions_absent(self):
self.element_not_visible("suggestion-titles")
return self

@BasePage.context_chrome
def open_usb_and_select_engine(self, engine_title: str):
"""Click the USB icon and select a search engine by its title."""
self.get_element("searchmode-switcher").click()
Expand All @@ -394,6 +395,18 @@ def assert_search_mode_chip_visible(self):
self.get_element("search-mode-span")
return self

@BasePage.context_chrome
def verify_search_mode_is_visible(self):
"""Ensure the search mode is visible in URLbar."""
self.element_visible("search-mode-chicklet")
return self

@BasePage.context_chrome
def verify_search_mode_is_not_visible(self):
"""Ensure the search mode is cleared from URLbar."""
self.element_not_visible("search-mode-chicklet")
return self

def click_first_suggestion_row(self):
"""
Clicks the first visible suggestion row in the list, using robust scrolling and fallback.
Expand Down
8 changes: 7 additions & 1 deletion modules/data/navigation.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,12 @@
"selectorData": "button.searchbar-engine-one-off-item[tooltiptext='{engine}']",
"strategy": "css",
"groups": ["doNotCache"]
}
},

"search-mode-chicklet": {
"selectorData": "label.searchmode-switcher-title",
"strategy": "css",
"groups": []
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pytest

from modules.browser_object import Navigation, TabBar
from modules.page_object_prefs import AboutPrefs

SEARCH_ENGINE = "DuckDuckGo"


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


def test_search_mode_cleared_on_engine_removal(driver):
"""
C3028844 - Verify that removing a search engine from about:preferences#search clears search mode if that engine
is currently selected in search mode in a different tab.
"""
# Instantiate objects
nav = Navigation(driver)
tabs = TabBar(driver)
prefs = AboutPrefs(driver, category="search")

# Enter search mode for the desired search engine in a new tab
nav.open_and_switch_to_new_window("tab")
nav.open_usb_and_select_engine(SEARCH_ENGINE)

# Verify search mode is entered for the corresponding engine
nav.verify_search_mode_is_visible()

# In another tab, remove that search engine from about:preferences#search
nav.open_and_switch_to_new_window("tab")
prefs.open()
prefs.select_search_engine_from_tree(SEARCH_ENGINE)
prefs.remove_search_engine(SEARCH_ENGINE)

# Return to the first tab and verify search mode is cleared
tabs.click_tab_by_index(1)
nav.verify_search_mode_is_not_visible()
Loading