Skip to content

Commit d5d271d

Browse files
sv-hyacoubHani Yacoub
andauthored
Hani/test added open search engine default (#849)
* add open search engine default * Test for Added Open Search Engine can be made default search engine * edit test --------- Co-authored-by: Hani Yacoub <[email protected]>
1 parent 26ec232 commit d5d271d

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

modules/browser_object_navigation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ class Navigation(BasePage):
3333
"Bing",
3434
"DuckDuckGo",
3535
"Wikipedia (en)",
36+
"Firefox Add-ons"
3637
}
3738

3839
def __init__(self, driver: Firefox, **kwargs):
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import pytest
2+
from selenium.webdriver import Firefox, Keys
3+
4+
from modules.browser_object_navigation import Navigation
5+
from modules.browser_object_tabbar import TabBar
6+
from modules.page_object_prefs import AboutPrefs
7+
8+
TEST_URL = "https://addons.mozilla.org/en-US/firefox"
9+
SEARCH_ENGINE = "Firefox Add-ons"
10+
TEXT = "test"
11+
TEST_TEXT = "Firefox"
12+
EXPECTED_URL = "https://addons.mozilla.org/en-US/firefox/search/?q=Firefox"
13+
14+
15+
@pytest.fixture()
16+
def test_case():
17+
return "3028769"
18+
19+
20+
@pytest.mark.parametrize("engine", ["Firefox Add-ons"])
21+
def test_added_open_search_engine_default(driver: Firefox, engine):
22+
"""
23+
C3028769 - Added Open Search Engine can be made default search engine
24+
"""
25+
26+
# Instantiate objects
27+
nav = Navigation(driver)
28+
prefs = AboutPrefs(driver, category="search")
29+
tabs = TabBar(driver)
30+
31+
# Open website that has autodiscovery
32+
driver.get(TEST_URL)
33+
34+
# Click in the address bar and delete/add a letter in the URL to enter the edit mode
35+
nav.type_in_awesome_bar(TEXT)
36+
37+
# Open the Unified Search button and click on the option to add the search engine : "Add + name_of_search_engine"
38+
nav.click_search_mode_switcher()
39+
nav.set_search_mode(engine)
40+
41+
# Open in a new tab about:preferences#search
42+
prefs.open()
43+
44+
# Set the newly added engine as a default engine.
45+
prefs.search_engine_dropdown().select_option(SEARCH_ENGINE)
46+
47+
# Open a new tab and in the address bar type a search string and press enter
48+
tabs.new_tab_by_button()
49+
tabs.switch_to_new_tab()
50+
nav.type_in_awesome_bar(TEST_TEXT + Keys.ENTER)
51+
52+
# Check that search is performed with the newly added default engine and search results are displayed
53+
assert nav.url_contains(EXPECTED_URL)

0 commit comments

Comments
 (0)