Skip to content

Commit 19e3890

Browse files
committed
Add searchmode on engine removal test
1 parent 700323d commit 19e3890

File tree

7 files changed

+70
-8
lines changed

7 files changed

+70
-8
lines changed

SELECTOR_INFO.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3273,7 +3273,12 @@ Description: Searchbar search engine button
32733273
Location: Searchbar
32743274
Path to .json: modules/data/navigation.components.json
32753275
```
3276-
searchbar-search-engine
3276+
```
3277+
Selector Name: search-mode-chicklet
3278+
Selector Data: label.searchmode-switcher-title
3279+
Description: Search mode chicklet
3280+
Location: Address bar search mode
3281+
Path to .json: modules/data/navigation.components.json
32773282
#### panel_ui
32783283
```
32793284
Selector name: panel-ui-button

modules/browser_object_autofill_popup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,6 @@ def verify_update_password_doorhanger(self, nav, expected_text):
141141

142142
# Verify the doorhanger text
143143
self.expect(
144-
lambda _: expected_text in self.get_element("password-update-doorhanger").text
144+
lambda _: expected_text
145+
in self.get_element("password-update-doorhanger").text
145146
)

modules/browser_object_navigation.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,7 @@ def wait_for_suggestions_absent(self):
382382
self.element_not_visible("suggestion-titles")
383383
return self
384384

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

398+
@BasePage.context_chrome
399+
def verify_search_mode_is_visible(self):
400+
"""Ensure the search mode is visible in URLbar."""
401+
self.element_visible("search-mode-chicklet")
402+
return self
403+
404+
@BasePage.context_chrome
405+
def verify_search_mode_is_not_visible(self):
406+
"""Ensure the search mode is cleared from URLbar."""
407+
self.element_not_visible("search-mode-chicklet")
408+
return self
409+
397410
def click_first_suggestion_row(self):
398411
"""
399412
Clicks the first visible suggestion row in the list, using robust scrolling and fallback.

modules/data/navigation.components.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,12 @@
645645
"selectorData": "button.searchbar-engine-one-off-item[tooltiptext='{engine}']",
646646
"strategy": "css",
647647
"groups": ["doNotCache"]
648-
}
648+
},
649+
650+
"search-mode-chicklet": {
651+
"selectorData": "label.searchmode-switcher-title",
652+
"strategy": "css",
653+
"groups": []
654+
}
649655

650656
}

modules/page_object_autofill.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -860,8 +860,8 @@ def generate_secure_password(self, context_menu):
860860
# Wait until the password field is actually filled
861861
self.parent.expect(
862862
lambda _: (
863-
(elem := self.parent.get_element("password-login-field"))
864-
and elem.get_attribute("value") not in ("", None)
863+
(elem := self.parent.get_element("password-login-field"))
864+
and elem.get_attribute("value") not in ("", None)
865865
)
866866
)
867867

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pytest
2+
3+
from modules.browser_object import Navigation, TabBar
4+
from modules.page_object_prefs import AboutPrefs
5+
6+
SEARCH_ENGINE = "DuckDuckGo"
7+
8+
9+
@pytest.fixture()
10+
def test_case():
11+
return "3028844"
12+
13+
14+
def test_search_mode_cleared_on_engine_removal(driver):
15+
"""
16+
C3028844 - Verify that removing a search engine from about:preferences#search clears search mode if that engine
17+
is currently selected in search mode in a different tab.
18+
"""
19+
# Instantiate objects
20+
nav = Navigation(driver)
21+
tabs = TabBar(driver)
22+
prefs = AboutPrefs(driver, category="search")
23+
24+
# Enter search mode for the desired search engine in a new tab
25+
nav.open_and_switch_to_new_window("tab")
26+
nav.open_usb_and_select_engine(SEARCH_ENGINE)
27+
28+
# Verify search mode is entered for the corresponding engine
29+
nav.verify_search_mode_is_visible()
30+
31+
# In another tab, remove that search engine from about:preferences#search
32+
nav.open_and_switch_to_new_window("tab")
33+
prefs.open()
34+
prefs.select_search_engine_from_tree(SEARCH_ENGINE)
35+
prefs.remove_search_engine(SEARCH_ENGINE)
36+
37+
# Return to the first tab and verify search mode is cleared
38+
tabs.click_tab_by_index(1)
39+
nav.verify_search_mode_is_not_visible()

tests/password_manager/test_auto_saved_generated_password_context_menu.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ def test_auto_saved_generated_password_context_menu(driver: Firefox):
3636
login_autofill.LoginForm(login_autofill).generate_secure_password(context_menu)
3737

3838
# Verify the update doorhanger is displayed
39-
autofill_popup_panel.verify_update_password_doorhanger(
40-
nav, UPDATE_DOORHANGER_TEXT
41-
)
39+
autofill_popup_panel.verify_update_password_doorhanger(nav, UPDATE_DOORHANGER_TEXT)
4240

4341
# Navigate to about:logins page
4442
tabs.switch_to_new_tab()

0 commit comments

Comments
 (0)