Skip to content

Commit b48762f

Browse files
committed
VS/test change default search provider
1 parent 6436bac commit b48762f

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

tests/address_bar_and_search/test_default_search_provider_change.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
from time import sleep
2+
13
import pytest
4+
from selenium.webdriver import Firefox
25
from selenium.webdriver.common.by import By
36
from selenium.webdriver.common.keys import Keys
4-
from selenium.webdriver import Firefox
57
from selenium.webdriver.support import expected_conditions as EC
68
from selenium.webdriver.support.wait import WebDriverWait
7-
from modules.page_object import AboutPrefs, AboutConfig
89

910
from modules.browser_object import Navigation
1011
from modules.browser_object_context_menu import ContextMenu
11-
from time import sleep
12+
from modules.page_object import AboutConfig, AboutPrefs
1213

1314

1415
@pytest.fixture()
@@ -17,6 +18,7 @@ def add_prefs():
1718
("browser.search.region", "US"),
1819
]
1920

21+
2022
def test_default_search_provider_change(driver: Firefox):
2123
"""
2224
C1365245 - This test makes sure that the default search
@@ -29,7 +31,6 @@ def test_default_search_provider_change(driver: Firefox):
2931
search_term = "what is life?"
3032

3133
# enable search bar via about:config
32-
#about_config.change_pref_value("cookiebanners.service.mode", 1)
3334
pref = "browser.search.widget.inNavBar"
3435
about_config.toggle_true_false_config(pref)
3536
nav.clear_awesome_bar()
@@ -45,7 +46,6 @@ def test_default_search_provider_change(driver: Firefox):
4546
driver.switch_to.window(driver.window_handles[1])
4647
sleep(1)
4748

48-
4949
# check that the current URL is about:preferences#search
5050
assert driver.current_url == "about:preferences#search"
5151

@@ -64,7 +64,9 @@ def test_default_search_provider_change(driver: Firefox):
6464

6565
# Open the search bar and type in a keyword and check if it's with the right provider
6666
nav.type_in_search_bar(search_term)
67-
search_engine_name_element = driver.find_element(By.CSS_SELECTOR, '.searchbar-engine-name')
67+
with driver.context(driver.CONTEXT_CHROME):
68+
search_engine_name_element = driver.find_element(
69+
By.CSS_SELECTOR, ".searchbar-engine-name"
70+
)
6871

69-
assert search_engine_name_element.text == "DuckDuckGo"
70-
sleep(4)
72+
assert search_engine_name_element.get_attribute("value") == "DuckDuckGo Search"

0 commit comments

Comments
 (0)