Skip to content
This repository has been archived by the owner on Jan 25, 2025. It is now read-only.

Commit

Permalink
Merge pull request #1498 from SalesforceFoundation/feature/robot_acco…
Browse files Browse the repository at this point in the history
…unts_contacts_settings

[Robot] Verify accounts and contacts checkboxes can retain values on save
  • Loading branch information
rhakeshj authored Jan 15, 2021
2 parents b793d9f + 1ee64b8 commit 686bb6a
Show file tree
Hide file tree
Showing 14 changed files with 139 additions and 20 deletions.
66 changes: 66 additions & 0 deletions robot/EDA/resources/AccountsAndContactsSettingsPageObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from cumulusci.robotframework.pageobjects import BasePage
from cumulusci.robotframework.pageobjects import pageobject
from selenium.webdriver.common.keys import Keys
import time


@pageobject("Accounts_and_Contacts", "HEDA_Settings")
Expand Down Expand Up @@ -214,3 +215,68 @@ def update_disable_preferred_phone_checkbox_value(self,**kwargs):
self.selenium.wait_until_page_contains_element(locator)
self.selenium.wait_until_element_is_visible(locator)
self.salesforce._jsclick(locator)

def set_checkbox_value(self,**kwargs):
""" This method will set the value of a checkbox using the key value pairs passed from
the test. Checked - true, unchecked - false
"""
for field,value in kwargs.items():
locator = eda_lex_locators["eda_settings_accounts_contacts"]["checkbox_value"].format(field)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
self.selenium.wait_until_element_is_visible(locator)
actual_value = self.selenium.get_element_attribute(locator, "data-qa-checkbox-state")
self.builtin.log("Locator " + locator + "actual value is " + actual_value)
if not str(actual_value).lower() == str(value).lower():
for i in range(3):
self.builtin.log("Iteration: " + str(i) + "for locator" + locator)
self.selenium.click_element(locator)
time.sleep(1)
actual_value = self.selenium.get_element_attribute(locator, "data-qa-checkbox-state")
if actual_value == str(value).lower():
self.builtin.log("The checkbox value in edit mode is" + actual_value)
self.builtin.log("Updated locator " + locator)
break
else:
continue

def set_multi_account_contact_checkbox(self,**kwargs):
""" This method will set the value of checkboxes present under 'Account Types with Multi
Addresses Enabled' and 'Account Types without Contacts to Delete' based on the key
value pairs passed from the test. Checked - true, Unchecked - false.
"""
for field,value in kwargs.items():
locator = eda_lex_locators["eda_settings_accounts_contacts"]["checkbox_list"].format(field)
elements = self.selenium.get_webelements(locator)
if not len(elements) == 0:
for element in elements:
self.selenium.wait_until_page_contains_element(element, timeout=60)
self.selenium.wait_until_element_is_visible(element)
actual_value = self.selenium.get_element_attribute(element, "data-qa-checkbox-state")
if not str(actual_value).lower() == str(value).lower():
for i in range(3):
self.builtin.log("Iteration: " + str(i))
self.selenium.click_element(element)
time.sleep(1)
actual_value = self.selenium.get_element_attribute(element, "data-qa-checkbox-state")
if actual_value == str(value).lower():
self.builtin.log("The checkbox value in edit mode is" + actual_value)
break
else:
continue

def verify_multi_account_contact_checkbox(self,**kwargs):
""" This method will verify the value of checkboxes present under 'Account Types with Multi
Addresses Enabled' and 'Account Types without Contacts to Delete' based on the key
value pairs passed from the test. Checked - true, Unchecked - false.
"""
for field,value in kwargs.items():
locator = eda_lex_locators["eda_settings_accounts_contacts"]["checkbox_list_read"].format(field)
elements = self.selenium.get_webelements(locator)
if not len(elements) == 0:
for element in elements:
self.selenium.wait_until_page_contains_element(element, timeout=60)
self.selenium.wait_until_element_is_visible(element)
actual_value = self.selenium.get_element_attribute(element, "alt")
if not str(value).lower() == str(actual_value).lower() :
raise Exception (f"Checkbox value in {field} is {actual_value} but it should be {value}")

