Skip to content

Commit

Permalink
Merge pull request #32 from SalesforceFoundation/feature/robot_GAUExp…
Browse files Browse the repository at this point in the history
…enditure

[Robot] Test for GAU Expenditures
  • Loading branch information
gaganpsandhu authored Mar 4, 2021
2 parents ab63054 + 2e19495 commit 868b56f
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
7 changes: 7 additions & 0 deletions robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,3 +153,10 @@ def click_tab(self, label):
)
element = self.selenium.driver.find_element_by_xpath(locator)
self.selenium.driver.execute_script("arguments[0].click()", element)

def click_related_list_link_with_text(self, text):
"""Click on link with passed text in a related list table"""
locator = outboundfundsnpsp_lex_locators["related"]["related_link"].format(text)
self.selenium.wait_until_page_contains_element(locator)
element = self.selenium.driver.find_element_by_xpath(locator)
self.selenium.driver.execute_script("arguments[0].click()", element)
24 changes: 24 additions & 0 deletions robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,27 @@ API Create Disbursement on a Funding Request
&{disbursement} = Salesforce Get outfunds__Disbursement__c ${disbursement_id}
Store Session Record outfunds__disbursement__c ${disbursement_id}
[Return] &{disbursement}

API Create GAU
[Documentation] Create a GAU
[Arguments] &{fields}
${name} = Generate New String
${gau_id} = Salesforce Insert npsp__General_Accounting_Unit__c
... npsp__Active__c=true
... npsp__Total_Allocations__c=50000
... npsp__Description__c=Robot Test
... Name=${name}
&{gau} = Salesforce Get npsp__General_Accounting_Unit__c ${gau_id}
Store Session Record npsp__General_Accounting_Unit__c ${gau_id}
[Return] &{gau}

API Create GAU Expenditure
[Documentation] Create a GAU Expenditure on Disbursement
[Arguments] ${gau_id} ${disbursement_id} &{fields}
${gauexpenditure_id} = Salesforce Insert GAU_Expenditure__c
... Amount__c=10000
... General_Accounting_Unit__c=${gau_id}
... Disbursement__c=${disbursement_id}
&{gauexp} = Salesforce Get GAU_Expenditure__c ${gauexpenditure_id}
Store Session Record GAU_Expenditure__c ${gauexpenditure_id}
[Return] &{gauexp}
1 change: 1 addition & 0 deletions robot/OutboundFundsNPSP/resources/locators_51.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"button": "//div[contains(@class, 'forceRelatedListSingleContainer')][.//img][.//span[@title='{}']]//a[@title='{}']",
"count": "//tbody/tr/td[1]",
"flexi_button": "//div[@lst-listviewmanagerheader_listviewmanagerheader][.//span[@title='{}']]//lightning-button//button[text()='{}']",
"related_link": "//a//span[contains(text(),'{}')]",
},
"link": "//a[contains(text(),'{}')]",
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
*** Settings ***
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py

Suite Setup Run keywords
... Open Test Browser
... Setup Test Data
Suite Teardown Capture Screenshot And Delete Records And Close Browser

*** Keywords ***
Setup Test Data
${fundingprogram} = API Create Funding Program
Store Session Record outfunds__Funding_Program__c ${fundingprogram}[Id]
Set suite variable ${fundingprogram}
${contact} = API Create Contact
Store Session Record Contact ${contact}[Id]
Set suite variable ${contact}
${funding_request} = API Create Funding Request ${fundingprogram}[Id] ${contact}[Id]
Store Session Record outfunds__Funding_Request__c ${funding_request}[Id]
Set suite variable ${funding_request}
${disbursement} API Create Disbursement on a Funding Request ${funding_request}[Id]
Set Suite Variable ${disbursement}
&{gau}= API Create GAU
Set Suite Variable &{gau}
&{gau_exp}= API Create GAU Expenditure ${gau}[Id] ${disbursement}[Id]
Set Suite Variable &{gau_exp}

*** Test Case ***
Verify GAU Expenditure created is added on Disbursement

Go To Page Listing outfunds__Funding_Request__c
Click Link With Text ${funding_request}[Name]
Click Tab Disbursements
Click Related List Link with Text ${disbursement}[Name]
Click Tab GAU Expenditures
Click Related List Link with Text ${gau_exp}[Name]
Validate Field Value General Accounting Unit contains ${gau}[Name]
Validate Field Value Amount contains $10,000.00

0 comments on commit 868b56f

Please sign in to comment.