Skip to content

Philimon/rework ensure visible #727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions choose_l10n_ci_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ def select_l10n_mappings(beta_version):
Args:
beta_version: the current beta version.
"""
beta_split = (beta_version % 3) + 1
if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json"):
with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json", "r") as f:
current_split_mappings = {k: set(v) for k, v in json.load(f).items()}
return current_split_mappings
else:
return valid_l10n_mappings()
# beta_split = (beta_version % 3) + 1
# if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json"):
# with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json", "r") as f:
# current_split_mappings = {k: set(v) for k, v in json.load(f).items()}
# return current_split_mappings
# else:
# return valid_l10n_mappings()
return valid_l10n_mappings()


if __name__ == "__main__":
Expand Down Expand Up @@ -187,5 +188,5 @@ def select_l10n_mappings(beta_version):
selected_mappings |= sample_mappings
break

save_mappings(selected_mappings)
save_mappings(l10n_mappings)
sys.exit(0)
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def test_address_yellow_highlight_on_name_organization_fields(
autofill_popup.ensure_autofill_dropdown_visible()

# Click on the first element from the autocomplete dropdown
autofill_popup.select_nth_element(1)
autofill_popup.select_autofill_panel()

field_to_test = ["given_name", "family_name", "name", "organization"]
# Verify the name and organization fields are highlighted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_address_yellow_highlight_address_fields(
autofill_popup.ensure_autofill_dropdown_visible()

# Click on the first element from the autocomplete dropdown
autofill_popup.select_nth_element(1)
autofill_popup.select_autofill_panel()

field_to_test = [
"street_address",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_address_yellow_highlight_address_fields(
autofill_popup.ensure_autofill_dropdown_visible()

# Click on the first element from the autocomplete dropdown
autofill_popup.select_nth_element(1)
autofill_popup.select_autofill_panel()

field_to_test = ["email", "telephone"]
# Verify the address fields are highlighted
Expand Down
48 changes: 28 additions & 20 deletions modules/browser_object_autofill_popup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,32 @@ def verify_element_displayed(self, reference: Union[str, tuple, WebElement]):
@BasePage.context_chrome
def ensure_autofill_dropdown_not_visible(self):
"""
Verifies that the autofill dropdown does NOT appear
checks if the parent pop up component have children elements before explicit wait.
Verifies that the autofill dropdown does not appear
checks if the parent pop up component has hidden attribute.
"""
self.element_exists("pop-up-component")
popup_component = self.get_element("pop-up-component")
if popup_component and len(popup_component.get_attribute("innerHTML")) > 1:
self.element_not_visible("select-form-option")
if len(popup_component.get_attribute("innerHTML")) > 1:
self.expect_element_attribute_contains(
"pop-up-component-box", "style", "0px;"
)
else:
self.expect_element_attribute_contains("pop-up-component", "hidden", "true")
return self

@BasePage.context_chrome
def ensure_autofill_dropdown_visible(self, field_element: WebElement = None):
def ensure_autofill_dropdown_visible(self):
"""
Verifies that the autofill dropdown appears
checks if the parent pop up component have children elements before explicit wait.

Arguments:
field_element: if field element is given.
check whether it is a select element. pass the check if it is.
checks if the parent pop up component has hidden attribute.
"""
self.element_exists("pop-up-component")
popup_component = self.get_element("pop-up-component")
if popup_component:
self.element_visible("select-form-option")
self.element_clickable("pop-up-component-box")
return self

@BasePage.context_chrome
def hover_over_autofill_panel(self):
self.element_visible("select-form-option")
self.hover("select-form-option")
return self

# Interaction with popup elements
Expand Down Expand Up @@ -103,12 +106,17 @@ def select_nth_element(self, index: int):
Arguments:
index (int): The index of the element to retrieve (1-based)
"""
self.wait.until(
EC.element_to_be_clickable(
self.get_element("select-form-option-by-index", labels=[str(index)])
)
)
self.get_element("select-form-option-by-index", labels=[str(index)]).click()
self.element_clickable("select-form-option-by-index", labels=[str(index)])
self.click_on("select-form-option-by-index", labels=[str(index)])

@BasePage.context_chrome
def select_autofill_panel(self):
"""
Select the first autofill panel in the autocomplete list.
"""
self.element_clickable("select-form-option-autofill")
self.click_on("select-form-option-autofill")
return self

@BasePage.context_chrome
def get_primary_value(self, element: WebElement) -> str:
Expand Down
Loading