11 changes: 6 additions & 5 deletions robot/EDA/resources/EDA.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ def update_checkbox_value(self,**kwargs):
"""
for field,value in kwargs.items():
locator = eda_lex_locators["eda_settings_program_plans"]["checkbox_read"].format(field)
self.selenium.wait_until_page_contains_element(locator)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
self.selenium.wait_until_element_is_visible(locator)
actual_value = self.selenium.get_element_attribute(locator, "alt")
self.builtin.log("Locator " + locator + "actual value is " + actual_value)
Expand All @@ -430,15 +430,16 @@ def update_checkbox_value(self,**kwargs):
self.selenium.wait_until_page_contains_element(locator_edit,
error=f"'{locator_edit}' is not available ")
for i in range(3):
i += 1
self.salesforce._jsclick(locator_edit)
self.builtin.log("Iteration: " + str(i) + "for locator" + locator_edit)
self.selenium.click_element(locator_edit)
time.sleep(1)
actual_value = self.selenium.get_element_attribute(locator_edit, "data-qa-checkbox-state")
if actual_value == str(value).lower():
self.builtin.log("The checkbox value in edit mode is" + actual_value)
self.builtin.log("Updated locator " + locator_edit)
break
self.click_action_button_on_eda_settings_page("Save")
time.sleep(0.25) #This wait is necessary to avoid toast message inconsistencies

def update_dropdown_value(self,**kwargs):
""" This method will update the drop down field value passed in keyword arguments
Expand Down Expand Up @@ -469,7 +470,7 @@ def verify_dropdown_field_status(self, **kwargs):
"""
for field,expected_value in kwargs.items():
locator = eda_lex_locators["eda_settings"]["dropdown_field"].format(field)
self.selenium.page_should_contain_element(locator)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
self.selenium.wait_until_element_is_visible(locator,
error= f"Element '{field}' is not displayed for the user")
actual_value = self.selenium.get_webelement(locator).get_attribute(expected_value)
Expand Down Expand Up @@ -502,7 +503,7 @@ def verify_dropdown_value(self,**kwargs):
"""
for field,expected_value in kwargs.items():
locator = eda_lex_locators["eda_settings_system"]["default_dropdown_value"].format(field,expected_value)
self.selenium.page_should_contain_element(locator)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
self.selenium.wait_until_element_is_visible(locator,
error= "Element is not displayed for the user")
actual_value = self.selenium.get_webelement(locator).text
Expand Down
1 change: 1 addition & 0 deletions robot/EDA/resources/RelationshipsSettingsPageObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def update_reciprocal_method_value(self,**kwargs):
error=f"'{locator_edit}' is not available ")
self.selenium.click_element(locator_edit)
self.eda.click_action_button_on_eda_settings_page("Save")
time.sleep(0.5) #This wait is necessary to avoid inconsistency display of toast message

