Skip to content

Commit 9fff7b1

Browse files
Merge branch 'main' into philimon/add-new-address
2 parents 2f5a59e + ba92102 commit 9fff7b1

11 files changed

+156
-7
lines changed

SELECTOR_INFO.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,20 @@ Location: Address bar
13541354
Path to .json: modules/data/autofill_popup.components.json
13551355
```
13561356
```
1357+
Selector Name: address-doorhanger-email
1358+
Selector Data: "div.address-save-update-row-container:nth-of-type(2) div p:first-of-type span"
1359+
Description: Save address doorhanger email section
1360+
Location: Address bar
1361+
Path to .json: modules/data/autofill_popup.components.json
1362+
```
1363+
```
1364+
Selector Name: address-doorhanger-phone
1365+
Selector Data: "div.address-save-update-row-container:nth-of-type(2) div p:nth-of-type(2) span"
1366+
Description: Save address doorhanger phone section
1367+
Location: Address bar
1368+
Path to .json: modules/data/autofill_popup.components.json
1369+
```
1370+
```
13571371
Selector Name: address-doorhanger-name
13581372
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span"
13591373
Description: Save address doorhanger name section
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
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.page_object_prefs import AboutPrefs
7+
from modules.util import Utilities, BrowserActions
8+
9+
10+
@pytest.fixture()
11+
def test_case():
12+
return "2886581"
13+
14+
15+
def test_demo_ad_email_phone_captured_in_doorhanger_and_stored(driver: Firefox, region: str
16+
):
17+
"""
18+
C2888704 - Verify tele/email data are captured in the Capture Doorhanger and stored in about:preferences
19+
"""
20+
# instantiate objects
21+
address_autofill = AddressFill(driver)
22+
address_autofill_popup = AutofillPopup(driver)
23+
util = Utilities()
24+
browser_action_obj = BrowserActions(driver)
25+
26+
# create fake data and fill it in
27+
address_autofill.open()
28+
address_autofill_data = util.fake_autofill_data(region)
29+
address_autofill.save_information_basic(address_autofill_data)
30+
31+
# The "Save address?" doorhanger is displayed
32+
address_autofill_popup.element_visible("address-save-doorhanger")
33+
34+
# containing email field
35+
expected_email = address_autofill_data.email
36+
address_autofill_popup.element_has_text("address-doorhanger-email", expected_email)
37+
38+
# containing phone field
39+
expected_phone = address_autofill_data.telephone
40+
with driver.context(driver.CONTEXT_CHROME):
41+
actual_phone = address_autofill_popup.get_element("address-doorhanger-phone").text
42+
normalize_expected = util.normalize_phone_number(expected_phone)
43+
normalized_actual = util.normalize_phone_number(actual_phone)
44+
assert normalized_actual == normalize_expected
45+
46+
# Click the "Save" button
47+
address_autofill_popup.click_doorhanger_button("save")
48+
49+
# Navigate to about:preferences#privacy => "Autofill" section
50+
about_prefs = AboutPrefs(driver, category="privacy").open()
51+
iframe = about_prefs.get_save_addresses_popup_iframe()
52+
browser_action_obj.switch_to_iframe_context(iframe)
53+
54+
# The address saved in step 2 is listed in the "Saved addresses" modal: Email and phone
55+
elements = about_prefs.get_elements("saved-addresses-values")
56+
expected_values = [expected_phone, expected_email]
57+
found_email_phone = any(
58+
all(value in element.text for value in expected_values)
59+
for element in elements
60+
)
61+
assert (
62+
found_email_phone
63+
), "Email or phone were not found in any of the address entries!"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import pytest
2+
from selenium.webdriver import Firefox
3+
4+
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.page_object import AboutPrefs, CreditCardFill
6+
from modules.util import BrowserActions, Utilities
7+
8+
9+
@pytest.fixture()
10+
def test_case():
11+
return "2886602"
12+
13+
14+
def test_cc_clear_form(driver: Firefox):
15+
"""
16+
C2886602 - Verify that clearing the form from any field results in all fields being emptied, regardless of the
17+
field from which the clear action was triggered.
18+
"""
19+
20+
# Initialize objects
21+
util = Utilities()
22+
about_prefs = AboutPrefs(driver, category="privacy")
23+
about_prefs_cc_popup = AboutPrefs(driver)
24+
browser_action_obj = BrowserActions(driver)
25+
credit_card_fill_obj = CreditCardFill(driver)
26+
autofill_popup = AutofillPopup(driver)
27+
28+
# Save a credit card in about:preferences
29+
about_prefs.open()
30+
iframe = about_prefs.get_saved_payments_popup_iframe()
31+
browser_action_obj.switch_to_iframe_context(iframe)
32+
credit_card_sample_data = util.fake_credit_card_data()
33+
about_prefs_cc_popup.click_on(
34+
"panel-popup-button", labels=["autofill-manage-add-button"]
35+
)
36+
about_prefs.fill_cc_panel_information(credit_card_sample_data)
37+
38+
# Open credit card form page, clear form and verify all fields are empty
39+
credit_card_fill_obj.open()
40+
credit_card_fill_obj.verify_clear_form_all_fields(autofill_popup)

