4
4
from modules .browser_object_autofill_popup import AutofillPopup
5
5
from modules .page_object_autofill import AddressFill
6
6
from modules .page_object_prefs import AboutPrefs
7
- from modules .util import Utilities , BrowserActions
8
-
7
+ from modules .util import BrowserActions , Utilities
9
8
10
9
11
10
@pytest .fixture ()
12
11
def test_case ():
13
12
return "2888703"
14
13
15
14
16
- def test_demo_ad_address_data_captured_in_doorhanger_and_stored (driver : Firefox , region : str ):
15
+ def test_demo_ad_address_data_captured_in_doorhanger_and_stored (
16
+ driver : Firefox , region : str
17
+ ):
17
18
"""
18
19
C2888703 - Verify Address data are captured in the Capture Doorhanger and stored in about:preferences
19
20
"""
@@ -33,7 +34,9 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
33
34
34
35
# containing Street Address field
35
36
expected_street_add = address_autofill_data .street_address
36
- address_autofill_popup .element_has_text ("address-doorhanger-street" , expected_street_add )
37
+ address_autofill_popup .element_has_text (
38
+ "address-doorhanger-street" , expected_street_add
39
+ )
37
40
38
41
# containing City field
39
42
expected_city = address_autofill_data .address_level_2
@@ -42,16 +45,24 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
42
45
expected_state = address_autofill_data .address_level_1
43
46
if region not in ["FR" , "DE" ]:
44
47
state_abbreviation = util .get_state_province_abbreviation (expected_state )
45
- address_autofill_popup .element_has_text ("address-doorhanger-state" , state_abbreviation )
48
+ address_autofill_popup .element_has_text (
49
+ "address-doorhanger-state" , state_abbreviation
50
+ )
46
51
47
52
# Verify Zip Code field (Different selector for DE/FR)
48
53
expected_zip = address_autofill_data .postal_code
49
- zip_selector = "address-doorhanger-zip-other" if region in ["FR" , "DE" ] else "address-doorhanger-zip"
54
+ zip_selector = (
55
+ "address-doorhanger-zip-other"
56
+ if region in ["FR" , "DE" ]
57
+ else "address-doorhanger-zip"
58
+ )
50
59
address_autofill_popup .element_has_text (zip_selector , expected_zip )
51
60
52
61
# containing Country field
53
62
expected_country = address_autofill_data .country
54
- address_autofill_popup .element_has_text ("address-doorhanger-country" , expected_country )
63
+ address_autofill_popup .element_has_text (
64
+ "address-doorhanger-country" , expected_country
65
+ )
55
66
56
67
# Click the "Save" button
57
68
address_autofill_popup .click_doorhanger_button ("save" )
@@ -65,13 +76,17 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(driver: Firefox,
65
76
elements = about_prefs .get_elements ("saved-addresses-values" )
66
77
67
78
# Expected values for verification
68
- expected_values = [expected_street_add , expected_city , expected_zip , expected_country ]
79
+ expected_values = [
80
+ expected_street_add ,
81
+ expected_city ,
82
+ expected_zip ,
83
+ expected_country ,
84
+ ]
69
85
if region not in ["FR" , "DE" ]:
70
86
expected_values .insert (2 , expected_state )
71
87
72
88
# Check if all expected values exist in any saved address
73
89
found_address_data = any (
74
- all (value in element .text for value in expected_values )
75
- for element in elements
90
+ all (value in element .text for value in expected_values ) for element in elements
76
91
)
77
- assert found_address_data , "Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
92
+ assert found_address_data , "Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
0 commit comments