Skip to content

Commit ba92102

Browse files
authored
Merge pull request #433 from mozilla/Hani/address_doorhanger_captures_email_telephone
Hani/Demo address email and phone captured in doorhanger and stored
2 parents cea3c93 + 73edd3c commit ba92102

File tree

8 files changed

+95
-3
lines changed

8 files changed

+95
-3
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!"

l10n_CM/region/CA.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
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",
910
"test_demo_cc_dropdown-presence.py",

l10n_CM/region/DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
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",
910
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py",

l10n_CM/region/FR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +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"
1011
"test_demo_cc_clear_form.py"
1112
]
1213
}

l10n_CM/region/US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +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"
1011
"test_demo_cc_clear_form.py"
1112
]
1213
}

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

0 commit comments

Comments
 (0)