l10n_CM/region/CA.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py",
78
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
89
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py",
9-
"test_demo_cc_dropdown-presence.py"
10+
"test_demo_cc_dropdown-presence.py",
11+
"test_demo_cc_clear_form.py"
1012
]
1113
}

l10n_CM/region/DE.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py",
78
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
89
"test_demo_cc_dropdown-presence.py",
9-
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
10+
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py",
11+
"test_demo_cc_clear_form.py"
1012
]
1113
}

l10n_CM/region/FR.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
77
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
88
"test_demo_cc_dropdown-presence.py",
9-
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
9+
"test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py",
10+
"test_demo_cc_dropdown-presence.py"
11+
"test_demo_cc_clear_form.py"
1012
]
1113
}

modules/browser_object_autofill_popup.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def click_autofill_form_option(self) -> BasePage:
4949

5050
def click_clear_form_option(self) -> BasePage:
5151
"""Clicks to clear the saved form option (address or credit card)"""
52-
with self.driver.context(self.driver.CONTEXT_CHROME):
53-
self.get_element("clear-form-option").click()
52+
self.click_on("clear-form-option")
5453
return self
5554

5655
# Interaction with autocomplete list elements

modules/data/autofill_popup.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@
8585
"groups": []
8686
},
8787

88+
"address-doorhanger-email": {
89+
"selectorData": "div.address-save-update-row-container:nth-of-type(2) div p:first-of-type span",
90+
"strategy": "css",
91+
"groups": []
92+
},
93+
94+
"address-doorhanger-phone": {
95+
"selectorData": "div.address-save-update-row-container:nth-of-type(2) div p:nth-of-type(2) span",
96+
"strategy": "css",
97+
"groups": []
98+
},
99+
88100
"address-doorhanger-name": {
89101
"selectorData": "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span",
90102
"strategy": "css",

modules/page_object_about_pages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
StaleElementReferenceException,
66
WebDriverException,
77
)
8-
from selenium.webdriver.common.by import By
98
from selenium.webdriver.common.keys import Keys
109
from selenium.webdriver.support import expected_conditions as EC
1110

modules/page_object_autofill.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,23 @@ def update_cc_exp_year(
303303
)
304304
return self
305305

306+
def verify_clear_form_all_fields(self, autofill_popup_obj: AutofillPopup):
307+
"""
308+
Clears all fields in the form by triggering the clear action from each field in turn. After each clear
309+
action, verifies that all fields are empty, regardless of which field initiated the clear.
310+
"""
311+
for field in self.fields:
312+
self.click_on("form-field", labels=[field])
313+
autofill_popup_obj.click_autofill_form_option()
314+
self.click_on("form-field", labels=[field])
315+
autofill_popup_obj.click_clear_form_option()
316+
# Verify that all fields are blank
317+
for f in self.fields:
318+
self.element_attribute_contains("form-field", "value", "", labels=[f])
319+
# Verify that the 'cc-csc' field does not trigger an autofill dropdown
320+
self.double_click("form-field", labels=["cc-csc"])
321+
autofill_popup_obj.ensure_autofill_dropdown_not_visible()
322+
306323

307324
class LoginAutofill(Autofill):
308325
"""

0 commit comments

Comments
 (0)