Skip to content

Commit 4913dd4

Browse files
Merge branch 'main' into vs/CC-doorhanger-data-is-saved
2 parents 99f949e + 6017032 commit 4913dd4

File tree

48 files changed

+757
-166
lines changed

Some content is hidden

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

48 files changed

+757
-166
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ taskcluster-taskgraph = "==9.0.0"
1717
jsonpath-ng = "1.6.1"
1818
pillow = "<10.5"
1919
pyfxa = "0.7.0"
20-
ruff = "0.5.2"
20+
ruff = "0.9.6"
2121
pytest-rerunfailures = "14.0"
2222
slack-sdk = "3.31.0"
2323
google-cloud-storage = "2.18.0"

SELECTOR_INFO.md

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,69 @@ Description: "Submit" button
11961196
Location: At the bottom of the autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
11971197
Path to .json: modules/data/address_fill.components.json
11981198
```
1199+
```
1200+
Selector Name: name-field
1201+
Selector Data: "input[autocomplete=name]"
1202+
Description: Name field
1203+
Location: Name field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1204+
Path to .json: modules/data/address_fill.components.json
1205+
```
1206+
```
1207+
Selector Name: org-field
1208+
Selector Data: "input[autocomplete=organization]"
1209+
Description: Organization field
1210+
Location: Organization field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1211+
Path to .json: modules/data/address_fill.components.json
1212+
```
1213+
```
1214+
Selector Name: street-field
1215+
Selector Data: "input[autocomplete=street-address]"
1216+
Description: Street field
1217+
Location: Street field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1218+
Path to .json: modules/data/address_fill.components.json
1219+
```
1220+
```
1221+
Selector Name: add-level2-field
1222+
Selector Data: "input[autocomplete=address-level2]"
1223+
Description: Address level 2 field
1224+
Location: Address level 2 field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1225+
Path to .json: modules/data/address_fill.components.json
1226+
```
1227+
```
1228+
Selector Name: add-level1-field
1229+
Selector Data: "input[autocomplete=address-level1]"
1230+
Description: Address level 1 field
1231+
Location: Address level 1 field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1232+
Path to .json: modules/data/address_fill.components.json
1233+
```
1234+
```
1235+
Selector Name: zip-field
1236+
Selector Data: "input[autocomplete=postal-code]"
1237+
Description: Zip field
1238+
Location: Zip field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1239+
Path to .json: modules/data/address_fill.components.json
1240+
```
1241+
```
1242+
Selector Name: country-field
1243+
Selector Data: "input[autocomplete=country]"
1244+
Description: Country field
1245+
Location: Country field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1246+
Path to .json: modules/data/address_fill.components.json
1247+
```
1248+
```
1249+
Selector Name: email-field
1250+
Selector Data: "input[autocomplete=email]"
1251+
Description: Email field
1252+
Location: Email field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1253+
Path to .json: modules/data/address_fill.components.json
1254+
```
1255+
```
1256+
Selector Name: phone-field
1257+
Selector Data: "input[autocomplete=tel]"
1258+
Description: Phone field
1259+
Location: Phone field on autofill address demo page - https://mozilla.github.io/form-fill-examples/basic.html
1260+
Path to .json: modules/data/address_fill.components.json
1261+
```
11991262
#### amo_languages
12001263
```
12011264
Selector Name: language-addons-title
@@ -1368,6 +1431,20 @@ Location: Address bar
13681431
Path to .json: modules/data/autofill_popup.components.json
13691432
```
13701433
```
1434+
Selector Name: address-doorhanger-email
1435+
Selector Data: "div.address-save-update-row-container:nth-of-type(2) div p:first-of-type span"
1436+
Description: Save address doorhanger email section
1437+
Location: Address bar
1438+
Path to .json: modules/data/autofill_popup.components.json
1439+
```
1440+
```
1441+
Selector Name: address-doorhanger-phone
1442+
Selector Data: "div.address-save-update-row-container:nth-of-type(2) div p:nth-of-type(2) span"
1443+
Description: Save address doorhanger phone section
1444+
Location: Address bar
1445+
Path to .json: modules/data/autofill_popup.components.json
1446+
```
1447+
```
13711448
Selector Name: address-doorhanger-name
13721449
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span"
13731450
Description: Save address doorhanger name section
@@ -1381,6 +1458,48 @@ Description: Save address doorhanger organization section
13811458
Location: Address bar
13821459
Path to .json: modules/data/autofill_popup.components.json
13831460
```
1461+
```
1462+
Selector Name: address-doorhanger-street
1463+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(3) span"
1464+
Description: Save address doorhanger street address section
1465+
Location: Address bar
1466+
Path to .json: modules/data/autofill_popup.components.json
1467+
```
1468+
```
1469+
Selector Name: address-doorhanger-city
1470+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(1)"
1471+
Description: Save address doorhanger city section
1472+
Location: Address bar
1473+
Path to .json: modules/data/autofill_popup.components.json
1474+
```
1475+
```
1476+
Selector Name: address-doorhanger-state
1477+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(3)"
1478+
Description: Save address doorhanger state section
1479+
Location: Address bar
1480+
Path to .json: modules/data/autofill_popup.components.json
1481+
```
1482+
```
1483+
Selector Name: address-doorhanger-zip
1484+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(5)"
1485+
Description: Save address doorhanger zip section for US and CA
1486+
Location: Address bar
1487+
Path to .json: modules/data/autofill_popup.components.json
1488+
```
1489+
```
1490+
Selector Name: address-doorhanger-zip-other
1491+
Selector Data: "selectorData": "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(3)",
1492+
Description: Save address doorhanger zip section for other regions
1493+
Location: Address bar
1494+
Path to .json: modules/data/autofill_popup.components.json
1495+
```
1496+
```
1497+
Selector Name: address-doorhanger-country
1498+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(5) span"
1499+
Description: Save address doorhanger country section
1500+
Location: Address bar
1501+
Path to .json: modules/data/autofill_popup.components.json
1502+
```
13841503
#### context_menu
13851504
```
13861505
Selector Name: context-menu-search-selected-text

