Skip to content

Commit

Permalink
Merge pull request #38 from SalesforceFoundation/feature/robot_disbur…
Browse files Browse the repository at this point in the history
…sements

 [Robot] Add Disbursement via Related list
  • Loading branch information
gaganpsandhu authored Mar 23, 2021
2 parents d192c34 + e1abf45 commit 422fbb6
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 10 deletions.
25 changes: 25 additions & 0 deletions robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,28 @@ def save_disbursement(self):
locator = outboundfundsnpsp_lex_locators["details"]["button"].format("Save")
self.selenium.set_focus_to_element(locator)
self.selenium.get_webelement(locator).click()

@capture_screenshot_on_error
def select_value_from_picklist(self, dropdown, value):
"""Select given value in the dropdown field"""
locator = outboundfundsnpsp_lex_locators["new_record"]["dropdown_field"].format(
dropdown
)
self.selenium.get_webelement(locator).click()
popup_loc = outboundfundsnpsp_lex_locators["new_record"]["dropdown_popup"]
self.selenium.wait_until_page_contains_element(
popup_loc, error="Picklist dropdown did not open"
)
value_loc = outboundfundsnpsp_lex_locators["new_record"][
"dropdown_value"
].format(value)
self.salesforce._jsclick(value_loc)

def add_date(self, title, date):
""" Clicks on the 'Date' field in Form and picks a date in the argument """
locator = outboundfundsnpsp_lex_locators["new_record"]["date_field"].format(
title
)
self.selenium.set_focus_to_element(locator)
self.selenium.clear_element_text(locator)
self.selenium.get_webelement(locator).send_keys(date)
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ API Create Funding Request
... ${ns}Requested_Amount__c=100000
... ${ns}FundingProgram__c=${funding_program_id}
... ${ns}Requested_For__c=Education
... ${ns}Application_Date__c=${application_date}
... ${ns}Requested_For__c=Robot Testing
... &{fields}
&{funding_request} = Salesforce Get ${ns}Funding_Request__c ${funding_request_id}
Store Session Record ${ns}Funding_Request__c ${funding_request_id}
Expand Down
4 changes: 2 additions & 2 deletions robot/OutboundFundsNPSP/resources/locators_51.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"list": "//div[contains(@class,'forcePageBlockSectionRow')]/div[contains(@class,'forcePageBlockItem')]/div[contains(@class,'slds-hint-parent')]/div[@class='slds-form-element__control']/div[.//span[text()='{}']][//div[contains(@class,'uiMenu')]//a[@class='select']]",
"text_field": "//div[contains(@class, 'uiInput')][.//label[contains(@class, 'uiLabel')][.//span[text()='{}']]]//*[self::input or self::textarea]",
"dropdown_field": "//lightning-combobox[./label[text()='{}']]/div//input[contains(@class,'combobox__input')]",
"dropdown_popup": "//div[contains(@class, 'slds-dropdown-trigger')]/div[contains(@class, 'slds-listbox')]",
"dropdown_value": "//div[contains(@class,'slds-listbox')]//lightning-base-combobox-item//span[text()='{}']",
"dd_selection": "//lightning-base-combobox-item[@data-value='{}']",
"button": "//button[contains(@class, 'slds-button') and text()='{}']",
Expand All @@ -22,8 +23,7 @@
"lookup_value": "//div[contains(@class, 'listContent')]//div[contains(@class, 'slds-truncate') and @title='{}']",
"checkbox": "//div[contains(@class,'uiInputCheckbox')]/label/span[text()='{}']/../following-sibling::input[@type='checkbox']",
"field_input": '//label[text()="{}"]/following-sibling::div//*[self::input or self::textarea]',
"open_date_picker": "//div[@class='slds-form-element__control']/div[.//span[text()='{}']]//div//a[contains(@class,'datePicker-openIcon display')]",
"datepicker_popup": "//table[@class='calGrid' and @role='grid']",
"date_field": "//div[contains(@class,'slds-dropdown-trigger')][./label[text()='{}']]/div/input",
"select_date": "//div[contains(@class,'uiDatePickerGrid')]/table[@class='calGrid']//*[text()='{}']",
"text-field": "//label/span[text()='{}']/../following-sibling::input",
"footer_button": "//lightning-button//button[text()='{}']",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*** Settings ***
Documentation Create Funding Program
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Resource robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingProgramPageObject.py
... robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py

Suite Setup Run keywords
... Open Test Browser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*** Settings ***
Documentation Create Funding Request, Add Disbursement on an Awarded Funding Request
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Resource robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py
... robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py

Suite Setup Run keywords
... Open Test Browser
Expand Down Expand Up @@ -34,6 +33,12 @@ Setup Test Data
Set suite variable ${fr_name}
${req_name} = Generate New String
Set suite variable ${req_name}
${date_1} = Get current date result_format=%m/%d/%Y increment=1 day
${date_2} = Get current date result_format=%m/%d/%Y increment=10 day
Set suite variable ${date_1}
Set suite variable ${date_2}



*** Test Case ***
Create Funding Request Via API
Expand All @@ -59,6 +64,11 @@ Create Funding Request via UI
Populate Field Funding Request Name ${fr_name}
Populate Lookup Field Funding Program ${fundingprogram}[Name]
Populate Lookup Field Applying Contact ${contact}[Name]
Add Date Application Date ${date_1}
Select Value from Picklist Status Submitted
Select Value from Picklist Geographical Area Served Region
Populate Field Requested Amount 10000
Populate Field Requested For Robot Testing
Click Save
wait until modal is closed
Current Page Should Be Details Funding_Request__c
Expand All @@ -82,4 +92,26 @@ Add a Disbursement on an awarded Funding Request
Save Disbursement
Current Page Should Be Details Funding_Request__c
Validate Field Value Unpaid Disbursements contains $80,000.00
Validate Field Value Available for Disbursement contains $20,000.00
Validate Field Value Available for Disbursement contains $20,000.00
Validate Field Value Unpaid Disbursements contains $80,000.00
Validate Field Value Available for Disbursement contains $20,000.00

Create a Disbursement on an Awarded Funding Request via Related List
[Documentation] Creates a Funding Request via API.
... Go to Disbursements and add a new Disbursement
[tags] feature:Funding Request Disbursements
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${awardedfunding_request}[Name]
Wait Until Loading Is Complete
Current Page Should Be Details Funding_Request__c
Click Tab Disbursements
click related list wrapper button Disbursements New
Wait For Modal New Disbursement
Populate Field Amount 10000
Select Value from Picklist Status Scheduled
Select Value from Picklist Type Initial
Select Value from Picklist Disbursement Method Check
Add Date Scheduled Date ${date_1}
Add Date Disbursement Date ${date_2}
Click Save

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*** Settings ***
Documentation Create GAU Expenditure
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Resource robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
*** Settings ***
Documentation Create Requirement on a Funding Request
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Resource robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py
... robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py

Suite Setup Run keywords
... Open Test Browser
Expand Down

0 comments on commit 422fbb6

Please sign in to comment.