From a3f5afc2b58a5c4228b3e2bf1c3ad06b51cc613c Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Thu, 30 Oct 2025 14:36:34 +0200 Subject: [PATCH 01/10] vs/search-suggestions-private-windows --- ...ow_search_suggestions_in_private_window.py | 59 +++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py new file mode 100644 index 000000000..ced1392f6 --- /dev/null +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -0,0 +1,59 @@ +import pytest +from selenium.webdriver import Firefox +from selenium.webdriver.common.by import By +from selenium.webdriver.common.keys import Keys +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +from modules.browser_object import Navigation +from modules.browser_object_panel_ui import PanelUi + + +@pytest.fixture() +def test_case(): + return "3028799" + + +SEARCH_ENGINES = [ + "@google", + "@bing", + "@duckduckgo", + "@wikipedia", +] + + +@pytest.mark.smoke +def test_3028799_no_search_engine_suggestions_in_private_window(driver: Firefox): + """ + C3028799 - Verify that in a New Private Window, after selecting a search shortcut, + suggestions from that search engine are not displayed while typing a query. + """ + panel = PanelUi(driver) + panel.open_and_switch_to_new_window("private") + + nav = Navigation(driver) + wait = WebDriverWait(driver, 3) + + for shortcut in SEARCH_ENGINES: + # Open a new tab for each search shortcut + nav.open_and_switch_to_new_window("tab") + + # Activate search mode via shortcut + nav.clear_awesome_bar() + nav.type_in_awesome_bar(shortcut + Keys.ENTER) + + # Type a query and verify no external search suggestions are shown + nav.clear_awesome_bar() + nav.type_in_awesome_bar("random") + + # Wait for urlbar results to appear (if any) + try: + wait.until(EC.presence_of_element_located((By.ID, "urlbar-results"))) + rows = driver.find_elements(By.CSS_SELECTOR, "#urlbar-results .urlbarView-row") + except Exception: + # If results container not found, treat as zero suggestions + rows = [] + + assert len(rows) <= 3, f"Unexpected suggestions displayed for {shortcut} (found {len(rows)} rows)." + + nav.clear_awesome_bar() From 0c10eb7ef81bfb2fd8b09f26439db94a0d2b4481 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Thu, 30 Oct 2025 16:23:43 +0200 Subject: [PATCH 02/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index ced1392f6..536ae5b32 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -40,7 +40,7 @@ def test_3028799_no_search_engine_suggestions_in_private_window(driver: Firefox) # Activate search mode via shortcut nav.clear_awesome_bar() - nav.type_in_awesome_bar(shortcut + Keys.ENTER) + nav.search(shortcut) # Type a query and verify no external search suggestions are shown nav.clear_awesome_bar() From 27507bea9ba8c442b03c70c16317740946c90a4d Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Fri, 31 Oct 2025 10:39:50 +0200 Subject: [PATCH 03/10] vs/search-suggestions-private-windows --- modules/browser_object_navigation.py | 41 +++++++++++++++++++ ...ow_search_suggestions_in_private_window.py | 41 +++++++++---------- 2 files changed, 61 insertions(+), 21 deletions(-) diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index cf5fd1eab..097312615 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -321,6 +321,26 @@ def awesome_bar_has_suggestions(self) -> bool: suggestions = self.get_all_children("results-dropdown") return len(suggestions) > 2 + def awesome_bar_has_no_external_suggestions(self, max_rows: int = 3) -> bool: + """ + Check that the awesome bar has no external (search engine) suggestions. + Returns True if only internal results (like history/bookmarks) are shown, + or if no suggestions appear at all. + + Args: + max_rows (int): Maximum number of internal suggestion rows allowed. + """ + try: + # Try to locate the suggestions container quickly + self.wait_for_suggestions_present(1) + suggestions = self.get_all_children("results-dropdown") + except Exception: + # No suggestions at all -> safe + return True + + # Allow a few internal rows (bookmarks/history) + return len(suggestions) <= max_rows + @BasePage.context_chrome def search_bar_has_suggestions(self, min_suggestions: int = 0) -> bool: """Check if the legacy search bar has suggestions. if a style has max-height: 0px, then no suggestions are present.""" @@ -350,6 +370,27 @@ def wait_for_suggestions_absent(self): self.element_not_visible("suggestion-titles") return self + def search_and_check_no_external_suggestions( + self, text: str, search_mode: str = "awesome", max_rows: int = 3 + ) -> bool: + """ + Type in the given search field and verify that no external search engine + suggestions are shown. + Returns True if no external suggestions are present. + """ + if search_mode == "awesome": + self.clear_awesome_bar() + self.type_in_awesome_bar(text) + time.sleep(0.5) + return self.awesome_bar_has_no_external_suggestions(max_rows) + elif search_mode == "search": + self.set_search_bar() + self.type_in_search_bar(text) + # reuse your existing search_bar_has_suggestions(min_suggestions) + return not self.search_bar_has_suggestions(max_rows) + else: + raise ValueError("search_mode must be either 'awesome' or 'search'") + 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() diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index 536ae5b32..2c54ffbed 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -1,12 +1,10 @@ import pytest from selenium.webdriver import Firefox -from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys -from selenium.webdriver.support.ui import WebDriverWait -from selenium.webdriver.support import expected_conditions as EC from modules.browser_object import Navigation from modules.browser_object_panel_ui import PanelUi +from modules.page_object_prefs import AboutPrefs @pytest.fixture() @@ -23,37 +21,38 @@ def test_case(): @pytest.mark.smoke -def test_3028799_no_search_engine_suggestions_in_private_window(driver: Firefox): +def test_no_search_engine_suggestions_in_private_window(driver: Firefox): """ C3028799 - Verify that in a New Private Window, after selecting a search shortcut, - suggestions from that search engine are not displayed while typing a query. + suggestions from that search engine are NOT displayed while typing a query. """ + # Open Private Window panel = PanelUi(driver) panel.open_and_switch_to_new_window("private") nav = Navigation(driver) - wait = WebDriverWait(driver, 3) + prefs = AboutPrefs(driver, category="search") # kept for parity / future use for shortcut in SEARCH_ENGINES: - # Open a new tab for each search shortcut + # Open a new tab for each shortcut nav.open_and_switch_to_new_window("tab") - # Activate search mode via shortcut + # Activate search mode using the shortcut nav.clear_awesome_bar() - nav.search(shortcut) - - # Type a query and verify no external search suggestions are shown - nav.clear_awesome_bar() - nav.type_in_awesome_bar("random") - - # Wait for urlbar results to appear (if any) try: - wait.until(EC.presence_of_element_located((By.ID, "urlbar-results"))) - rows = driver.find_elements(By.CSS_SELECTOR, "#urlbar-results .urlbarView-row") + nav.search(shortcut) except Exception: - # If results container not found, treat as zero suggestions - rows = [] - - assert len(rows) <= 3, f"Unexpected suggestions displayed for {shortcut} (found {len(rows)} rows)." + nav.type_in_awesome_bar(shortcut + Keys.ENTER) + + # Type a query and verify there are no external search suggestions + has_no_external_suggestions = nav.search_and_check_no_external_suggestions( + text="random", + search_mode="awesome", + max_rows=3, # allow small internal items like history/bookmarks + ) + + assert has_no_external_suggestions, ( + f"External search suggestions appeared for {shortcut} in Private Window." + ) nav.clear_awesome_bar() From b307fc30f96b8e7916b56a27a50f15549d3be722 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Fri, 31 Oct 2025 14:51:29 +0200 Subject: [PATCH 04/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index 2c54ffbed..a2be8dab8 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -31,7 +31,6 @@ def test_no_search_engine_suggestions_in_private_window(driver: Firefox): panel.open_and_switch_to_new_window("private") nav = Navigation(driver) - prefs = AboutPrefs(driver, category="search") # kept for parity / future use for shortcut in SEARCH_ENGINES: # Open a new tab for each shortcut From 312a19cc09185065bd194ddc0997110fab136443 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Fri, 31 Oct 2025 14:59:32 +0200 Subject: [PATCH 05/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index a2be8dab8..7257f94c0 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -4,7 +4,6 @@ from modules.browser_object import Navigation from modules.browser_object_panel_ui import PanelUi -from modules.page_object_prefs import AboutPrefs @pytest.fixture() From 4f5f1818e96a78719976d8715f7b51b13a610b83 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Fri, 31 Oct 2025 15:39:14 +0200 Subject: [PATCH 06/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index 7257f94c0..da540adab 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -35,12 +35,7 @@ def test_no_search_engine_suggestions_in_private_window(driver: Firefox): # Open a new tab for each shortcut nav.open_and_switch_to_new_window("tab") - # Activate search mode using the shortcut nav.clear_awesome_bar() - try: - nav.search(shortcut) - except Exception: - nav.type_in_awesome_bar(shortcut + Keys.ENTER) # Type a query and verify there are no external search suggestions has_no_external_suggestions = nav.search_and_check_no_external_suggestions( From 6a813235a7c9ca7ef904bb9fb4a007b250c3b30b Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Fri, 31 Oct 2025 15:47:29 +0200 Subject: [PATCH 07/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index da540adab..6a1c8c11d 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -1,6 +1,5 @@ import pytest from selenium.webdriver import Firefox -from selenium.webdriver.common.keys import Keys from modules.browser_object import Navigation from modules.browser_object_panel_ui import PanelUi From ad3c658b720d82116648a4e89c955e6c1c5a50b6 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Mon, 3 Nov 2025 11:15:12 +0200 Subject: [PATCH 08/10] vs/search-suggestions-private-windows --- modules/browser_object_navigation.py | 73 ++++++++++--------- ...ow_search_suggestions_in_private_window.py | 2 +- 2 files changed, 38 insertions(+), 37 deletions(-) diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index 097312615..ac58a41e5 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -321,25 +321,47 @@ def awesome_bar_has_suggestions(self) -> bool: suggestions = self.get_all_children("results-dropdown") return len(suggestions) > 2 - def awesome_bar_has_no_external_suggestions(self, max_rows: int = 3) -> bool: + def verify_no_external_suggestions( + self, + text: str | None = None, + search_mode: str = "awesome", + max_rows: int = 3, + type_delay: float = 0.5, + ) -> bool: """ - Check that the awesome bar has no external (search engine) suggestions. - Returns True if only internal results (like history/bookmarks) are shown, - or if no suggestions appear at all. + Returns True if no external (search engine) suggestions are shown. + Allows up to `max_rows` internal rows (history/bookmarks) in the awesome bar. - Args: - max_rows (int): Maximum number of internal suggestion rows allowed. + If `text` is provided, it types it into the chosen field first. """ - try: - # Try to locate the suggestions container quickly - self.wait_for_suggestions_present(1) - suggestions = self.get_all_children("results-dropdown") - except Exception: - # No suggestions at all -> safe - return True - # Allow a few internal rows (bookmarks/history) - return len(suggestions) <= max_rows + if search_mode == "awesome": + if text is not None: + self.clear_awesome_bar() + self.type_in_awesome_bar(text) + import time; + time.sleep(type_delay) + + # Try to detect suggestions container + try: + self.wait_for_suggestions_present(1) + suggestions = self.get_all_children("results-dropdown") + except Exception: + return True # no suggestions at all + + # Internal-only suggestions are fine up to `max_rows` + return len(suggestions) <= max_rows + + elif search_mode == "search": + # Legacy search bar path: if *any* suggestions show, treat as external + if text is not None: + self.set_search_bar() + self.type_in_search_bar(text) + # Reuse your existing probe: True => suggestions exist (external), so invert + return not self.search_bar_has_suggestions(min_suggestions=1) + + else: + raise ValueError("search_mode must be either 'awesome' or 'search'") @BasePage.context_chrome def search_bar_has_suggestions(self, min_suggestions: int = 0) -> bool: @@ -370,27 +392,6 @@ def wait_for_suggestions_absent(self): self.element_not_visible("suggestion-titles") return self - def search_and_check_no_external_suggestions( - self, text: str, search_mode: str = "awesome", max_rows: int = 3 - ) -> bool: - """ - Type in the given search field and verify that no external search engine - suggestions are shown. - Returns True if no external suggestions are present. - """ - if search_mode == "awesome": - self.clear_awesome_bar() - self.type_in_awesome_bar(text) - time.sleep(0.5) - return self.awesome_bar_has_no_external_suggestions(max_rows) - elif search_mode == "search": - self.set_search_bar() - self.type_in_search_bar(text) - # reuse your existing search_bar_has_suggestions(min_suggestions) - return not self.search_bar_has_suggestions(max_rows) - else: - raise ValueError("search_mode must be either 'awesome' or 'search'") - 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() diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index 6a1c8c11d..d28385f02 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -37,7 +37,7 @@ def test_no_search_engine_suggestions_in_private_window(driver: Firefox): nav.clear_awesome_bar() # Type a query and verify there are no external search suggestions - has_no_external_suggestions = nav.search_and_check_no_external_suggestions( + has_no_external_suggestions = nav.verify_no_external_suggestions( text="random", search_mode="awesome", max_rows=3, # allow small internal items like history/bookmarks From cb4237d59c4411fa85f3a1c1e8dd260b1f55afe0 Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Mon, 3 Nov 2025 15:00:06 +0200 Subject: [PATCH 09/10] vs/search-suggestions-private-windows --- .../test_dont_show_search_suggestions_in_private_window.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py index d28385f02..e47b91796 100644 --- a/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py +++ b/tests/address_bar_and_search/test_dont_show_search_suggestions_in_private_window.py @@ -34,9 +34,11 @@ def test_no_search_engine_suggestions_in_private_window(driver: Firefox): # Open a new tab for each shortcut nav.open_and_switch_to_new_window("tab") + # Activate search mode for the current engine nav.clear_awesome_bar() + nav.search(shortcut) - # Type a query and verify there are no external search suggestions + # Type a query and verify that no external search suggestions appear has_no_external_suggestions = nav.verify_no_external_suggestions( text="random", search_mode="awesome", From 10426cef897b4e7d61d9a0cd624bd341954e7baf Mon Sep 17 00:00:00 2001 From: "virgil.sangerean" Date: Tue, 4 Nov 2025 12:16:08 +0200 Subject: [PATCH 10/10] vs/search-suggestions-private-windows --- modules/browser_object_navigation.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index ac58a41e5..d1f1bb7ad 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -326,38 +326,21 @@ def verify_no_external_suggestions( text: str | None = None, search_mode: str = "awesome", max_rows: int = 3, - type_delay: float = 0.5, + type_delay: float = 0.3, ) -> bool: - """ - Returns True if no external (search engine) suggestions are shown. - Allows up to `max_rows` internal rows (history/bookmarks) in the awesome bar. - - If `text` is provided, it types it into the chosen field first. - """ - if search_mode == "awesome": if text is not None: self.clear_awesome_bar() self.type_in_awesome_bar(text) - import time; - time.sleep(type_delay) - - # Try to detect suggestions container - try: - self.wait_for_suggestions_present(1) - suggestions = self.get_all_children("results-dropdown") - except Exception: - return True # no suggestions at all + time.sleep(type_delay) # allow dropdown to update - # Internal-only suggestions are fine up to `max_rows` + suggestions = self.get_all_children("results-dropdown") return len(suggestions) <= max_rows elif search_mode == "search": - # Legacy search bar path: if *any* suggestions show, treat as external if text is not None: self.set_search_bar() self.type_in_search_bar(text) - # Reuse your existing probe: True => suggestions exist (external), so invert return not self.search_bar_has_suggestions(min_suggestions=1) else: