Skip to content

Commit 4083ae8

Browse files
Hani YacoubHani Yacoub
authored andcommitted
merge main
2 parents 5069961 + e4c7226 commit 4083ae8

11 files changed

+63
-18
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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 "2886598"
12+
13+
14+
def test_dropdown_presence_credit_card(driver: Firefox):
15+
"""
16+
C2886598 - Verify autofill dropdown is displayed only for the eligible fields after a credit card is saved
17+
"""
18+
19+
# Initialize objects
20+
util = Utilities()
21+
about_prefs = AboutPrefs(driver, category="privacy")
22+
about_prefs_cc_popup = AboutPrefs(driver)
23+
browser_action_obj = BrowserActions(driver)
24+
credit_card_fill_obj = CreditCardFill(driver)
25+
autofill_popup_obj = AutofillPopup(driver)
26+
27+
# Save a credit card in about:preferences
28+
about_prefs.open()
29+
iframe = about_prefs.get_saved_payments_popup_iframe()
30+
browser_action_obj.switch_to_iframe_context(iframe)
31+
credit_card_sample_data = util.fake_credit_card_data()
32+
about_prefs_cc_popup.click_on(
33+
"panel-popup-button", labels=["autofill-manage-add-button"]
34+
)
35+
about_prefs.fill_cc_panel_information(credit_card_sample_data)
36+
37+
# Open credit card form page
38+
credit_card_fill_obj.open()
39+
40+
# Verify autofill dropdown is displayed only for the eligible fields
41+
credit_card_fill_obj.verify_autofill_dropdown_all_fields(autofill_popup_obj)

l10n_CM/region/CA.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
77
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8-
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
8+
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py",
9+
"test_demo_cc_dropdown-presence.py"
910
]
1011
}

l10n_CM/region/DE.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
77
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py",
89
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
910
]
1011
}

l10n_CM/region/FR.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
77
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py",
89
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
910
]
1011
}

l10n_CM/region/US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"test_demo_cc_add_new_credit_card.py",
66
"test_demo_ad_doorhanger_shown_on_valid_address_submission.py",
77
"test_demo_ad_name_org_captured_in_doorhanger_and_stored.py",
8+
"test_demo_cc_dropdown-presence.py",
89
"test_demo_ad_address_data_captured_in_doorhanger_and_stored.py"
910
]
1011
}

modules/browser_object_autofill_popup.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,15 @@ def verify_element_displayed(self, reference: Union[str, tuple, WebElement]):
2323
"""Confirms that an element exists in popup"""
2424
self.element_clickable(reference)
2525

26-
def verify_no_popup_panel(self):
27-
"""Verifies that the autofill popup does NOT appear"""
28-
with self.driver.context(self.driver.CONTEXT_CHROME):
29-
element = self.get_element("autofill-panel")
30-
self.expect_not(EC.element_to_be_clickable(element))
26+
def ensure_autofill_dropdown_not_visible(self):
27+
"""Verifies that the autofill dropdown does NOT appear"""
28+
self.element_not_visible("select-form-option")
29+
return self
3130

32-
def verify_popup(self):
33-
"""Verifies that the autofill popup is clickable"""
34-
with self.driver.context(self.driver.CONTEXT_CHROME):
35-
self.expect(
36-
EC.element_to_be_clickable(self.get_element("select-form-option"))
37-
)
31+
def ensure_autofill_dropdown_visible(self):
32+
"""Verifies that the autofill dropdown appears"""
33+
self.element_visible("select-form-option")
34+
return self
3835

3936
# Interaction with popup elements
4037
def click_doorhanger_button(self, button_type: str) -> BasePage:

modules/page_object_autofill.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,14 @@ def fill_credit_card_info(self, info: CreditCardBase):
7373

7474
self.click_form_button("submit")
7575

76-
def verify_all_fields(self, ccp: AutofillPopup):
76+
def verify_autofill_dropdown_all_fields(self, ccp: AutofillPopup):
7777
"""Given a CreditCardPopup object, verify all fields"""
7878
for field in self.fields:
7979
self.double_click("form-field", labels=[field])
80-
ccp.verify_popup()
80+
ccp.ensure_autofill_dropdown_visible()
81+
# Ensure 'cc-csc' does NOT trigger the autofill dropdown
82+
self.double_click("form-field", labels=["cc-csc"])
83+
ccp.ensure_autofill_dropdown_not_visible()
8184

8285
def verify_four_fields(
8386
self, ccp: AutofillPopup, credit_card_sample_data: CreditCardBase

tests/form_autofill/test_autofill_credit_card.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,4 @@ def test_autofill_credit_card(driver: Firefox):
2424
credit_card_fill_obj.fill_credit_card_info(credit_card_sample_data)
2525
autofill_popup_obj.click_doorhanger_button("save")
2626

27-
credit_card_fill_obj.verify_all_fields(autofill_popup_obj)
27+
credit_card_fill_obj.verify_autofill_dropdown_all_fields(autofill_popup_obj)

tests/form_autofill/test_autofill_credit_card_enable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ def test_enable_disable_form_autofill_cc(driver: Firefox):
3131
new_autofill_popup_obj = AutofillPopup(driver)
3232

3333
new_credit_card_fill_obj.double_click("form-field", labels=["cc-name"])
34-
new_autofill_popup_obj.verify_no_popup_panel()
34+
new_autofill_popup_obj.ensure_autofill_dropdown_not_visible()

tests/form_autofill/test_enable_disable_autofill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ def test_enable_disable_autofill(driver: Firefox):
3939

4040
# verifying the popup panel does not appear
4141
new_af.double_click("form-field", labels=["name"])
42-
new_afp.verify_no_popup_panel()
42+
new_afp.ensure_autofill_dropdown_not_visible()

0 commit comments

Comments
 (0)