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
14 changes: 14 additions & 0 deletions SELECTOR_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1216,6 +1216,13 @@ Location: about:preferences#general Applications subsection
Path to .json: modules/data/about_prefs.components.json
```
```
Selector Name: clipboard-suggestion-checkbox
Selector Data: #clipboardSuggestion"
Description: The checkbox for Clipboard
Location: about:preferences#search
Path to .json: modules/data/about_prefs.components.json
```
```
Selector Name: search-shortcuts-group
Selector Data: oneClickSearchProvidersGroup
Description: The Search shortcuts table
Expand Down Expand Up @@ -3315,6 +3322,13 @@ Description: Switch to tab from awesome bar
Location: Address bar
Path to .json: modules/data/navigation.components.json
```
```
Selector Name: switch-to-cliboard
Selector Data: #urlbar-results > div.urlbarView-row[type='clipboard']"
Description: Switch to clipboard
Location: Address bar
Path to .json: modules/data/navigation.components.json
```
#### panel_ui
```
Selector name: panel-ui-button
Expand Down
4 changes: 4 additions & 0 deletions manifests/key.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ address_bar_and_search:
result: pass
splits:
- functional1
test_clipboard_pref_flip:
result: pass
splits:
- functional1
test_ctrl_enter_completes_link_and_can_refresh:
result: pass
splits:
Expand Down
21 changes: 16 additions & 5 deletions modules/browser_object_navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,17 @@ def click_switch_to_tab(self) -> None:
# Click the first matching row
switch_items[0].click()

@BasePage.context_chrome
def click_on_clipboard_suggestion(self) -> None:
"""
Click the 'Visit from clipboard' suggestion in the URL bar.
Requires:
- browser.urlbar.clipboard.featureGate = true
- Clipboard suggestion already visible
"""
row = self.wait.until(lambda d: self.get_element("clipboard-suggestion"))
row.click()

@BasePage.context_chrome
def search(self, term: str, mode=None) -> BasePage:
"""
Expand Down Expand Up @@ -1088,11 +1099,11 @@ def click_exit_button_searchmode(self) -> None:

@BasePage.context_chrome
def type_and_verify(
self,
input_text: str,
expected_text: str,
timeout: float = 5.0,
click: bool = True, # If True: click match; else: return index
self,
input_text: str,
expected_text: str,
timeout: float = 5.0,
click: bool = True, # If True: click match; else: return index
) -> int | bool:
"""
Types into the awesome bar, waits for a suggestion containing `expected_text`.
Expand Down
5 changes: 5 additions & 0 deletions modules/data/about_prefs.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@
"strategy": "css",
"groups": []
},
"clipboard-suggestion-checkbox": {
"selectorData": "#clipboardSuggestion",
"strategy": "css",
"groups": ["doNotCache"]
},

"unknown-content-type-dialog": {
"selectorData": "unknownContentTypeWindow",
Expand Down
7 changes: 6 additions & 1 deletion modules/data/navigation.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@
"selectorData": "div.urlbarView-row[type='switchtab']",
"strategy": "css",
"groups": ["doNotCache"]
}
},

"clipboard-suggestion": {
"selectorData": "#urlbar-results > div.urlbarView-row[type='clipboard']",
"strategy": "css",
"groups": ["doNotCache"]
}
}
6 changes: 6 additions & 0 deletions modules/page_object_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@ def restore_default_search_engines(self) -> BasePage:
self.click_on("restore-default-search-engines-button")
return self

@BasePage.context_content
def verify_clipboard_suggestion_enabled(self) -> None:
checkbox = self.get_element("clipboard-suggestion-checkbox")
is_checked = checkbox.get_attribute("checked") in ("true", "checked", "")
assert is_checked, "Expected clipboardSuggestion checkbox to be checked"

def set_alternative_language(self, lang_code: str) -> BasePage:
"""Changes the browser language"""
self.get_element("language-set-alternative-button").click()
Expand Down
61 changes: 61 additions & 0 deletions tests/address_bar_and_search/test_clipboard_pref_flip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import pytest
from selenium.webdriver import Firefox

from modules.browser_object_context_menu import ContextMenu
from modules.browser_object_navigation import Navigation
from modules.page_object_newtab import AboutNewtab
from modules.page_object_prefs import AboutPrefs


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


@pytest.fixture()
def add_to_prefs_list():
# Required to expose "Visit from clipboard" suggestions
return [("browser.urlbar.clipboard.featureGate", True)]


TOPSITE_TITLE = "Wikipedia"


def test_clipboard_pref_flip(driver: Firefox):
"""
3029320 – Verify clipboard suggestion appears in the URL bar
after copying a TopSite link.
"""

nav = Navigation(driver)
context_menu = ContextMenu(driver)
newtab = AboutNewtab(driver)
prefs = AboutPrefs(driver)

# Step 1: Open about:newtab
driver.get("about:newtab")

# Step 2: Copy a TopSite link via context menu
topsite_el = newtab.get_topsite_element(TOPSITE_TITLE)

newtab.hover(topsite_el)
nav.verify_status_panel_url(TOPSITE_TITLE.lower())
copied_url = nav.get_status_panel_url()

newtab.open_topsite_context_menu_by_title(TOPSITE_TITLE)
context_menu.click_context_item("context-menu-copy-link")

# Step 3: Activate the Awesome Bar
nav.clear_awesome_bar()
nav.click_on("awesome-bar")

# Step 4: Wait for clipboard suggestion (CHROME context)
nav.click_on_clipboard_suggestion()

# Step 5: Validate navigation & URL bar text
nav.url_contains(copied_url)
assert copied_url in nav.get_awesome_bar_text()

# Step 6: Go to about:preferences#search and check the pref is enabled
driver.get("about:preferences#search")
prefs.verify_clipboard_suggestion_enabled()