Skip to content

Commit 49a8a09

Browse files
authored
Merge branch 'main' into Hani/address_autofill_addresses_fields
2 parents 484ce97 + a7d3388 commit 49a8a09

14 files changed

+227
-155
lines changed

.github/workflows/check-devedition.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ jobs:
1212
Check-DevEdition-Version:
1313
runs-on: ubuntu-latest
1414
outputs:
15-
reportable: ${{ steps.reportable.outputs.test }}
15+
win_reportable: ${{ steps.reportable.outputs.win }}
16+
mac_reportable: ${{ steps.reportable.outputs.mac }}
1617
steps:
1718
- name: Checkout repository
1819
uses: actions/checkout@v4

SELECTOR_INFO.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,13 @@ Location: Appears as part of the dropdown under the autofill panel, within any e
13891389
Path to .json: modules/data/autofill_popup.components.json
13901390
```
13911391
```
1392+
Selector Name: select-form-option-by-index
1393+
Selector Data: ".autocomplete-richlistbox .autocomplete-richlistitem:nth:child({index})"
1394+
Description: Select n individual entry within the autofill dropdown, using the index of the child.
1395+
Location: Appears as part of the dropdown under the autofill panel, within any eligible form field when suggestions are available.
1396+
Path to .json: modules/data/autofill_popup.components.json
1397+
```
1398+
```
13921399
Selector Name: clear-form-option
13931400
Selector Data: ".autocomplete-richlistbox .autocomplete-richlistitem[ac-value='Clear Autofill Form']"
13941401
Description: The "Clear Autofill Form" option in the dropdown that appears when interacting with an autofill-enabled input field

collect_executables.py

Lines changed: 58 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def get_gd_platform():
103103
language = "en-US"
104104

105105
if channel == "-devedition":
106+
# Devedition has special requirements as it's testing a release
107+
106108
this_devedition = BACKSTOP
107109
fx_download_dir_url = (
108110
"https://archive.mozilla.org/pub/devedition/releases/135.0b5/"
@@ -121,62 +123,60 @@ def get_gd_platform():
121123
fx_download_dir_url = next_candidate
122124

123125
devedition_version = fx_download_dir_url.split("/")[-2]
124-
if NUMBER_ONLY:
125-
print(devedition_version)
126-
else:
127-
print(
128-
f"{fx_download_dir_url}{get_fx_platform()}/{language}/Firefox%20{devedition_version}.{get_fx_executable_extension()}"
129-
)
130-
exit()
131-
132-
candidate_exists = True
133-
this_beta = BACKSTOP
134-
while candidate_exists:
135-
(major, minor_beta) = this_beta.split(".")
136-
(minor, beta) = minor_beta.split("b")
137-
major = int(major)
138-
minor = int(minor)
139-
beta = int(beta)
140-
141-
next_major = f"{major + 1}.0b1"
142-
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_major}-candidates/build1/"
143-
rs = requests.get(fx_download_dir_url)
144-
if rs.status_code < 300:
145-
latest_beta_ver = next_major
146-
this_beta = next_major
147-
continue
148-
149-
next_minor = f"{major}.{minor + 1}b1"
150-
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_minor}-candidates/build1/"
151-
rs = requests.get(fx_download_dir_url)
152-
if rs.status_code < 300:
153-
latest_beta_ver = next_minor
154-
this_beta = next_minor
155-
continue
126+
fx_download_dir_url = f"{fx_download_dir_url}{get_fx_platform()}/{language}/"
156127

157-
next_beta = f"{major}.{minor}b{beta + 1}"
158-
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_beta}-candidates/build1/"
159-
rs = requests.get(fx_download_dir_url)
160-
if rs.status_code < 300:
161-
latest_beta_ver = next_beta
162-
this_beta = next_beta
163-
continue
164-
165-
candidate_exists = False
128+
else:
129+
# Anything but devedition
166130

167-
status = 200
168-
build = 0
169-
while status < 400 and build < 20:
170-
build += 1
171-
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{latest_beta_ver}-candidates/build{build}/"
131+
candidate_exists = True
132+
this_beta = BACKSTOP
133+
while candidate_exists:
134+
(major, minor_beta) = this_beta.split(".")
135+
(minor, beta) = minor_beta.split("b")
136+
major = int(major)
137+
minor = int(minor)
138+
beta = int(beta)
139+
140+
next_major = f"{major + 1}.0b1"
141+
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_major}-candidates/build1/"
142+
rs = requests.get(fx_download_dir_url)
143+
if rs.status_code < 300:
144+
latest_beta_ver = next_major
145+
this_beta = next_major
146+
continue
147+
148+
next_minor = f"{major}.{minor + 1}b1"
149+
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_minor}-candidates/build1/"
150+
rs = requests.get(fx_download_dir_url)
151+
if rs.status_code < 300:
152+
latest_beta_ver = next_minor
153+
this_beta = next_minor
154+
continue
155+
156+
next_beta = f"{major}.{minor}b{beta + 1}"
157+
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_beta}-candidates/build1/"
158+
rs = requests.get(fx_download_dir_url)
159+
if rs.status_code < 300:
160+
latest_beta_ver = next_beta
161+
this_beta = next_beta
162+
continue
163+
164+
candidate_exists = False
165+
166+
status = 200
167+
build = 0
168+
while status < 400 and build < 20:
169+
build += 1
170+
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{latest_beta_ver}-candidates/build{build}/"
171+
172+
# Fetch the page
173+
response = requests.get(fx_download_dir_url)
174+
status = response.status_code
172175

