Skip to content

Commit e96fec5

Browse files
authored
Merge branch 'main' into as/dropdown-presence-addresses
2 parents f842108 + fe8c4ad commit e96fec5

17 files changed

+120
-30
lines changed

.github/workflows/smoke.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ env:
2323

2424
jobs:
2525
Smoke-Windows:
26+
if: ${{ inputs.job_to_run == 'Smoke-Windows' || github.event_name == 'pull_request' }}
2627
runs-on: windows-latest
2728
steps:
2829
- name: Create app token
@@ -116,6 +117,7 @@ jobs:
116117
name: artifacts-win
117118
path: artifacts-win
118119
Smoke-MacOS:
120+
if: ${{ inputs.job_to_run == 'Smoke-MacOS' || github.event_name == 'pull_request' }}
119121
runs-on: macos-latest
120122
steps:
121123
- name: Create app token
@@ -151,11 +153,11 @@ jobs:
151153
rm ./pyproject.toml;
152154
mv ./ci_pyproject.toml ./pyproject.toml;
153155
pipenv install;
154-
bash ./collect_executables.sh;
156+
echo app_name=$(bash ./collect_executables.sh | xargs -0 ./parse_executables.sh) >> "$GITHUB_OUTPUT"
155157
- name: Run Smoke Tests in MacOS
156158
if: steps.setup.conclusion == 'success'
157159
env:
158-
FX_EXECUTABLE: /Volumes/Firefox/Firefox.app/Contents/MacOS/firefox
160+
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
159161
run: |
160162
/Volumes/Firefox/Firefox.app/Contents/MacOS/firefox --version
161163
pipenv run python choose_ci_set.py

SELECTOR_INFO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ Path to .json: modules/data/navigation.components.json
29832983
```
29842984
```
29852985
Selector Name: search-mode-switcher-option
2986-
Selector Data: toolbarbutton[label*='{title}']
2986+
Selector Data: menuitem[label*='{title}']
29872987
Description: Option by label in search mode list
29882988
Location: Search mode of awesomebar
29892989
Path to .json: modules/data/navigation.components.json
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.page_object_autofill import AddressFill
6+
from modules.util import Utilities
7+
8+
9+
@pytest.fixture()
10+
def test_case():
11+
return "2888563"
12+
13+
14+
def test_demo_ad_autofill_address_fields(
15+
driver: Firefox,
16+
region: str,
17+
address_autofill: AddressFill,
18+
util: Utilities,
19+
autofill_popup: AutofillPopup,
20+
):
21+
"""
22+
C2888563 - Verify Autofill functionality when selecting an entry from the dropdown for address fields
23+
"""
24+
# Create fake data and fill it in
25+
address_autofill.open()
26+
address_autofill_data = util.fake_autofill_data(region)
27+
address_autofill.save_information_basic(address_autofill_data)
28+
29+
# Click the "Save" button
30+
autofill_popup.click_doorhanger_button("save")
31+
32+
# List of field labels to be autofilled and verified
33+
fields_to_test = [
34+
"street-address",
35+
"address-level2",
36+
"address-level1", # This will be skipped for DE/FR
37+
"postal-code",
38+
"country",
39+
]
40+
41+
# Loop through each field and perform the autofill test
42+
for field in fields_to_test:
43+
address_autofill.autofill_and_verify(
44+
autofill_popup, field, address_autofill_data, util
45+
)

l10n_CM/Unified/test_demo_ad_autofill_name_org.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from selenium.webdriver import Firefox
33

4-
from l10n_CM.Unified.conftest import autofill_popup
54
from modules.browser_object_autofill_popup import AutofillPopup
65
from modules.page_object_autofill import AddressFill
76
from modules.util import Utilities

l10n_CM/Unified/test_demo_cc_add_new_credit_card.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import pytest
44
from selenium.webdriver import Firefox
55

6-
from l10n_CM.Unified.conftest import region
76
from modules.page_object import AboutPrefs
87
from modules.util import Utilities
98

l10n_CM/Unified/test_demo_cc_doorhanger_data_is_stored_in_about_prefs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
from selenium.webdriver import Firefox
33

