Skip to content
Merged
21 changes: 21 additions & 0 deletions modules/browser_object_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,3 +886,24 @@ def verify_engine_returned(self, engine: str) -> None:
self.wait.until(
EC.visibility_of_element_located((By.CSS_SELECTOR, engine_locator))
)

@BasePage.context_chrome
def verify_https_hidden_in_address_bar(self) -> None:
"""
Wait until the HTTPS prefix is hidden in the address bar display.
"""
self.wait.until(
lambda d: "https" not in self.get_element("awesome-bar").get_attribute("value")
)

@BasePage.context_chrome
def verify_address_bar_value_prefix(self, prefix: str) -> None:
"""
Wait until the value in the address bar starts with the given prefix.

Args:
prefix (str): Expected starting string (e.g., "https://").
"""
self.wait.until(
lambda d: self.get_element("awesome-bar").get_attribute("value").startswith(prefix)
)
5 changes: 3 additions & 2 deletions modules/page_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ def perform_key_combo(self, *keys) -> Page:
Use ActionChains to perform key combos. Modifier keys should come first in the function call.
Usage example: perform_key_combo(Keys.CONTROL, Keys.ALT, "c") presses CTRL+ALT+c.
"""
while Keys.CONTROL in keys and self.sys_platform == "Darwin":
keys[keys.index(Keys.CONTROL)] = Keys.COMMAND
if self.sys_platform() == "Darwin":
keys = tuple(Keys.COMMAND if k == Keys.CONTROL else k for k in keys)

for k in keys[:-1]:
self.actions.key_down(k)

Expand Down
39 changes: 39 additions & 0 deletions tests/address_bar_and_search/test_copied_url_contains_https.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import pytest
from selenium.webdriver import Firefox, Keys

from modules.browser_object import Navigation

TEST_WEBSITE = "https://www.firefox.com/"
TEXT = "https"


@pytest.fixture()
def test_case():
return "3028712"


def test_copied_url_contains_https(driver: Firefox):
"""
C3028712 - URLs copied from address bar contain https tags
"""

# Instantiate object
nav = Navigation(driver)

# Input a URL in the address bar and hit enter
nav.search(TEST_WEBSITE)

# Check that HTTPS is NOT displayed in the address bar for the website
nav.verify_https_hidden_in_address_bar()

# Click on the URL bar once and hit CTRL/CMD+c to copy the link
nav.click_in_awesome_bar()
nav.perform_key_combo_chrome(Keys.CONTROL, "c")

# Open a new tab and paste (CTRL/CMD+v) the link
nav.open_and_switch_to_new_window("tab")
nav.click_in_awesome_bar()
nav.perform_key_combo_chrome(Keys.CONTROL, "v")

# Check that full link, including https://, is pasted in the address bar
nav.verify_address_bar_value_prefix("https://")