Skip to content

Commit 9e7616f

Browse files
authored
Merge pull request #46 from SalesforceFoundation/feature/robot_overexp
Robot - Validate Error if GAU Expenditure is greater than available GAU
2 parents 97dbc5a + e66eb46 commit 9e7616f

4 files changed

Lines changed: 73 additions & 9 deletions

File tree

robot/OutboundFundsNPSP/doc/Keywords.html

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,28 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
343343
</td>
344344
</tr>
345345

346+
<tr
347+
class="kwrow"
348+
id="OutboundFundsNPSP.py.Get Outboundfundsnpsp Locator"
349+
>
350+
<td class="kwname">Get Outboundfundsnpsp Locator</td>
351+
<td class="kwargs">
352+
<i>path</i>,
353+
354+
<i>*args</i>,
355+
356+
<i>**kwargs</i>
357+
</td>
358+
<td class="kwdoc">
359+
<p>
360+
Returns a rendered locator string from the
361+
npsp_lex_locators dictionary. This can be useful
362+
if you want to use an element in a different way
363+
than the built in keywords allow.
364+
</p>
365+
</td>
366+
</tr>
367+
346368
<tr
347369
class="kwrow"
348370
id="OutboundFundsNPSP.py.Get Outfundsnpsp Namespace Prefix"
@@ -403,7 +425,11 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
403425

404426
<i>value</i>
405427
</td>
406-
<td class="kwdoc"></td>
428+
<td class="kwdoc">
429+
<p>
430+
Populate field with id on manage expenditure page
431+
</p>
432+
</td>
407433
</tr>
408434

409435
<tr class="kwrow" id="OutboundFundsNPSP.py.Random Email">
@@ -502,11 +528,9 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py">
502528
</td>
503529
<td class="kwdoc">
504530
<p>
505-
Verify the link is disabled/enabled, pass the name
506-
of the link and the expected status of the link as
507-
either enabled or disabled Eg: |Verify Link Status
508-
| Update this Payment=enabled ... Update this
509-
Opportunity=disabled |
531+
Verify the button is disabled/enabled, pass the
532+
name of the buttin and the expected status of the
533+
buttin as either enabled or disabled
510534
</p>
511535
</td>
512536
</tr>
@@ -1038,7 +1062,7 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot">
10381062
</div>
10391063
</div>
10401064
<div class="footer">
1041-
Generated on Wednesday March 24, 02:04 PM - cumulusci v3.28.0
1065+
Generated on Tuesday March 30, 09:16 AM - cumulusci v3.28.0
10421066
</div>
10431067
</body>
10441068
</html>

robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ def get_npsp_namespace_prefix(self):
9696
gau_object = [o for o in objects if o["label"] == "General Accounting Unit"][0]
9797
return self.get_namespace_prefix(gau_object["name"])
9898

99+
def get_outboundfundsnpsp_locator(self, path, *args, **kwargs):
100+
""" Returns a rendered locator string from the npsp_lex_locators
101+
dictionary. This can be useful if you want to use an element in
102+
a different way than the built in keywords allow.
103+
"""
104+
locator = outboundfundsnpsp_lex_locators
105+
for key in path.split("."):
106+
locator = locator[key]
107+
main_loc = locator.format(*args, **kwargs)
108+
return main_loc
109+
99110
def _check_if_element_exists(self, xpath):
100111
"""Checks if the given xpath exists
101112
this is only a helper function being called from other keywords
@@ -150,6 +161,7 @@ def click_save(self):
150161
)
151162
self.selenium.scroll_element_into_view(locator)
152163
self.salesforce._jsclick(locator)
164+
self.salesforce.wait_until_loading_is_complete()
153165

154166
@capture_screenshot_on_error
155167
def validate_field_value(self, field, status, value, section=None):

robot/OutboundFundsNPSP/resources/locators_51.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@
5353
"link": "//a[contains(text(),'{}')]",
5454
"id": "//input[@type='text' and @inputmode='decimal' and @step='0.01']",
5555
"button-with-text": "//button[contains(text(),'{}')]",
56+
"error_locator": "//div[@class='INVALID']//lightning-formatted-number[contains(text(),'-')]",
5657
}

robot/OutboundFundsNPSP/tests/browser/GAUExpenditure/GAUExpenditure.robot

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,14 @@ Setup Test Data
4949
... ${ns}Status__c=Paid
5050
Set Suite Variable ${fully_disbursed}
5151
&{gau_paid}= API Create GAU Expenditure ${gau}[Id]
52-
... ${fully_disbursed}[Id]
53-
Set Suite Variable ${gau_paid}
52+
... ${fully_disbursed}[Id]
53+
Set Suite Variable ${gau_paid}
5454

5555
*** Test Case ***
5656
Verify GAU Expenditure created is added on Disbursement
5757
[Documentation] Create GAU Expenditure via API and
5858
... verify record is added on Disbursement Record
59+
[tags] feature:GAUExpenditure
5960
Go To Page Listing ${ns}Funding_Request__c
6061
Click Link With Text ${funding_request}[Name]
6162
Click Tab Disbursements
@@ -68,6 +69,7 @@ Verify GAU Expenditure created is added on Disbursement
6869
Verify GAU Expenditure on Paid Disbursement
6970
[Documentation] Create a Disbursement and set status to Paid
7071
... Verify Manage Expenditure is disabled
72+
[tags] feature:GAUExpenditure
7173
Go To Page Listing ${ns}Funding_Request__c
7274
Click Link With Text ${disbursed_request}[Name]
7375
Click Tab Disbursements
@@ -79,6 +81,7 @@ Verify GAU Expenditure on Paid Disbursement
7981
Verify GAU Expenditure on Canceled Disbursement
8082
[Documentation] Create a Disbursement and set status to Canceled
8183
... Verify Manage Expenditure is disabled
84+
[tags] feature:GAUExpenditure
8285
${cancel_disbursed} API Create Disbursement on a Funding Request
8386
... ${disbursed_request}[Id]
8487
... ${ns}Status__c=Cancelled
@@ -89,3 +92,27 @@ Verify GAU Expenditure on Canceled Disbursement
8992
Click Related List Link with Text ${cancel_disbursed}[Name]
9093
Click Tab GAU Expenditures
9194
Verify Button Status Save Updates=disabled
95+
96+
Verify error if GAU Expenditure > GAU available
97+
[Documentation] Create a Disbursement and set status to Canceled
98+
... Verify Manage Expenditure is disabled
99+
[tags] feature:GAUExpenditure
100+
${scheduled_disbursement} API Create Disbursement on a Funding Request
101+
... ${funding_request}[Id]
102+
... ${ns}Status__c=Scheduled
103+
&{gau_new}= API Create GAU
104+
... ${ns_npsp}Total_Allocations__c=10000
105+
Go To Page Listing ${ns}Funding_Request__c
106+
Click Link With Text ${funding_request}[Name]
107+
Click Tab Disbursements
108+
Click Related List Link with Text ${scheduled_disbursement}[Name]
109+
Click Tab GAU Expenditures
110+
click related list wrapper button GAU Expenditures New
111+
Populate Lookup Field General Accounting Unit ${gau_new}[Name]
112+
Populate Field Amount 11000
113+
Click Save
114+
Reload Page
115+
Click Tab GAU Expenditures
116+
Verify Button Status Save Updates=disabled
117+
${field} Get Outboundfundsnpsp Locator error_locator
118+
Page Should Contain Element ${field}

0 commit comments

Comments
 (0)