diff --git a/modules/browser_object_navigation.py b/modules/browser_object_navigation.py index e2059db28..adade9d9f 100644 --- a/modules/browser_object_navigation.py +++ b/modules/browser_object_navigation.py @@ -90,15 +90,6 @@ def type_in_awesome_bar(self, term: str) -> BasePage: self.awesome_bar.send_keys(term) return self - @BasePage.context_chrome - def press_ctrl_enter(self) -> BasePage: - """Press Ctrl/Cmd + Enter in Awesome Bar.""" - if self.sys_platform() == "Darwin": - self.perform_key_combo(Keys.COMMAND, Keys.ENTER) - else: - self.perform_key_combo(Keys.CONTROL, Keys.ENTER) - return self - def set_search_mode_via_awesome_bar(self, mode: str) -> BasePage: """ Given a `mode`, set the Awesome Bar search mode. Returns self. diff --git a/tests/address_bar_and_search/test_ctrl_enter_completes_link_and_can_refresh.py b/tests/address_bar_and_search/test_ctrl_enter_completes_link_and_can_refresh.py new file mode 100644 index 000000000..dccd1a321 --- /dev/null +++ b/tests/address_bar_and_search/test_ctrl_enter_completes_link_and_can_refresh.py @@ -0,0 +1,50 @@ +import pytest +from selenium.webdriver import Firefox +from selenium.webdriver.common.keys import Keys + +from modules.browser_object import Navigation + + +@pytest.fixture() +def test_case(): + return "3028887" + + +TAB_1_INPUT = "example" +TAB_1_EXPECTED_DOMAIN = "example.com" + +TAB_2_INPUT = "facebook" +TAB_2_EXPECTED_DOMAIN = "facebook.com" + + +def test_ctrl_enter_refreshes_tab(driver: Firefox): + """ + C3028887 - Verify that Ctrl/Cmd + R refreshes the webpage in the first tab + after navigating with Ctrl/Cmd + Enter. + """ + # Instantiate objects + nav = Navigation(driver) + + # Open first tab and navigate using Ctrl+Enter + nav.type_in_awesome_bar(TAB_1_INPUT) + nav.perform_key_combo_chrome(Keys.CONTROL, Keys.ENTER) + nav.url_contains(TAB_1_EXPECTED_DOMAIN) + + first_tab_url = driver.current_url + + # Open second tab and navigate using Ctrl+Enter + nav.open_and_switch_to_new_window("tab") + nav.type_in_awesome_bar(TAB_2_INPUT) + nav.perform_key_combo_chrome(Keys.CONTROL, Keys.ENTER) + nav.url_contains(TAB_2_EXPECTED_DOMAIN) + + # Switch back to first tab + driver.switch_to.window(driver.window_handles[0]) + + # Refresh using Ctrl/Cmd + R + nav.refresh_page() + + # Verify successful reload (same URL) + nav.url_contains(TAB_1_EXPECTED_DOMAIN) + + assert driver.current_url == first_tab_url diff --git a/tests/address_bar_and_search/test_ctrl_enter_fixes_url.py b/tests/address_bar_and_search/test_ctrl_enter_fixes_url.py index 64f953674..d5dde42a1 100644 --- a/tests/address_bar_and_search/test_ctrl_enter_fixes_url.py +++ b/tests/address_bar_and_search/test_ctrl_enter_fixes_url.py @@ -1,5 +1,6 @@ import pytest from selenium.webdriver import Firefox +from selenium.webdriver.common.keys import Keys from modules.browser_object import Navigation from modules.browser_object_tabbar import TabBar @@ -24,15 +25,13 @@ def test_ctrl_enter_fixes_url(driver: Firefox, domain, expected_url: str): # Instantiate objects nav = Navigation(driver) - tabs = TabBar(driver) # Open a new tab - tabs.new_tab_by_button() - tabs.switch_to_new_tab() + nav.open_and_switch_to_new_window("tab") # Type a domain in the address bar and press Ctrl/Cmd + Enter nav.type_in_awesome_bar(domain) - nav.press_ctrl_enter() + nav.perform_key_combo_chrome(Keys.CONTROL, Keys.ENTER) # Verify navigation to the expected URL nav.url_contains(expected_url)