collect_executables.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,23 @@ def get_gd_platform():
111111
minor = int(minor)
112112
beta = int(beta)
113113

114-
next_major = f"{major+1}.0b1"
114+
next_major = f"{major + 1}.0b1"
115115
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_major}-candidates/build1/"
116116
rs = requests.get(fx_download_dir_url)
117117
if rs.status_code < 300:
118118
latest_beta_ver = next_major
119119
this_beta = next_major
120120
continue
121121

122-
next_minor = f"{major}.{minor+1}b1"
122+
next_minor = f"{major}.{minor + 1}b1"
123123
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_minor}-candidates/build1/"
124124
rs = requests.get(fx_download_dir_url)
125125
if rs.status_code < 300:
126126
latest_beta_ver = next_minor
127127
this_beta = next_minor
128128
continue
129129

130-
next_beta = f"{major}.{minor}b{beta+1}"
130+
next_beta = f"{major}.{minor}b{beta + 1}"
131131
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_beta}-candidates/build1/"
132132
rs = requests.get(fx_download_dir_url)
133133
if rs.status_code < 300:
@@ -152,8 +152,17 @@ def get_gd_platform():
152152
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{latest_beta_ver}-candidates/build{build}/{get_fx_platform()}/{language}/"
153153
response = requests.get(fx_download_dir_url)
154154
status = response.status_code
155-
if status < 300:
156-
response_text = response.text
155+
response_text = None
156+
for _ in range(3):
157+
if status < 300:
158+
response_text = response.text
159+
else:
160+
sleep(3)
161+
response = requests.get(fx_download_dir_url)
162+
status = response.status_code
163+
164+
if response_text is None:
165+
exit(f"Could not find build at {fx_download_dir_url}.")
157166

158167
# Parse the HTML content
159168
soup = BeautifulSoup(response_text, "html.parser")

l10n_CM/Unified/test_demo_ad_address_data_captured_in_doorhanger_and_stored.py

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
from modules.browser_object_autofill_popup import AutofillPopup
55
from modules.page_object_autofill import AddressFill
66
from modules.page_object_prefs import AboutPrefs
7-
from modules.util import Utilities, BrowserActions
8-
7+
from modules.util import BrowserActions, Utilities
98

109

1110
@pytest.fixture()
1211
def test_case():
1312
return "2888703"
1413

1514

16-
def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox, region: str):
15+
16+
def test_demo_ad_address_data_captured_in_doorhanger_and_stored(
17+
driver: Firefox, region: str
18+
):
19+
1720
"""
1821
C2888703 - Verify Address data are captured in the Capture Doorhanger and stored in about:preferences
1922
"""
@@ -33,7 +36,10 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
3336