173-
# Fetch the page
174-
response = requests.get(fx_download_dir_url)
175-
status = response.status_code
176+
# Correct build is the last one that didn't 404
177+
build -= 1
178+
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{latest_beta_ver}-candidates/build{build}/{get_fx_platform()}/{language}/"
176179

177-
# Correct build is the last one that didn't 404
178-
build -= 1
179-
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{latest_beta_ver}-candidates/build{build}/{get_fx_platform()}/{language}/"
180180
response = requests.get(fx_download_dir_url)
181181
status = response.status_code
182182
response_text = None
@@ -206,8 +206,11 @@ def get_gd_platform():
206206

207207
fx_download_executable_url = rf"{fx_download_dir_url}{executable_name}"
208208
if NUMBER_ONLY:
209-
number_cand = fx_download_dir_url.split("/")[6]
210-
number = number_cand.split("-")[0]
211-
print(f"{number}-build{build}")
209+
if channel == "-devedition":
210+
print(devedition_version)
211+
else:
212+
number_cand = fx_download_dir_url.split("/")[6]
213+
number = number_cand.split("-")[0]
214+
print(f"{number}-build{build}")
212215
else:
213216
print(fx_download_executable_url)

collect_executables.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ then
77
curl -o Firefox.dmg -L "$(pipenv run python collect_executables.py)"
88
hdiutil attach Firefox.dmg
99
else
10+
pipenv run python collect_executables.py
1011
curl -o firefox.tar.xz -L "$(pipenv run python collect_executables.py)"
1112
tar xf firefox.tar.xz
1213
fi
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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 "2888564"
12+
13+
14+
def test_address_yellow_highlight_address_fields(
15+
driver: Firefox,
16+
region: str,
17+
address_autofill: AddressFill,
18+
util: Utilities,
19+
autofill_popup: AutofillPopup,
20+
):
21+
"""
22+
C2888564 - Verify the yellow highlight appears on autofilled fields for the address fields.
23+
"""
24+
25+
# Instantiate objects
26+
address_autofill_popup = AutofillPopup(driver)
27+
28+
# Create fake data and fill it in
29+
address_autofill.open()
30+
address_autofill_data = util.fake_autofill_data(region)
31+
address_autofill.save_information_basic(address_autofill_data)
32+
33+
# Click the "Save" button
34+
address_autofill_popup.click_doorhanger_button("save")
35+
36+
# Double click inside street address field and select a saved address entry from the dropdown
37+
address_autofill.double_click("form-field", labels=["street-address"])
38+
39+
# Click on the first element from the autocomplete dropdown
40+
first_item = address_autofill_popup.get_nth_element(1)
41+
address_autofill_popup.click_on(first_item)
42+
43+
# Verify the address fields are highlighted
44+
address_autofill.verify_field_yellow_highlights(
45+
region=region,
46+
fields_to_test=[
47+
"street-address",
48+
"address-level2",
49+
"address-level1",
50+
"postal-code",
51+
"country",
52+
],
53+
expected_highlighted_fields=[
54+
"street-address",
55+
"address-level2",
56+
"address-level1",
57+
"postal-code",
58+
"country",
59+
],
60+
)

l10n_CM/Unified/test_demo_ad_yellow_highlight.py renamed to l10n_CM/Unified/test_demo_ad_yellow_highlight_name_org.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ def test_case():
1414
def test_address_yellow_highlight_on_name_organization_fields(
1515
driver: Firefox,
1616
region: str,
17-
util: Utilities,
1817
address_autofill: AddressFill,
18+
util: Utilities,
1919
autofill_popup: AutofillPopup,
2020
):
2121
"""
@@ -30,7 +30,7 @@ def test_address_yellow_highlight_on_name_organization_fields(
3030
# Click the "Save" button
3131
autofill_popup.click_doorhanger_button("save")
3232

33-
# Double click inside phone field and select a saved address entry from the dropdown
33+
# Double click inside name field and select a saved address entry from the dropdown
3434
address_autofill.double_click("form-field", labels=["name"])
3535

3636
# Click on the first element from the autocomplete dropdown

l10n_CM/region/Unified.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,8 @@
1515
"test_demo_cc_yellow_highlight.py",
1616
"test_demo_ad_yellow_highlight.py",
1717
"test_demo_ad_autofill_address_fields.py"
18+
"test_demo_ad_yellow_highlight_name_org.py",
19+
"test_demo_ad_yellow_highlight_address.py",
20+
"test_demo_ad_yellow_highlight_phone_email.py"
1821
]
1922
}

modules/browser_object_autofill_popup.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,20 @@ def get_nth_element(self, index: str | int) -> WebElement:
8080
)
8181
)
8282

83+
def select_nth_element(self, index: int):
84+
"""
85+
Select the nth element from the autocomplete list
86+
Arguments:
87+
index (int): The index of the element to retrieve (1-based)
88+
"""
89+
with self.driver.context(self.driver.CONTEXT_CHROME):
90+
self.expect(
91+
EC.visibility_of(
92+
self.get_element("select-form-option-by-index", labels=[str(index)])
93+
)
94+
)
95+
self.get_element("select-form-option-by-index", labels=[str(index)]).click()
96+
8397
def get_primary_value(self, element: WebElement) -> str:
8498
"""
8599
Get the primary value from the autocomplete element

modules/data/autofill_popup.components.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@
6161
"groups": []
6262
},
6363

64+
"select-form-option-by-index": {
65+
"selectorData": ".autocomplete-richlistbox .autocomplete-richlistitem:nth-child({index})",
66+
"strategy":"css",
67+
"groups": []
68+
},
69+
6470
"update-card-info-popup-button": {
6571
"selectorData": "button[label='Update existing card']",
6672
"strategy": "css",

0 commit comments

Comments
 (0)