Skip to content

Commit

Permalink
Merge pull request #46 from SalesforceFoundation/feature/robot_overexp
Browse files Browse the repository at this point in the history
Robot - Validate Error if GAU Expenditure is greater than available GAU
  • Loading branch information
gaganpsandhu authored Mar 31, 2021
2 parents 97dbc5a + e66eb46 commit 9e7616f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 9 deletions.
38 changes: 31 additions & 7 deletions robot/OutboundFundsNPSP/doc/Keywords.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,28 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
</td>
</tr>

<tr
class="kwrow"
id="OutboundFundsNPSP.py.Get Outboundfundsnpsp Locator"
>
<td class="kwname">Get Outboundfundsnpsp Locator</td>
<td class="kwargs">
<i>path</i>,

<i>*args</i>,

<i>**kwargs</i>
</td>
<td class="kwdoc">
<p>
Returns a rendered locator string from the
npsp_lex_locators dictionary. This can be useful
if you want to use an element in a different way
than the built in keywords allow.
</p>
</td>
</tr>

<tr
class="kwrow"
id="OutboundFundsNPSP.py.Get Outfundsnpsp Namespace Prefix"
Expand Down Expand Up @@ -403,7 +425,11 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">

<i>value</i>
</td>
<td class="kwdoc"></td>
<td class="kwdoc">
<p>
Populate field with id on manage expenditure page
</p>
</td>
</tr>

<tr class="kwrow" id="OutboundFundsNPSP.py.Random Email">
Expand Down Expand Up @@ -502,11 +528,9 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
</td>
<td class="kwdoc">
<p>
Verify the link is disabled/enabled, pass the name
of the link and the expected status of the link as
either enabled or disabled Eg: |Verify Link Status
| Update this Payment=enabled ... Update this
Opportunity=disabled |
Verify the button is disabled/enabled, pass the
name of the buttin and the expected status of the
buttin as either enabled or disabled
</p>
</td>
</tr>
Expand Down Expand Up @@ -1038,7 +1062,7 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot">
</div>
</div>
<div class="footer">
Generated on Wednesday March 24, 02:04 PM - cumulusci v3.28.0
Generated on Tuesday March 30, 09:16 AM - cumulusci v3.28.0
</div>
</body>
</html>
12 changes: 12 additions & 0 deletions robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,17 @@ def get_npsp_namespace_prefix(self):
gau_object = [o for o in objects if o["label"] == "General Accounting Unit"][0]
return self.get_namespace_prefix(gau_object["name"])

def get_outboundfundsnpsp_locator(self, path, *args, **kwargs):
""" Returns a rendered locator string from the npsp_lex_locators
dictionary. This can be useful if you want to use an element in
a different way than the built in keywords allow.
"""
locator = outboundfundsnpsp_lex_locators
for key in path.split("."):
locator = locator[key]
main_loc = locator.format(*args, **kwargs)
return main_loc

def _check_if_element_exists(self, xpath):
"""Checks if the given xpath exists
this is only a helper function being called from other keywords
Expand Down Expand Up @@ -150,6 +161,7 @@ def click_save(self):
)
self.selenium.scroll_element_into_view(locator)
self.salesforce._jsclick(locator)
self.salesforce.wait_until_loading_is_complete()

@capture_screenshot_on_error
def validate_field_value(self, field, status, value, section=None):
Expand Down
1 change: 1 addition & 0 deletions robot/OutboundFundsNPSP/resources/locators_51.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
"link": "//a[contains(text(),'{}')]",
"id": "//input[@type='text' and @inputmode='decimal' and @step='0.01']",
"button-with-text": "//button[contains(text(),'{}')]",
"error_locator": "//div[@class='INVALID']//lightning-formatted-number[contains(text(),'-')]",
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ Setup Test Data
... ${ns}Status__c=Paid
Set Suite Variable ${fully_disbursed}
&{gau_paid}= API Create GAU Expenditure ${gau}[Id]
... ${fully_disbursed}[Id]
Set Suite Variable ${gau_paid}
... ${fully_disbursed}[Id]
Set Suite Variable ${gau_paid}

*** Test Case ***
Verify GAU Expenditure created is added on Disbursement
[Documentation] Create GAU Expenditure via API and
... verify record is added on Disbursement Record
[tags] feature:GAUExpenditure
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${funding_request}[Name]
Click Tab Disbursements
Expand All @@ -68,6 +69,7 @@ Verify GAU Expenditure created is added on Disbursement
Verify GAU Expenditure on Paid Disbursement
[Documentation] Create a Disbursement and set status to Paid
... Verify Manage Expenditure is disabled
[tags] feature:GAUExpenditure
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${disbursed_request}[Name]
Click Tab Disbursements
Expand All @@ -79,6 +81,7 @@ Verify GAU Expenditure on Paid Disbursement
Verify GAU Expenditure on Canceled Disbursement
[Documentation] Create a Disbursement and set status to Canceled
... Verify Manage Expenditure is disabled
[tags] feature:GAUExpenditure
${cancel_disbursed} API Create Disbursement on a Funding Request
... ${disbursed_request}[Id]
... ${ns}Status__c=Cancelled
Expand All @@ -89,3 +92,27 @@ Verify GAU Expenditure on Canceled Disbursement
Click Related List Link with Text ${cancel_disbursed}[Name]
Click Tab GAU Expenditures
Verify Button Status Save Updates=disabled

Verify error if GAU Expenditure > GAU available
[Documentation] Create a Disbursement and set status to Canceled
... Verify Manage Expenditure is disabled
[tags] feature:GAUExpenditure
${scheduled_disbursement} API Create Disbursement on a Funding Request
... ${funding_request}[Id]
... ${ns}Status__c=Scheduled
&{gau_new}= API Create GAU
... ${ns_npsp}Total_Allocations__c=10000
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${funding_request}[Name]
Click Tab Disbursements
Click Related List Link with Text ${scheduled_disbursement}[Name]
Click Tab GAU Expenditures
click related list wrapper button GAU Expenditures New
Populate Lookup Field General Accounting Unit ${gau_new}[Name]
Populate Field Amount 11000
Click Save
Reload Page
Click Tab GAU Expenditures
Verify Button Status Save Updates=disabled
${field} Get Outboundfundsnpsp Locator error_locator
Page Should Contain Element ${field}

0 comments on commit 9e7616f

Please sign in to comment.