|
| 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