4-
from l10n_CM.Unified.conftest import region
54
from modules.browser_object_autofill_popup import AutofillPopup
65
from modules.page_object_autofill import CreditCardFill
76
from modules.page_object_prefs import AboutPrefs

l10n_CM/region/Unified.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
1414
"test_demo_cc_dropdown-presence.py",
1515
"test_demo_cc_yellow_highlight.py",
16+
"test_demo_ad_autofill_address_fields.py"
1617
"test_demo_ad_yellow_highlight_name_org.py",
1718
"test_demo_ad_yellow_highlight_address.py",
1819
"test_demo_ad_yellow_highlight_phone_email.py",
19-
"test_demo_ad_dropdown_presence_address.py"
20-
20+
"test_demo_ad_dropdown_presence_address.py
2121
]
2222
}

modules/data/navigation.components.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@
130130
},
131131

132132
"search-mode-switcher-option": {
133-
"selectorData": "toolbarbutton[label*='{title}']",
133+
"selectorData": "menuitem[label*='{title}']",
134134
"strategy": "css",
135135
"groups": []
136136
},
@@ -164,6 +164,7 @@
164164
},
165165

166166
"sponsored-suggestion": {
167+
"doNotCache": true,
167168
"selectorData": "urlbarView-row-body-description",
168169
"strategy": "class",
169170
"groups": []

modules/page_object_autofill.py

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,9 @@ def verify_autofill_data(
549549
"ZIP Code": autofill_data.postal_code,
550550
"Country": autofill_data.country,
551551
"Email": autofill_data.email,
552-
"Phone": util.normalize_phone_number(autofill_data.telephone),
552+
"Phone": util.normalize_regional_phone_numbers(
553+
autofill_data.telephone, region
554+
),
553555
}
554556

555557
# Validate each field
@@ -562,7 +564,7 @@ def verify_autofill_data(
562564

563565
# Normalize phone numbers before comparison
564566
if field == "Phone":
565-
actual = util.normalize_phone_number(actual)
567+
actual = util.normalize_regional_phone_numbers(actual, region)
566568

567569
assert actual == expected, (
568570
f"Mismatch in {field}: Expected '{expected}', but got '{actual}'"
@@ -594,6 +596,45 @@ def verify_autofill_dropdown_addresses(
594596
autofill_popup=autofill_popup, fields_to_test=fields_to_test, region=region
595597
)
596598

599+
def autofill_and_verify(
600+
self, address_autofill_popup, field_label, address_autofill_data, util
601+
):
602+
"""
603+
Autofills a form field, verifies the data, and clears it if necessary.
604+
Parameters:
605+
----------
606+
address_autofill : AddressFill
607+
The address autofill handler.
608+
address_autofill_popup : AutofillPopup
609+
The popup handler for autofill suggestions.
610+
field_label : str
611+
The label of the field being autofilled.
612+
address_autofill_data : dict
613+
The generated autofill data for verification.
614+
region : str
615+
The region code to handle localization.
616+
"""
617+
# Skip address-level1 (State) selection for DE and FR
618+
if field_label == "address-level1" and address_autofill_data.country in [
619+
"DE",
620+
"FR",
621+
]:
622+
return
623+
624+
# Double-click a field and choose the first element from the autocomplete dropdown
625+
self.double_click("form-field", labels=[field_label])
626+
first_item = address_autofill_popup.get_nth_element(1)
627+
address_autofill_popup.click_on(first_item)
628+
629+
# Verify autofill data
630+
self.verify_autofill_data(
631+
address_autofill_data, address_autofill_data.country, util
632+
)
633+
634+
# Clear form autofill
635+
self.double_click("form-field", labels=[field_label])
636+
address_autofill_popup.click_clear_form_option()
637+
597638

598639
class TextAreaFormAutofill(Autofill):
599640
"""

modules/testrail_integration.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,8 @@ def collect_changes(testrail_session: TestRail, report):
372372
"""
373373

374374
# Find milestone to attach to
375-
channel = os.environ.get("FX_CHANNEL").title()
376-
if not channel:
377-
channel = "Beta"
375+
channel = os.environ.get("FX_CHANNEL") or "beta"
376+
channel = channel.title()
378377
if channel == "Release":
379378
raise ValueError("Release reporting currently not supported")
380379

0 commit comments

Comments
 (0)