def set_reciprocal_setting_status(self,**kwargs):
""" This method will set the active checkbox status to active/inactive
Expand Down
4 changes: 2 additions & 2 deletions robot/EDA/resources/SystemSettingsPageObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def verify_admin_toast_message(self, value):
""" Verifies the admin toast message """
locator = eda_lex_locators["eda_settings_system"]["admin_success_toast"]
time.sleep(0.5) # This wait is needed for the toast message validation
self.selenium.wait_until_page_contains_element(locator)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
actual_value = self.selenium.get_webelement(locator).text
self.builtin.log("Toast message :" + actual_value)
if not str(value).lower() == str(actual_value).lower() :
Expand All @@ -83,7 +83,7 @@ def verify_household_toast_message(self, value):
""" Verifies the household specific toast message """
locator = eda_lex_locators["eda_settings_system"]["hh_success_toast"]
time.sleep(0.5) # This wait is needed for the toast message validation
self.selenium.wait_until_page_contains_element(locator)
self.selenium.wait_until_page_contains_element(locator, timeout=60)
actual_value = self.selenium.get_webelement(locator).text
self.builtin.log("Toast message :" + actual_value)
if not str(value).lower() == str(actual_value).lower() :
Expand Down
3 changes: 3 additions & 0 deletions robot/EDA/resources/locators_50.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@
},
"eda_settings_accounts_contacts": {
"checkbox": "//span[text()='{}']/following::div[1]/descendant::span[text()='{}']/parent::label/span[contains(@class, 'checkbox')]",
"checkbox_value": "//span[text()='{}']/following::label[1][contains(@class, 'checkbox')]/span[contains(@class, 'checkbox')]",
"checkbox_list": "//span[text()='{}']/../../following-sibling::div[1]/descendant::span[contains(@class, 'checkbox')]",
"checkbox_list_read": "//span[text()='{}']/../../following-sibling::div[1]/descendant::img",
},
"eda_settings_relationships": {
"dropdown_read": "//span[text()='{}']/../following-sibling::div[1]/descendant::span",
Expand Down
46 changes: 45 additions & 1 deletion robot/EDA/tests/browser/settings/accounts_contacts.robot
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,48 @@ Verify disable preferred phone enforcement shows and hides as expected
Verify checkbox value
... Enable Enhanced Preferred Phone Functionality=false
Verify disable preferred phone enforcement displayed
... Disable Preferred Phone Enforcement=false
... Disable Preferred Phone Enforcement=false

Validate all checkboxes can retain value on save in accounts and contacts settings
[Documentation] Validates that all checkbox fields in accounts and contacts settings
... page retains value after clicking on save button. The status of checkbox
... is true if checked and false if unchecked
[tags] unstable W-8620850 rbt:high
Click action button on EDA settings page Edit
Set checkbox value
... Disable Preferred Email Enforcement=true
... Enable Enhanced Preferred Phone Functionality=true
... Disable Preferred Phone Enforcement=true
... Contact Multi-Addresses Enabled=true
... Simple Address Change Treated as Update=true
Set multi account contact checkbox
... Account Types with Multi-Addresses Enabled=true
... Account Types without Contacts to Delete=true
Click action button on EDA settings page Save
Verify checkbox value
... Disable Preferred Email Enforcement=true
... Enable Enhanced Preferred Phone Functionality=true
... Disable Preferred Phone Enforcement=true
... Contact Multi-Addresses Enabled=true
... Simple Address Change Treated as Update=true
Verify multi account contact checkbox
... Account Types with Multi-Addresses Enabled=true
... Account Types without Contacts to Delete=true
Click action button on EDA settings page Edit
Set checkbox value
... Disable Preferred Email Enforcement=false
... Enable Enhanced Preferred Phone Functionality=false
... Contact Multi-Addresses Enabled=false
... Simple Address Change Treated as Update=false
Set multi account contact checkbox
... Account Types with Multi-Addresses Enabled=false
... Account Types without Contacts to Delete=false
Click action button on EDA settings page Save
Verify checkbox value
... Disable Preferred Email Enforcement=false
... Enable Enhanced Preferred Phone Functionality=false
... Contact Multi-Addresses Enabled=false
... Simple Address Change Treated as Update=false
Verify multi account contact checkbox
... Account Types with Multi-Addresses Enabled=false
... Account Types without Contacts to Delete=false
5 changes: 3 additions & 2 deletions robot/EDA/tests/browser/settings/course_connections.robot
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Validate drop down values appear when checkbox is unchecked
... unchecked. Checks the dropdown field is disabled for Default Active
... Student Record Type and Default Faculty Record Type. The value of the
... dropdown field status is True when disbaled and False when enabled.
[tags] unstable W-041782 rbt:high
[tags] W-041782 rbt:high
Go to EDA settings tab Course Connections
Click action button on EDA settings page Edit
Verify enable course connections warning true
Sleep 10
Expand All @@ -33,7 +34,7 @@ Validate Edit Mode For Course Connections, Settings
... connections, Default Active Student Record Type and Default Faculty
... Record Type are reatined upon saving which also includes the validation
... of fields in non edit mode.
[tags] unstable W-041783 W-041784 rbt:high
[tags] W-041783 W-041784 rbt:high
Click action button on EDA settings page Edit
Verify enable course connections warning true
Set enable course connections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Verify backfill settings error message when course connections is unchecked
... warning message banner is displayed in the backfill tab. Verifies the
... checkbox "I understand and am ready to run backfill" is not checked.
... Checks the button "Run Backfill" is not active.
[tags] unstable W-041785 rbt:high
[tags] W-041785 rbt:high
Update enable cc to default
Verify enable course connections false
Select course connections subtab Backfill
Expand All @@ -27,7 +27,7 @@ Verify backfill settings error message when course connections is unchecked
Verify backfill field functionality when course connections is enabled
[Documentation] Checks enable course connection is enabled and then verifies the
... backfill field functionality
[tags] unstable W-8448330 rbt:high
[tags] W-8448330 rbt:high
Click action button on EDA settings page Edit
Set enable course connections
Click action button on EDA settings page Save
Expand Down
2 changes: 1 addition & 1 deletion robot/EDA/tests/browser/settings/courses.robot
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Validate run copy button is active in read and edit mode
... and edit mode. Also validates the text "The process was queued
... successfully. An email will be sent at the completion of the job."
... appears after the button is clicked in both modes.
[tags] unstable W-041780 rbt:high
[tags] W-041780 rbt:high
Click run action button Run Copy
Verify text appears
... The process was queued successfully. An email will be sent at the completion of the job.
Expand Down
2 changes: 1 addition & 1 deletion robot/EDA/tests/browser/settings/hierarchy_settings.robot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Test Teardown Go to custom settings setup
Validate hierarchy settings under custom settings
[Documentation] Checks set up owner under hierarchy settings to make sure 'User User' is not
... displayed.
[tags] unstable W-8448341 rbt:high
[tags] W-8448341 rbt:high
Go to EDA settings tab Accounts and Contacts
Click action button on EDA settings page Edit
Select accounts contacts checkbox
Expand Down
4 changes: 3 additions & 1 deletion robot/EDA/tests/browser/settings/relationships.robot
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ Library cumulusci.robotframework.PageObjects
Suite Setup Open Test Browser
Suite Teardown Capture screenshot and delete records and close browser

Test Setup Go to EDA settings tab Relationships
Test Setup Run keywords
... Go to EDA settings tab Relationships AND
... Go to relationships sub tab Settings

*** Test Cases ***
Verify relationship settings can retain values on save
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Delete inserted data
Verify autocreation relationship settings can be added in both read and edit mode
[Documentation] Validates autocreation settings can be added in read and edit mode. Also
... checks if those values are retained after save.
[tags] unstable W-8380706 rbt:high
[tags] W-8380706 rbt:high
Enter new autocreate setting
... Object API Name=Campaign Member
... Field Label=Referee__c
Expand Down Expand Up @@ -64,7 +64,7 @@ Verify autocreation relationship settings can be added in both read and edit mod

Verify autocreation relationship settings can be deleted
[Documentation] Validates autocreation settings can be deleted.
[tags] unstable W-8380720 rbt:high
[tags] W-8380720 rbt:high
Click action button on EDA settings page Edit
Click delete setting icon Object=Campaign Member
Handle alert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Delete inserted data
Verify reciprocal relationship settings can be added in both read and edit mode
[Documentation] Validates reciprocal settings can be added in read and edit mode. Also
... checks if those values are retained after save.
[tags] unstable W-8214822 rbt:high
[tags] W-8214822 rbt:high
Enter new reciprocal setting
... Name=Name
... Female=Female
Expand Down Expand Up @@ -97,7 +97,7 @@ Verify reciprocal relationship settings can be added in both read and edit mode
Verify reciprocal relationship settings can be deleted
[Documentation] Validates reciprocal settings can be deleted. Also checks if those
... values are retained after save.
[tags] unstable W-8245483 rbt:high
[tags] W-8245483 rbt:high
Click action button on EDA settings page Edit
Click delete setting icon Name=Name1
Handle alert
Expand All @@ -110,7 +110,7 @@ Verify reciprocal relationship settings can be deleted
Verify existing reciprocal setting can be edited and values retained on save
[Documentation] Validates reciprocal settings can be updated. Also checks if those
... values are retained after save.
[tags] unstable W-8251460 rbt:high
[tags] W-8251460 rbt:high
Click action button on EDA settings page Edit
Update existing reciprocal setting column=Name1
... Name=Name1
Expand Down
Loading

0 comments on commit 686bb6a

Please sign in to comment.