Skip to content

Commit c2cda5e

Browse files
authored
Anca/Delete history entry via Firefox Suggest completion list (#923)
* Add delete history entry via firefox suggest * Small modifications * Remove useless argument * Add test to key.yaml * Add test to functional.yaml * Add test to all.yaml * Add missing test from key that failed my pr in CI * Fixed typo * Add wait conditions * Avoid using the existing dirty profile * Replace the dirty profile * Modify method name * Fixed typo
1 parent c1be62b commit c2cda5e

File tree

6 files changed

+86
-3
lines changed

6 files changed

+86
-3
lines changed

SELECTOR_INFO.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3490,10 +3490,9 @@ Location: On the hamburger menu
34903490
Path to .json: modules/data/panel_ui.components.json
34913491
```
34923492
```
3493-
Selector name: bookmark-by-title
34943493
Selector Data: toolbarbutton.bookmark-item[label*='{title}']
3495-
Description: Bookmark item
3496-
Location: On the hamburger menu > Bookmarks
3494+
Description: Bookmark or history item by title. This selector works for both bookmarks and history items since Firefox uses the same CSS class "bookmark-item" for both in the hamburger menu UI.
3495+
Location: On the hamburger menu > Bookmarks or History
34973496
Path to .json: modules/data/panel_ui.components.json
34983497
```
34993498
```

manifests/all.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ address_bar_and_search:
4141
- test_search_code_google_us
4242
- test_searchmode_cleared_on_engine_removal
4343
- test_search_suggestions
44+
- test_delete_history_entry_via_firefox_suggest_completion_list
4445
audio_video:
4546
- test_block_audio_video_functionality
4647
- test_allow_audio_video_functionality

manifests/functional.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ address_bar_and_search:
66
- test_ctrl_enter_completes_link_and_can_refresh
77
- test_disable_websearch_from_awesome_bar
88
- test_searchmode_cleared_on_engine_removal
9+
- test_delete_history_entry_via_firefox_suggest_completion_list
910
tabs:
1011
- test_change_position_of_pinned_tabs
1112
- test_close_pinned_tab_via_mouse

manifests/key.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ address_bar_and_search:
1212
test_ctrl_enter_fixes_url: pass
1313
test_default_search_provider_change_awesome_bar: unstable
1414
test_default_search_provider_change_legacy_search_bar: deprecated
15+
test_delete_history_entry_via_firefox_suggest_completion_list: pass
1516
test_disable_websearch_from_awesome_bar: pass
1617
test_dont_show_search_suggestions_in_private_window: pass
1718
test_google_search_counts_us:
@@ -155,6 +156,7 @@ menus:
155156
test_tab_context_menu_close: pass
156157
meta:
157158
test_version: pass
159+
test_selectors: unstable
158160
networking:
159161
test_default_dns_protection: pass
160162
test_http_site: pass

modules/browser_object_panel_ui.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,38 @@ def confirm_history_clear(self):
278278
"recent-history-content", "value", "(Empty)"
279279
)
280280

281+
@BasePage.context_chrome
282+
def verify_history_item_exists(self, item_title: str) -> BasePage:
283+
"""
284+
Verify that a history item with the specified title exists in the history menu.
285+
Note:
286+
This method uses the "bookmark-by-title" selector, which works for both
287+
bookmarks and history items because Firefox uses the same CSS class "bookmark-item"
288+
for both in the hamburger menu UI. This is intentional design in Firefox's UI.
289+
Argument:
290+
item_title (str): The title text to look for in the history item (can be partial match)
291+
"""
292+
self.open_history_menu()
293+
self.get_all_history()
294+
self.element_visible("bookmark-by-title", labels=[item_title])
295+
return self
296+
297+
@BasePage.context_chrome
298+
def verify_history_item_does_not_exist(self, item_title: str) -> BasePage:
299+
"""
300+
Verify that a history item with the specified title exists in the history menu.
301+
Note:
302+
This method uses the "bookmark-by-title" selector, which works for both
303+
bookmarks and history items because Firefox uses the same CSS class "bookmark-item"
304+
for both in the hamburger menu UI. This is intentional design in Firefox's UI.
305+
Argument:
306+
item_title (str): The title text to look for in the history item (can be partial match)
307+
"""
308+
self.open_history_menu()
309+
self.get_all_history()
310+
self.element_not_visible("bookmark-by-title", labels=[item_title])
311+
return self
312+
281313
# Bookmarks section
282314

283315
@BasePage.context_chrome
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
from selenium.webdriver.common.keys import Keys
4+
5+
from modules.browser_object import Navigation, PanelUi
6+
7+
8+
@pytest.fixture()
9+
def test_case():
10+
return "3028901"
11+
12+
13+
HISTORY_PAGES = [
14+
"https://www.imdb.com/",
15+
"https://www.youtube.com/",
16+
"https://www.nasa.gov/",
17+
]
18+
19+
SEARCH_TERM = "you"
20+
HISTORY_ENTRY = "YouTube"
21+
22+
23+
def test_delete_history_from_url_bar_completion_list(driver: Firefox):
24+
"""
25+
C3028901 - Verify that deleting an entry from the Firefox Suggest completion list also removes the same entry from
26+
the History menu.
27+
"""
28+
# Initialize page objects
29+
nav = Navigation(driver)
30+
panel = PanelUi(driver)
31+
32+
# Create history by navigating to each page sequentially
33+
for url in HISTORY_PAGES:
34+
driver.get(url)
35+
36+
# Ensure the targeted entry is visible in History menu
37+
panel.verify_history_item_exists(HISTORY_ENTRY)
38+
39+
# Type into the URL bar to trigger suggestions
40+
nav.type_in_awesome_bar(SEARCH_TERM)
41+
nav.wait_for_suggestions_present()
42+
43+
# Select the suggestion and delete using Shift+Backspace
44+
nav.perform_key_combo_chrome(Keys.ARROW_DOWN)
45+
nav.perform_key_combo_chrome(Keys.SHIFT, Keys.BACKSPACE)
46+
47+
# Verify the entry is removed from History menu
48+
panel.verify_history_item_does_not_exist(HISTORY_ENTRY)

0 commit comments

Comments
 (0)