3437
# containing Street Address field
3538
expected_street_add = address_autofill_data.street_address
36-
address_autofill_popup.element_has_text("address-doorhanger-street", expected_street_add)
39+
40+
address_autofill_popup.element_has_text(
41+
"address-doorhanger-street", expected_street_add
42+
)
3743

3844
# containing City field
3945
expected_city = address_autofill_data.address_level_2
@@ -42,16 +48,26 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
4248
expected_state = address_autofill_data.address_level_1
4349
if region not in ["FR", "DE"]:
4450
state_abbreviation = util.get_state_province_abbreviation(expected_state)
45-
address_autofill_popup.element_has_text("address-doorhanger-state", state_abbreviation)
51+
address_autofill_popup.element_has_text(
52+
"address-doorhanger-state", state_abbreviation
53+
)
4654

4755
# Verify Zip Code field (Different selector for DE/FR)
4856
expected_zip = address_autofill_data.postal_code
49-
zip_selector = "address-doorhanger-zip-other" if region in ["FR", "DE"] else "address-doorhanger-zip"
57+
zip_selector = (
58+
"address-doorhanger-zip-other"
59+
if region in ["FR", "DE"]
60+
else "address-doorhanger-zip"
61+
)
62+
5063
address_autofill_popup.element_has_text(zip_selector, expected_zip)
5164

5265
# containing Country field
5366
expected_country = address_autofill_data.country
54-
address_autofill_popup.element_has_text("address-doorhanger-country", expected_country)
67+
68+
address_autofill_popup.element_has_text(
69+
"address-doorhanger-country", expected_country
70+
)
5571

5672
# Click the "Save" button
5773
address_autofill_popup.click_doorhanger_button("save")
@@ -65,13 +81,20 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
6581
elements = about_prefs.get_elements("saved-addresses-values")
6682

6783
# Expected values for verification
68-
expected_values = [expected_street_add, expected_city, expected_zip, expected_country]
84+
expected_values = [
85+
expected_street_add,
86+
expected_city,
87+
expected_zip,
88+
expected_country,
89+
]
6990
if region not in ["FR", "DE"]:
7091
expected_values.insert(2, expected_state)
7192

7293
# Check if all expected values exist in any saved address
7394
found_address_data = any(
74-
all(value in element.text for value in expected_values)
75-
for element in elements
95+
all(value in element.text for value in expected_values) for element in elements
7696
)
77-
assert found_address_data, "Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
97+
assert found_address_data, (
98+
"Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
99+
)
100+
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 "2888558"
12+
13+
14+
def test_demo_ad_autofill_name_org(driver: Firefox, region: str):
15+
"""
16+
C2888558 - Verify Autofill functionality when selecting an entry from the dropdown for name/org fields
17+
"""
18+
# Instantiate objects
19+
address_autofill = AddressFill(driver)
20+
address_autofill_popup = AutofillPopup(driver)
21+
util = Utilities()
22+
23+
# Create fake data and fill it in
24+
address_autofill.open()
25+
address_autofill_data = util.fake_autofill_data(region)
26+
address_autofill.save_information_basic(address_autofill_data)
27+
28+
# Click the "Save" button
29+
address_autofill_popup.click_doorhanger_button("save")
30+
31+
# Double inside Name field and select a saved address entry from the dropdown
32+
address_autofill.double_click("form-field", labels=["name"])
33+
34+
# Click on the first element from the autocomplete dropdown
35+
first_item = address_autofill_popup.get_nth_element(1)
36+
address_autofill_popup.click_on(first_item)
37+
38+
# Verify autofill data
39+
address_autofill.verify_autofill_data(address_autofill_data, region, util)
40+
41+
# Double inside Name field and select clear form autofill
42+
address_autofill.double_click("form-field", labels=["name"])
43+
address_autofill_popup.click_clear_form_option()
44+
45+
# Double inside Organization field and select a saved address entry from the dropdown
46+
address_autofill.double_click("form-field", labels=["organization"])
47+
48+
# Click on the first element from the autocomplete dropdown
49+
first_item = address_autofill_popup.get_nth_element(1)
50+
address_autofill_popup.click_on(first_item)
51+
52+
# Verify autofill data
53+
address_autofill.verify_autofill_data(address_autofill_data, region, util)

0 commit comments

Comments
 (0)