Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions modules/browser_object_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
@@ -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
7 changes: 3 additions & 4 deletions tests/address_bar_and_search/test_ctrl_enter_fixes_url.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)