From ad7e52308512991f86c24f252cf60d77e182b69b Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Fri, 21 Nov 2025 16:08:06 +0200 Subject: [PATCH 1/6] Test searchmode update on alias prefix --- .../test_searchmode_update_on_alias_prefix.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py diff --git a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py new file mode 100644 index 000000000..848e8d824 --- /dev/null +++ b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py @@ -0,0 +1,18 @@ +import pytest +from selenium.webdriver import Firefox + +from modules.browser_object_navigation import Navigation + + +@pytest.fixture() +def test_case(): + return "3028841" + + +def test_searchmode_update_on_alias_prefix(driver: Firefox): + """ + C3028841 - Search mode is updated after typing a keyword/alias at the beginning of a non-empty search string + """ + + # Instantiate objects + nav = Navigation(driver) From e00bab7efdd56c7a46d73c617fe72ffbf87575fb Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Mon, 24 Nov 2025 16:51:58 +0200 Subject: [PATCH 2/6] Test searchmode update on alias prefix --- modules/browser_object_navigation.py | 21 +++++++++++++--- .../test_searchmode_update_on_alias_prefix.py | 25 ++++++++++++++++++- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index 4e41b971b..91d571507 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -84,10 +84,20 @@ def clear_awesome_bar(self) -> BasePage: return self @BasePage.context_chrome - def type_in_awesome_bar(self, term: str) -> BasePage: - """Enter text into the Awesome Bar. You probably want self.search()""" - self.set_awesome_bar() - self.awesome_bar.click() + def type_in_awesome_bar(self, term: str, reset=True) -> BasePage: + """ + Type text into the Awesome Bar. + + reset=True (default): refocuses and clicks the Awesome Bar before typing, + which moves the cursor to the end. + + reset=False: keeps the current cursor position (useful when tests manually + move the caret with arrow keys). + """ + if reset: + self.set_awesome_bar() + self.awesome_bar.click() + self.awesome_bar.send_keys(term) return self @@ -1056,3 +1066,6 @@ def click_exit_button_searchmode(self) -> None: # Click the button self.get_element("exit-button-searchmode").click() + + def type_without_resetting_cursor(self, text: str): + self.awesome_bar.send_keys(text) diff --git a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py index 848e8d824..2da6f0f19 100644 --- a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py +++ b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py @@ -1,9 +1,14 @@ import pytest -from selenium.webdriver import Firefox +from selenium.webdriver import Firefox, Keys from modules.browser_object_navigation import Navigation +ENGINE_KEYWORD = "@bing" +TEXT = "QA" +ENGINE = "Bing" + + @pytest.fixture() def test_case(): return "3028841" @@ -16,3 +21,21 @@ def test_searchmode_update_on_alias_prefix(driver: Firefox): # Instantiate objects nav = Navigation(driver) + + # TODO: Go to about:preferences#search and set a keyword for bing, for example: bang + + # Open a new tab, focus the urlbar and enter any string + nav.type_in_awesome_bar(TEXT) + + # Start pressing LEFT KEY on the keyboard so the text insertion cursor is at the beginning + for _ in range(2): + nav.perform_key_combo_chrome(Keys.LEFT) + + # Type @bing and press SPACE + nav.type_in_awesome_bar(ENGINE_KEYWORD, reset=False) + nav.perform_key_combo_chrome(Keys.SPACE) + + # Search shortcut should be identified and translated to search mode for bing with the original text + # remaining as search query + nav.verify_engine_returned(ENGINE) + nav.verify_plain_text_in_input_awesome_bar(TEXT) From 5812e8db3348218fb2f31ebefb5f36b6b45b5818 Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Mon, 24 Nov 2025 17:03:37 +0200 Subject: [PATCH 3/6] remove unused method --- modules/browser_object_navigation.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index 91d571507..5ef8bb121 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -1066,6 +1066,3 @@ def click_exit_button_searchmode(self) -> None: # Click the button self.get_element("exit-button-searchmode").click() - - def type_without_resetting_cursor(self, text: str): - self.awesome_bar.send_keys(text) From 8cc3596c6cd2a17496dae62eb1e05666341ae90c Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Mon, 24 Nov 2025 17:53:01 +0200 Subject: [PATCH 4/6] Fix ruff import sorting --- .../test_searchmode_update_on_alias_prefix.py | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py index 2da6f0f19..7885a23ff 100644 --- a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py +++ b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py @@ -3,7 +3,6 @@ from modules.browser_object_navigation import Navigation - ENGINE_KEYWORD = "@bing" TEXT = "QA" ENGINE = "Bing" From c93f42b7fd31e15c5d4a2eba72dea62ed37c98eb Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Tue, 2 Dec 2025 12:43:51 +0200 Subject: [PATCH 5/6] add manifests --- manifests/all.yaml | 1 + manifests/functional.yaml | 1 + manifests/key.yaml | 1 + 3 files changed, 3 insertions(+) diff --git a/manifests/all.yaml b/manifests/all.yaml index 0b2d6b706..6179e95b1 100644 --- a/manifests/all.yaml +++ b/manifests/all.yaml @@ -43,6 +43,7 @@ address_bar_and_search: - test_switch_to_existing_tab_when_having_the_same_URL - test_search_suggestions - test_delete_history_entry_via_firefox_suggest_completion_list +- test_searchmode_update_on_alias_prefix audio_video: - test_block_audio_video_functionality - test_allow_audio_video_functionality diff --git a/manifests/functional.yaml b/manifests/functional.yaml index 7c1632977..d1fa704fb 100644 --- a/manifests/functional.yaml +++ b/manifests/functional.yaml @@ -8,6 +8,7 @@ address_bar_and_search: - test_searchmode_cleared_on_engine_removal - test_switch_to_existing_tab_when_having_the_same_URL - test_delete_history_entry_via_firefox_suggest_completion_list +- test_searchmode_update_on_alias_prefix tabs: - test_change_position_of_pinned_tabs diff --git a/manifests/key.yaml b/manifests/key.yaml index 8248a3dcd..5d32f43c9 100644 --- a/manifests/key.yaml +++ b/manifests/key.yaml @@ -42,6 +42,7 @@ address_bar_and_search: test_searchbar_results_shown_in_a_new_tab: pass test_searchmode_change_tab: pass test_searchmode_cleared_on_engine_removal: pass + test_searchmode_update_on_alias_prefix : pass test_server_not_found_error: pass test_server_not_found_error_pb: pass test_suggestion_engine_selection: pass From 2f03ffe1a0b16fe4d74427fd73b5c1a901b79b2d Mon Sep 17 00:00:00 2001 From: Hani Yacoub Date: Tue, 2 Dec 2025 14:17:31 +0200 Subject: [PATCH 6/6] edit comment --- .../test_searchmode_update_on_alias_prefix.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py index 7885a23ff..a0196c3bc 100644 --- a/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py +++ b/tests/address_bar_and_search/test_searchmode_update_on_alias_prefix.py @@ -18,7 +18,7 @@ def test_searchmode_update_on_alias_prefix(driver: Firefox): C3028841 - Search mode is updated after typing a keyword/alias at the beginning of a non-empty search string """ - # Instantiate objects + # Instantiate object nav = Navigation(driver) # TODO: Go to about:preferences#search and set a keyword for bing, for example: bang