Skip to content

Commit 93d1288

Browse files
authored
Merge pull request #461 from mozilla/Hani/add_doorhanger_captures_name_org
Hani/Demo address name and org captured in doorhanger and stored
2 parents 13ead4f + 90e31f2 commit 93d1288

File tree

7 files changed

+97
-4
lines changed

7 files changed

+97
-4
lines changed

SELECTOR_INFO.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,20 @@ Description: Save address doorhanger
13531353
Location: Address bar
13541354
Path to .json: modules/data/autofill_popup.components.json
13551355
```
1356+
```
1357+
Selector Name: address-doorhanger-name
1358+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span"
1359+
Description: Save address doorhanger name section
1360+
Location: Address bar
1361+
Path to .json: modules/data/autofill_popup.components.json
1362+
```
1363+
```
1364+
Selector Name: address-doorhanger-org
1365+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(2) span"
1366+
Description: Save address doorhanger organization section
1367+
Location: Address bar
1368+
Path to .json: modules/data/autofill_popup.components.json
1369+
```
13561370
#### context_menu
13571371
```
13581372
Selector Name: context-menu-search-selected-text
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_about_pages import AboutConfig
6+
from modules.page_object_autofill import AddressFill
7+
from modules.page_object_prefs import AboutPrefs
8+
from modules.util import Utilities, BrowserActions
9+
10+
11+
@pytest.fixture()
12+
def test_case():
13+
return "2888701"
14+
15+
16+
def test_demo_ad_name_org_captured_in_doorhanger_and_stored(driver: Firefox, region: str):
17+
"""
18+
C2888701 - Verify name/org fields 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+
about_config = AboutConfig(driver)
25+
browser_action_obj = BrowserActions(driver)
26+
27+
# Change pref value of region
28+
about_config.change_config_value("browser.search.region", region)
29+
30+
# create fake data and fill it in
31+
address_autofill.open()
32+
address_autofill_data = util.fake_autofill_data(region)
33+
address_autofill.save_information_basic(address_autofill_data)
34+
35+
# The "Save address?" doorhanger is displayed
36+
address_autofill_popup.element_visible("address-save-doorhanger")
37+
38+
# containing name field
39+
expected_name = address_autofill_data.name
40+
address_autofill_popup.element_has_text("address-doorhanger-name", expected_name)
41+
42+
# containing org field
43+
expected_org = address_autofill_data.organization
44+
address_autofill_popup.element_has_text("address-doorhanger-org", expected_org)
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: name and organization
55+
elements = about_prefs.get_elements("saved-addresses-values")
56+
expected_values = [expected_name, expected_org]
57+
found_name_org = any(
58+
all(value in element.text for value in expected_values)
59+
for element in elements
60+
)
61+
assert (
62+
found_name_org
63+
), "Name or organization were not found in any of the address entries!"

l10n_CM/region/CA.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored"
78
]
89
}

l10n_CM/region/DE.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored"
78
]
89
}

l10n_CM/region/FR.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored"
78
]
89
}

l10n_CM/region/US.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"tests": [
44
"test_demo_cc_doorhanger_shown_on_valid_credit_card_submission.py",
55
"test_demo_cc_add_new_credit_card.py",
6-
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py"
6+
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
7+
"test_demo_ad_name_org_captured_in_doorhanger_and_stored"
78
]
89
}

modules/data/autofill_popup.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@
8383
"selectorData": "address-save-update-notification-content",
8484
"strategy": "class",
8585
"groups": []
86+
},
87+
88+
"address-doorhanger-name": {
89+
"selectorData": "div.address-save-update-row-container:nth-of-type(1) div p:first-of-type span",
90+
"strategy": "css",
91+
"groups": []
92+
},
93+
94+
"address-doorhanger-org": {
95+
"selectorData": "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(2) span",
96+
"strategy": "css",
97+
"groups": []
8698
}
8799
}
88100

0 commit comments

Comments
 (0)