Skip to content

Commit e4a45f0

Browse files
current fixes
1 parent 8fb4410 commit e4a45f0

7 files changed

+184
-184
lines changed

l10n_CM/Unified/test_demo_ad_4a_highlight_name_org_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_address_yellow_highlight_on_name_organization_fields(
3838
autofill_popup.ensure_autofill_dropdown_visible()
3939

4040
# Click on the first element from the autocomplete dropdown
41-
autofill_popup.select_nth_element(1)
41+
autofill_popup.select_autofill_panel()
4242

4343
field_to_test = ["given_name", "family_name", "name", "organization"]
4444
# Verify the name and organization fields are highlighted

l10n_CM/Unified/test_demo_ad_4b_highlight_address_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_address_yellow_highlight_address_fields(
3333
autofill_popup.ensure_autofill_dropdown_visible()
3434

3535
# Click on the first element from the autocomplete dropdown
36-
autofill_popup.select_nth_element(1)
36+
autofill_popup.select_autofill_panel()
3737

3838
field_to_test = [
3939
"street_address",

l10n_CM/Unified/test_demo_ad_4c_highlight_phone_email_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_address_yellow_highlight_address_fields(
3333
autofill_popup.ensure_autofill_dropdown_visible()
3434

3535
# Click on the first element from the autocomplete dropdown
36-
autofill_popup.select_nth_element(1)
36+
autofill_popup.select_autofill_panel()
3737

3838
field_to_test = ["email", "telephone"]
3939
# Verify the address fields are highlighted

l10n_CM/run_l10n.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"tiffany",
5050
"assos",
5151
"zooplus",
52-
"duka"
52+
"duka",
5353
}
5454

5555
loaded_valid_sites = valid_l10n_mappings().keys()

modules/browser_object_autofill_popup.py

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from time import sleep
12
from typing import Union
23

34
from selenium.webdriver.remote.webelement import WebElement
@@ -26,29 +27,34 @@ def verify_element_displayed(self, reference: Union[str, tuple, WebElement]):
2627
@BasePage.context_chrome
2728
def ensure_autofill_dropdown_not_visible(self):
2829
"""
29-
Verifies that the autofill dropdown does NOT appear
30-
checks if the parent pop up component have children elements before explicit wait.
30+
Verifies that the autofill dropdown does not appear
31+
checks if the parent pop up component has hidden attribute.
3132
"""
3233
self.element_exists("pop-up-component")
33-
popup_component = self.get_element("pop-up-component")
34-
if popup_component and len(popup_component.get_attribute("innerHTML")) > 1:
35-
self.element_not_visible("select-form-option")
34+
self.expect_element_attribute_contains("pop-up-component", "hidden", "true")
3635
return self
3736

3837
@BasePage.context_chrome
39-
def ensure_autofill_dropdown_visible(self, field_element: WebElement = None):
38+
def ensure_autofill_dropdown_visible(self):
4039
"""
4140
Verifies that the autofill dropdown appears
42-
checks if the parent pop up component have children elements before explicit wait.
43-
44-
Arguments:
45-
field_element: if field element is given.
46-
check whether it is a select element. pass the check if it is.
41+
checks if the parent pop up component has hidden attribute.
4742
"""
48-
self.element_exists("pop-up-component")
49-
popup_component = self.get_element("pop-up-component")
50-
if popup_component:
51-
self.element_visible("select-form-option")
43+
self.expect(
44+
lambda _: len(
45+
self.get_element("pop-up-component").get_attribute("innerHTML")
46+
)
47+
> 1
48+
)
49+
assert self.get_element("pop-up-component").get_attribute("hidden") is None, (
50+
"Pop up autofill panel hidden."
51+
)
52+
return self
53+
54+
@BasePage.context_chrome
55+
def hover_over_autofill_panel(self):
56+
self.element_visible("select-form-option")
57+
self.hover("select-form-option")
5258
return self
5359

5460
# Interaction with popup elements
@@ -110,6 +116,14 @@ def select_nth_element(self, index: int):
110116
)
111117
self.get_element("select-form-option-by-index", labels=[str(index)]).click()
112118

119+
@BasePage.context_chrome
120+
def select_autofill_panel(self):
121+
"""
122+
Select the first autofill panel in the autocomplete list.
123+
"""
124+
self.get_element("select-form-option-autofill").click()
125+
return self
126+
113127
@BasePage.context_chrome
114128
def get_primary_value(self, element: WebElement) -> str:
115129
"""

0 commit comments

Comments
 (0)