Skip to content

Commit 26c03a1

Browse files
authored
Merge branch 'mozilla:main' into test-play-mute-unmute-tabs-via-toggle
2 parents e387a35 + ae4b6e5 commit 26c03a1

File tree

79 files changed

+1815
-684
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+1815
-684
lines changed

.github/workflows/smoke.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
108108
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
109109
pipenv run python choose_ci_set.py
110-
pipenv run pytest $(cat selected_tests)
110+
pipenv run pytest --geckodriver geckodriver.exe $(cat selected_tests)
111111
$env:TEST_EXIT_CODE = $LASTEXITCODE
112112
mv artifacts artifacts-win || true
113113
exit $env:TEST_EXIT_CODE
@@ -120,7 +120,7 @@ jobs:
120120
mv ./ci_pyproject_headed.toml ./pyproject.toml;
121121
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
122122
pipenv run python choose_ci_set.py
123-
pipenv run pytest $(cat selected_tests)
123+
pipenv run pytest --geckodriver geckodriver.exe $(cat selected_tests)
124124
$env:TEST_EXIT_CODE = $LASTEXITCODE
125125
rm artifacts/assets -r -Force
126126
Get-ChildItem -Path "artifacts" | ForEach-Object {

SELECTOR_INFO.md

Lines changed: 107 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,14 @@ Description: The Firefox logo
443443
Location: The about:newtab page
444444
Path to .json: modules/data/about_newtab.components.json
445445
```
446+
```
447+
Selector Name: top-site-by-title
448+
Selector Data: "//li[@class='top-site-outer']//span[@class='title-label' and text()='{title}']/.."
449+
Description: Topsite tile by title
450+
Location: The about:newtab page (middle section)
451+
Path to .json: modules/data/about_newtab.components.json
452+
```
453+
446454
#### about_prefs
447455
```
448456
Selector Name: search-engine-dropdown-root
@@ -495,22 +503,50 @@ Path to .json: modules/data/about_prefs.components.json
495503
```
496504
```
497505
Selector Name: save-and-fill-addresses
498-
Selector Data: "checkbox[label='Save and fill addresses']"
506+
Selector Data: "[data-l10n-id='autofill-addresses-checkbox-message']"
499507
Description: Label for Autofill > Save and fill addresses option
500508
Location: about:preferences#privacy
501509
Path to .json: modules/data/about_prefs.components.json
502510
```
503511
```
504512
Selector Name: save-and-fill-payment-methods
505-
Selector Data: "checkbox[label='Save and fill payment methods']"
513+
Selector Data: "[data-l10n-id='autofill-payment-methods-checkbox-message-2']"
506514
Description: Label for Autofill > Save and fill payment methods option
507515
Location: about:preferences#privacy
508516
Path to .json: modules/data/about_prefs.components.json
509517
```
510518
```
511519
Selector Name: prefs-button
520+
Selector Data: "moz-box-button[label^='{name}']"
521+
Description: Checkbox for a option by label of moz box button
522+
Location: about:preferences#privacy
523+
Path to .json: modules/data/about_prefs.components.json
524+
```
525+
```
526+
Selector Name: action-button
512527
Selector Data: "button[label^='{name}']"
513-
Description: Checkbox for a option by label
528+
Description: Checkbox for a option by label of normal button
529+
Location: about:preferences#privacy
530+
Path to .json: modules/data/about_prefs.components.json
531+
```
532+
```
533+
Selector Name: close-dialog
534+
Selector Data: "button[data-l10n-id='close-button']"
535+
Description: Close dialog button
536+
Location: about:preferences#privacy
537+
Path to .json: modules/data/about_prefs.components.json
538+
```
539+
```
540+
Selector Name: saved-payments-button
541+
Selector Data: "[data-l10n-id='autofill-payment-methods-manage-payments-button']"
542+
Description: Embedded button/label for "Manage Saved Payments"
543+
Location: about:preferences#privacy
544+
Path to .json: modules/data/about_prefs.components.json
545+
```
546+
```
547+
Selector Name: saved-addresses-button
548+
Selector Data: "[data-l10n-id='autofill-addresses-manage-addresses-button']"
549+
Description: Embedded button/label for "Manage Addresses and more..."
514550
Location: about:preferences#privacy
515551
Path to .json: modules/data/about_prefs.components.json
516552
```
@@ -845,7 +881,7 @@ Path to .json: modules/data/about_prefs.components.json
845881
```
846882
```
847883
Selector Name: cookies-privacy-label
848-
Selector Data: "description[data-l10n-id='sitedata-delete-on-close-private-browsing2']"
884+
Selector Data: "[data-l10n-id='sitedata-delete-on-close-private-browsing3']"
849885
Description: Message in Cookies and Site data when History is not remembered
850886
Location: about:preferences#privacy
851887
Path to .json: modules/data/about_prefs.components.json
@@ -907,6 +943,13 @@ Location: about:preferences#general Language subsection
907943
Path to .json: modules/data/about_prefs.components.json
908944
```
909945
```
946+
Selector Name: search-suggestion-in-private-windows
947+
Selector Data: "showSearchSuggestionsPrivateWindows"
948+
Description: Show search suggestions in Private Windows
949+
Location: about:preferences#search
950+
Path to .json: modules/data/about_prefs.components.json
951+
```
952+
```
910953
Selector Name: language-settings-search
911954
Selector Data: "menuitem[value='search']"
912955
Description: In the Language Set Alternatives dialog, the Select a language to add, Search for more languages… option
@@ -1151,6 +1194,13 @@ Description: The dropdown menu for default zoom selection
11511194
Location: about:preferences - Zoom settings
11521195
Path to .json: modules/data/about_prefs.components.json
11531196
```
1197+
```
1198+
Selector Name: unknown-content-type-dialog
1199+
Selector Data: unknownContentTypeWindo
1200+
Description: The unknown content type dialog
1201+
Location: about:preferences#general Applications subsection
1202+
Path to .json: modules/data/about_prefs.components.json
1203+
```
11541204
#### about_profiles
11551205
```
11561206
Selector Name: profile-container
@@ -1788,6 +1838,27 @@ Description: Open all bookmarks from the context menu option from a Toolbar book
17881838
Location: Context menu - Toolbar
17891839
Path to .json: modules/data/context_menu.components.json
17901840
```
1841+
```
1842+
Selector Name: context-menu-move-tab-to-start
1843+
Selector Data: menuitem[data-l10n-id='move-to-start']
1844+
Description: Context menu option to move a tab to the start of the tab bar.
1845+
Location: Context menu - Tab
1846+
Path to .json: modules/data/context_menu.components.json
1847+
```
1848+
```
1849+
Selector Name: context-menu-bookmark-link
1850+
Selector Data: context-bookmarklink
1851+
Description: Context menu option to bookmark a link
1852+
Location: Context menu - topsite context menu
1853+
Path to .json: modules/data/context_menu.components.json
1854+
```
1855+
```
1856+
Selector Name: context-menu-search-select
1857+
Selector Data: coontext-searchselect
1858+
Description: Context menu option to search selected text with the engine set as default
1859+
Location: Context menu - topsite context menu
1860+
Path to .json: modules/data/context_menu.components.json
1861+
```
17911862
#### credit_card_fill
17921863
```
17931864
Selector Name: form-field
@@ -1819,9 +1890,9 @@ Location: Any non-linked content space inside example.com page
18191890
Path to .json: modules/data/exemple_page.components.json
18201891
```
18211892
```
1822-
Selector Name: more-information
1823-
Selector Data: "More information..."
1824-
Description: More information..." link
1893+
Selector Name: learn-more
1894+
Selector Data: "Learn more"
1895+
Description: "Learn more" link
18251896
Location: The hyperlink positioned in the middle of example.com page
18261897
Path to .json: modules/data/exemple_page.components.json
18271898
```
@@ -2797,6 +2868,27 @@ Location: Download panel
27972868
Path to .json: modules/data/navigation.components.json
27982869
```
27992870
```
2871+
Selector name: download-target-element
2872+
Selector Data: downloadTarget
2873+
Description: Downloaded item in the download panel
2874+
Location: Download panel
2875+
Path to .json: modules/data/navigation.components.json
2876+
```
2877+
```
2878+
Selector name: download-progress-element
2879+
Selector Data: downloadProgress
2880+
Description: Download progress bar
2881+
Location: Download panel
2882+
Path to .json: modules/data/navigation.components.json
2883+
```
2884+
```
2885+
Selector name: ddownload-details-element
2886+
Selector Data: downloadDetailsNormal
2887+
Description: Download details element
2888+
Location: Download panel
2889+
Path to .json: modules/data/navigation.components.json
2890+
```
2891+
```
28002892
Selector name: remove-bookmark-button
28012893
Selector Data: editBookmarkPanelRemoveButton
28022894
Description: Remove bookmark button
@@ -3069,6 +3161,13 @@ Description: Developer tool icon
30693161
Location: Navigation bar
30703162
Path to .json: modules/data/navigation.components.json
30713163
```
3164+
```
3165+
Selector Name: status-panel-label
3166+
Selector Data: statuspanel-label
3167+
Description: Status panel URL label
3168+
Location: newtab page bottom left corner on link hover
3169+
Path to .json: modules/data/navigation.components.json
3170+
```
30723171
#### panel_ui
30733172
```
30743173
Selector name: panel-ui-button
@@ -3446,7 +3545,7 @@ Description: Edit bookmark panel
34463545
Location: Bookmark panel
34473546
Path to .json: modules/data/pane_ui.components.json
34483547
```
3449-
```
3548+
34503549
#### print_preview
34513550
```
34523551
Selector name: print-preview-browser

conftest.py

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
from subprocess import check_output, run
99
from typing import Callable, List, Tuple, Union
1010

11+
# import psutil
1112
import pytest
1213
from PIL import Image, ImageGrab
1314
from selenium.common.exceptions import TimeoutException, WebDriverException
1415
from selenium.webdriver import Firefox
1516
from selenium.webdriver.common.by import By
1617
from selenium.webdriver.firefox.options import Options
18+
from selenium.webdriver.firefox.service import Service
1719
from selenium.webdriver.support import expected_conditions as EC
1820
from selenium.webdriver.support.ui import WebDriverWait
1921

@@ -132,6 +134,13 @@ def pytest_addoption(parser):
132134
help="Path to Fx executable. Will overwrite --fx-channel.",
133135
)
134136

137+
parser.addoption(
138+
"--geckodriver",
139+
action="store",
140+
default="",
141+
help="Path to geckodriver.",
142+
)
143+
135144
parser.addoption(
136145
"--run-headless",
137146
action="store_true",
@@ -216,12 +225,17 @@ def sys_platform():
216225
return platform.system()
217226

218227

228+
@pytest.fixture(scope="session")
229+
def geckodriver(request):
230+
return request.config.getoption("--geckodriver")
231+
232+
219233
@pytest.fixture()
220234
def downloads_folder(sys_platform):
221235
"""Return the downloads folder location for this OS"""
222236
if sys_platform == "Windows":
223237
user = os.environ.get("USERNAME")
224-
return f"C:\\Users\\{user}\\Downloads"
238+
return rf"C:\Users\{user}\Downloads"
225239
elif sys_platform == "Darwin": # MacOS
226240
user = os.environ.get("USER")
227241
return f"/Users/{user}/Downloads"
@@ -242,11 +256,11 @@ def fx_executable(request, sys_platform):
242256
location = ""
243257
if sys_platform == "Windows":
244258
if version == "Firefox":
245-
location = "C:\\Program Files\\Mozilla Firefox\\firefox.exe"
259+
location = r"C:\Program Files\Mozilla Firefox\firefox.exe"
246260
elif version == "Nightly":
247-
location = "C:\\Program Files\\Firefox Nightly\\firefox.exe"
261+
location = r"C:\Program Files\Firefox Nightly\firefox.exe"
248262
elif version == "Custom":
249-
location = "C:\\Program Files\\Custom Firefox\\firefox.exe"
263+
location = r"C:\Program Files\Custom Firefox\firefox.exe"
250264
elif sys_platform == "Darwin":
251265
if version == "Firefox":
252266
location = "/Applications/Firefox.app/Contents/MacOS/firefox"
@@ -392,6 +406,7 @@ def hard_quit():
392406
@pytest.fixture(autouse=True)
393407
def driver(
394408
fx_executable: str,
409+
geckodriver: str,
395410
opt_headless: bool,
396411
opt_implicit_timeout: int,
397412
prefs_list: List[Tuple],
@@ -457,7 +472,15 @@ def driver(
457472
options.profile = profile_path
458473
for opt, value in prefs_list:
459474
options.set_preference(opt, value)
460-
driver = Firefox(options=options)
475+
if geckodriver:
476+
service = Service(executable_path=geckodriver)
477+
driver = Firefox(service=service, options=options)
478+
else:
479+
driver = Firefox(options=options)
480+
# Uncomment below to find Fx process info
481+
# for proc in psutil.process_iter(["name", "exe", "cmdline"]):
482+
# if proc.info["name"] and "firefox" in proc.info["name"].lower():
483+
# print(proc.info)
461484
separator = "x"
462485
if separator not in opt_window_size:
463486
if "by" in opt_window_size:

l10n_CM/Unified/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
6464
("extensions.formautofill.addresses.supportedCountries", region),
6565
("browser.aboutConfig.showWarning", False),
6666
("browser.search.region", region),
67+
("extensions.formautofill.addresses.enabled", True),
68+
("extensions.formautofill.creditCards.enabled", True),
6769
]
6870
prefs.extend(add_to_prefs_list)
6971
return prefs

modules/browser_object_context_menu.py

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import logging
2-
from typing import Union
2+
from typing import Dict, List, Union
33

44
from selenium.webdriver.remote.webelement import WebElement
55

@@ -13,15 +13,51 @@ class ContextMenu(BasePage):
1313

1414
URL_TEMPLATE = ""
1515

16+
@BasePage.context_chrome
1617
def click_context_item(
1718
self, reference: Union[str, tuple, WebElement], labels=[]
1819
) -> BasePage:
1920
"""
2021
Clicks the context item.
2122
"""
22-
with self.driver.context(self.driver.CONTEXT_CHROME):
23-
self.fetch(reference, labels=labels).click()
24-
return self
23+
24+
self.fetch(reference, labels=labels).click()
25+
return self
26+
27+
@BasePage.context_chrome
28+
def verify_topsites_tile_context_menu_options(
29+
self,
30+
static_items: Dict[str, str],
31+
dynamic_items: List[str],
32+
tile_title: str,
33+
):
34+
"""
35+
Verifies expected context menu options are present upon right clicking a topsite tile.
36+
Arguments:
37+
static_items: Dict mapping of selector name to expected label text.
38+
dynamic_items: List of selector names for items with dynamic labels.
39+
tile_title: Optional, required if dynamic label validation is needed (e.g., Wikipedia, YouTube).
40+
"""
41+
# --- Static items ---
42+
for selector, expected_label in static_items.items():
43+
option = self.get_element(selector)
44+
label = (option.get_attribute("label") or option.text or "").strip()
45+
assert expected_label in label, (
46+
f'Expected label "{expected_label}" not found. Got: "{label}"'
47+
)
48+
49+
# --- Dynamic items ---
50+
for selector in dynamic_items:
51+
option = self.get_element(selector)
52+
label = (option.get_attribute("label") or option.text or "").strip()
53+
normalized = label.lower()
54+
assert normalized.startswith("search"), (
55+
f'Label does not start with "Search": "{label}"'
56+
)
57+
assert "for" in normalized, f'"for" not found in label: "{label}"'
58+
assert tile_title.lower() in normalized, (
59+
f'Search term "{tile_title}" not found in label: "{label}"'
60+
)
2561

2662

2763
class AboutDownloadsContextMenu(ContextMenu):

0 commit comments

Comments
 (0)