Skip to content

Commit 009d76e

Browse files
sv-hyacoubHani Yacoub
andauthored
Hani/ Test searchmode update on alias prefix (#908)
* Test searchmode update on alias prefix * Test searchmode update on alias prefix * remove unused method * Fix ruff import sorting * add manifests * edit comment --------- Co-authored-by: Hani Yacoub <[email protected]>
1 parent 9b3f4c5 commit 009d76e

File tree

5 files changed

+57
-4
lines changed

5 files changed

+57
-4
lines changed

manifests/all.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ address_bar_and_search:
4343
- test_switch_to_existing_tab_when_having_the_same_URL
4444
- test_search_suggestions
4545
- test_delete_history_entry_via_firefox_suggest_completion_list
46+
- test_searchmode_update_on_alias_prefix
4647
audio_video:
4748
- test_block_audio_video_functionality
4849
- test_allow_audio_video_functionality

manifests/functional.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ address_bar_and_search:
88
- test_searchmode_cleared_on_engine_removal
99
- test_switch_to_existing_tab_when_having_the_same_URL
1010
- test_delete_history_entry_via_firefox_suggest_completion_list
11+
- test_searchmode_update_on_alias_prefix
1112

1213
tabs:
1314
- test_change_position_of_pinned_tabs

manifests/key.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ address_bar_and_search:
4242
test_searchbar_results_shown_in_a_new_tab: pass
4343
test_searchmode_change_tab: pass
4444
test_searchmode_cleared_on_engine_removal: pass
45+
test_searchmode_update_on_alias_prefix : pass
4546
test_server_not_found_error: pass
4647
test_server_not_found_error_pb: pass
4748
test_suggestion_engine_selection: pass

modules/browser_object_navigation.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,20 @@ def clear_awesome_bar(self) -> BasePage:
8484
return self
8585

8686
@BasePage.context_chrome
87-
def type_in_awesome_bar(self, term: str) -> BasePage:
88-
"""Enter text into the Awesome Bar. You probably want self.search()"""
89-
self.set_awesome_bar()
90-
self.awesome_bar.click()
87+
def type_in_awesome_bar(self, term: str, reset=True) -> BasePage:
88+
"""
89+
Type text into the Awesome Bar.
90+
91+
reset=True (default): refocuses and clicks the Awesome Bar before typing,
92+
which moves the cursor to the end.
93+
94+
reset=False: keeps the current cursor position (useful when tests manually
95+
move the caret with arrow keys).
96+
"""
97+
if reset:
98+
self.set_awesome_bar()
99+
self.awesome_bar.click()
100+
91101
self.awesome_bar.send_keys(term)
92102
return self
93103

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import pytest
2+
from selenium.webdriver import Firefox, Keys
3+
4+
from modules.browser_object_navigation import Navigation
5+
6+
ENGINE_KEYWORD = "@bing"
7+
TEXT = "QA"
8+
ENGINE = "Bing"
9+
10+
11+
@pytest.fixture()
12+
def test_case():
13+
return "3028841"
14+
15+
16+
def test_searchmode_update_on_alias_prefix(driver: Firefox):
17+
"""
18+
C3028841 - Search mode is updated after typing a keyword/alias at the beginning of a non-empty search string
19+
"""
20+
21+
# Instantiate object
22+
nav = Navigation(driver)
23+
24+
# TODO: Go to about:preferences#search and set a keyword for bing, for example: bang
25+
26+
# Open a new tab, focus the urlbar and enter any string
27+
nav.type_in_awesome_bar(TEXT)
28+
29+
# Start pressing LEFT KEY on the keyboard so the text insertion cursor is at the beginning
30+
for _ in range(2):
31+
nav.perform_key_combo_chrome(Keys.LEFT)
32+
33+
# Type @bing and press SPACE
34+
nav.type_in_awesome_bar(ENGINE_KEYWORD, reset=False)
35+
nav.perform_key_combo_chrome(Keys.SPACE)
36+
37+
# Search shortcut should be identified and translated to search mode for bing with the original text
38+
# remaining as search query
39+
nav.verify_engine_returned(ENGINE)
40+
nav.verify_plain_text_in_input_awesome_bar(TEXT)

0 commit comments

Comments
 (0)