Skip to content

Commit

Permalink
Merge pull request #39 from SalesforceFoundation/feature/robot_lint
Browse files Browse the repository at this point in the history
[Robot] Fixing robot lint errors and warnings
  • Loading branch information
gaganpsandhu authored Mar 16, 2021
2 parents 43ee97f + 125ce4e commit d192c34
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 43 deletions.
4 changes: 2 additions & 2 deletions robot/OutboundFundsNPSP/doc/Keywords.html
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot">
<p>
Adds or removes the Create, Read, Edit and Delete
permissions for the specified object on the
specified permission set..
specified permission set.
</p>
</td>
</tr>
Expand Down Expand Up @@ -910,7 +910,7 @@ <h2 title="robot/OutboundFundsNPSP/resources/OutboundFundsNPSP.robot">
</div>
</div>
<div class="footer">
Generated on Thursday March 11, 03:15 PM - cumulusci v3.28.0
Generated on Tuesday March 16, 09:40 AM - cumulusci v3.30.0
</div>
</body>
</html>
40 changes: 27 additions & 13 deletions robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ API Create GAU Expenditure
[Return] &{gauexp}

Change Object Permissions
[Documentation] Adds or removes the Create, Read, Edit and Delete permissions for the specified object on the specified permission set..
[Documentation] Adds or removes the Create, Read, Edit and Delete
... permissions for the specified object on the specified permission set.
[Arguments] ${action} ${objectapiname} ${permset}


${removeobjperms} = Catenate SEPARATOR=\n
... ObjectPermissions objperm;
... objperm = [SELECT Id, PermissionsRead, PermissionsEdit, PermissionsCreate, PermissionsDelete FROM ObjectPermissions
... objperm = [SELECT Id, PermissionsRead, PermissionsEdit, PermissionsCreate,
... PermissionsDelete FROM ObjectPermissions
... WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}')
... AND SobjectType='${objectapiname}'];
... objperm.PermissionsRead = false;
Expand All @@ -165,7 +167,8 @@ Change Object Permissions

${addobjperms} = Catenate SEPARATOR=\n
... String permid = [SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}'].id;
... ObjectPermissions objperm = New ObjectPermissions(PermissionsRead = true, PermissionsEdit = true, PermissionsCreate = true,
... ObjectPermissions objperm = New ObjectPermissions(PermissionsRead = true,
... PermissionsEdit = true, PermissionsCreate = true,
... PermissionsDelete = true, ParentId = permid, SobjectType='${objectapiname}');
... insert objperm;

Expand All @@ -178,7 +181,8 @@ Change Object Permissions
... apex= ${addobjperms}

Change Field Permissions
[Documentation] Adds or removes the Create, Read, Edit and Delete permissions for the specified object field on the specified permission set.
[Documentation] Adds or removes the Create, Read, Edit and Delete permissions
... for the specified object field on the specified permission set.
[Arguments] ${action} ${objectapiname} ${fieldapiname} ${permset}

${removefieldperms} = Catenate SEPARATOR=\n
Expand All @@ -193,8 +197,10 @@ Change Field Permissions

${addfieldperms} = Catenate SEPARATOR=\n
... String permid = [SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}'].id;
... FieldPermissions fldperm = New FieldPermissions(PermissionsRead = true, PermissionsEdit = true,
... ParentId = permid, Field = '${objectapiname}.${fieldapiname}', SobjectType='${objectapiname}');
... FieldPermissions fldperm = New FieldPermissions(PermissionsRead = true,
... PermissionsEdit = true,
... ParentId = permid, Field = '${objectapiname}.${fieldapiname}',
... SobjectType='${objectapiname}');
... insert fldperm;

Run Keyword if "${action}" == "remove"
Expand All @@ -206,36 +212,44 @@ Change Field Permissions
... apex= ${addfieldperms}

Object Permissions Cleanup
[Documentation] Resets all object permissions in case a test fails before they are restored. Skips the reset if the permissions have already been added back.
[Documentation] Resets all object permissions in case a test fails before they are
... restored. Skips the reset if the permissions have already been added back.
[Arguments] ${objectapiname} ${permset}

${addobjback} = Catenate SEPARATOR=\n
... List<ObjectPermissions> checkperms = [SELECT PermissionsRead FROM ObjectPermissions
... WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}') AND
... WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}')
... AND
... SobjectType = '${objectapiname}'];
... if (checkperms.isEmpty()) {
... String permid = [SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}'].id;
... ObjectPermissions objperm = New ObjectPermissions(PermissionsRead = true, PermissionsEdit = true, PermissionsCreate = true,
... ObjectPermissions objperm = New ObjectPermissions(PermissionsRead = true,
... PermissionsEdit = true,
... PermissionsCreate = true,
... PermissionsDelete = true, ParentId = permid, SobjectType = '${objectapiname}');
... insert objperm; }
... else { System.debug('Permissions Exist, skipping.'); }

Run Task execute_anon apex=${addobjback}

Field Permissions Cleanup
[Documentation] Resets all field permissions in case a test fails before they are restored. Skips the reset if the permissions have already been added back.
[Documentation] Resets all field permissions in case a test fails before they are restored.
... Skips the reset if the permissions have already been added back.
[Arguments] ${objectapiname} ${fieldapiname} ${permset}

${ns} = Get NPSP Namespace Prefix

${addfieldback} = Catenate SEPARATOR=\n
... List<FieldPermissions> checkperms = [SELECT PermissionsRead FROM FieldPermissions
... WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}') AND
... WHERE parentId IN ( SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}')
... AND
... SobjectType = '${objectapiname}' AND Field = '${objectapiname}.${fieldapiname}'];
... if (checkperms.isEmpty()) {
... String permid = [SELECT id FROM permissionset WHERE PermissionSet.Name = '${permset}'].id;
... FieldPermissions fldperm = New FieldPermissions(PermissionsRead = true, PermissionsEdit = true,
... ParentId = permid, Field = '${objectapiname}.${fieldapiname}', SobjectType = '${objectapiname}');
... FieldPermissions fldperm = New FieldPermissions(PermissionsRead = true,
... PermissionsEdit = true,
... ParentId = permid, Field = '${objectapiname}.${fieldapiname}',
... SobjectType = '${objectapiname}');
... insert fldperm; }
... else { System.debug('Permissions Exist, skipping.'); }

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*** Settings ***

Documentation Create Funding Program
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingProgramPageObject.py
Expand All @@ -12,6 +12,7 @@ Suite Teardown Capture Screenshot And Delete Records And Close Browser

*** Keywords ***
Setup Test Data
[Documentation] Create data to run tests
${ns} = Get Outfundsnpsp Namespace Prefix
Set suite variable ${ns}
&{fundingprogram} = API Create Funding Program
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*** Settings ***

Documentation Create Funding Request, Add Disbursement on an Awarded Funding Request
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py
Expand All @@ -12,20 +12,23 @@ Suite Teardown Capture Screenshot And Delete Records And Close Browser

*** Keywords ***
Setup Test Data
[Documentation] Create data to run tests
${ns} = Get Outfundsnpsp Namespace Prefix
Set suite variable ${ns}
${fundingprogram} = API Create Funding Program
Store Session Record ${ns}Funding_Program__c ${fundingprogram}[Id]
Set suite variable ${fundingprogram}
${contact} = API Create Contact
Store Session Record Contact ${contact}[Id]
Store Session Record Contact ${contact}[Id]
Set suite variable ${contact}
${funding_request} = API Create Funding Request ${fundingprogram}[Id] ${contact}[Id]
${funding_request} = API Create Funding Request
... ${fundingprogram}[Id] ${contact}[Id]
Store Session Record ${ns}Funding_Request__c ${funding_request}[Id]
Set suite variable ${funding_request}
${awardedfunding_request} = API Create Funding Request ${fundingprogram}[Id] ${contact}[Id]
... ${ns}Status__c=Awarded ${ns}Awarded_Amount__c=100000
Store Session Record ${ns}Funding_Request__c ${awardedfunding_request}[Id]
${awardedfunding_request} = API Create Funding Request
... ${fundingprogram}[Id] ${contact}[Id]
... ${ns}Status__c=Awarded ${ns}Awarded_Amount__c=100000
Store Session Record ${ns}Funding_Request__c ${awardedfunding_request}[Id]
Set suite variable ${awardedfunding_request}
${fr_name} = Generate New String
Set suite variable ${fr_name}
Expand All @@ -43,7 +46,8 @@ Create Funding Request Via API
Wait Until Loading Is Complete
Current Page Should Be Details Funding_Request__c
Validate Field Value Status contains In progress
Validate Field Value Funding Request Name contains ${funding_request}[Name]
Validate Field Value Funding Request Name contains
... ${funding_request}[Name]

Create Funding Request via UI
[Documentation] Creates a Funding Request via UI.
Expand All @@ -58,12 +62,12 @@ Create Funding Request via UI
Click Save
wait until modal is closed
Current Page Should Be Details Funding_Request__c
Validate Field Value Funding Request Name contains ${fr_name}
Validate Field Value Funding Request Name contains ${fr_name}

Add a Disbursement on an awarded Funding Request
[Documentation] Creates a Funding Request via API.
... Go to Disbursements and add a new Disbursement
[tags] feature:Funding Request Disbursements
[tags] feature:FundingRequest Disbursements
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${awardedfunding_request}[Name]
Wait Until Loading Is Complete
Expand All @@ -77,5 +81,5 @@ Add a Disbursement on an awarded Funding Request
Wait Until Element Is Visible text:Scheduled Date
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 Unpaid Disbursements contains $80,000.00
Validate Field Value Available for Disbursement contains $20,000.00
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*** Settings ***
Documentation Create GAU Expenditure
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py
Expand All @@ -10,29 +11,34 @@ Suite Teardown Capture Screenshot And Delete Records And Close Browser

*** Keywords ***
Setup Test Data
${ns} = Get Outfundsnpsp Namespace Prefix
Set suite variable ${ns}
${ns_npsp} = Get NPSP Namespace Prefix
Set suite variable ${ns_npsp}
[Documentation] Create data to run tests
${ns} = Get Outfundsnpsp Namespace Prefix
Set suite variable ${ns}
${ns_npsp} = Get NPSP Namespace Prefix
Set suite variable ${ns_npsp}
${fundingprogram} = API Create Funding Program
Store Session Record ${ns}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]
${funding_request} = API Create Funding Request ${fundingprogram}[Id]
... ${contact}[Id]
Store Session Record ${ns}Funding_Request__c ${funding_request}[Id]
Set suite variable ${funding_request}
${disbursement} API Create Disbursement on a Funding Request ${funding_request}[Id]
${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]
&{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

[Documentation] Create GAU Expenditure via API and
... verify record is added on Disbursement Record
Go To Page Listing ${ns}Funding_Request__c
Click Link With Text ${funding_request}[Name]
Click Tab Disbursements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*** Settings ***

Documentation Create Requirement on a Funding Request
Resource robot/OutboundFundsNPSP/resources/OutboundfundsNPSP.robot
Library cumulusci.robotframework.PageObjects
... robot/OutboundFundsNPSP/resources/FundingRequestPageObject.py
Expand All @@ -12,15 +12,18 @@ Suite Teardown Capture Screenshot And Delete Records And Close Browser

*** Keywords ***
Setup Test Data
[Documentation] Create data to run tests
${ns} = Get Outfundsnpsp Namespace Prefix
Set Suite Variable ${ns}
${fundingprogram} = API Create Funding Program
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]
... ${ns}Status__c=In Progress ${ns}Awarded_Amount__c=100000
${funding_request} = API Create Funding Request
... ${fundingprogram}[Id] ${contact}[Id]
... ${ns}Status__c=In Progress
... ${ns}Awarded_Amount__c=100000
Store Session Record ${ns}Funding_Request__c ${funding_request}[Id]
Set suite variable ${funding_request}
${req_name} = Generate New String
Expand All @@ -43,5 +46,5 @@ Add a Requirement on a Funding Request
Click Save
wait until modal is closed
Click Related List Link With Text ${req_name}
Validate Field Value Requirement Name contains ${req_name}
Validate Field Value Requirement Name contains ${req_name}
Validate Field Value Primary Contact contains ${contact}[Name]
8 changes: 4 additions & 4 deletions robot/OutboundFundsNPSP/tests/create_contact.robot
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
*** Settings ***

Documentation Create contact via UI and API
Resource cumulusci/robotframework/Salesforce.robot
Suite Setup Open Test Browser
Suite Teardown Delete Records and Close Browser

*** Test Cases ***

Via API
[Documentation] Create Contact via API
${first_name} = Generate Random String
${last_name} = Generate Random String
${contact_id} = Salesforce Insert Contact
Expand All @@ -16,6 +17,7 @@ Via API
Validate Contact ${contact_id} ${first_name} ${last_name}

Via UI
[Documentation] Create Contact via API
${first_name} = Generate Random String
${last_name} = Generate Random String
Go To Object Home Contact
Expand All @@ -28,18 +30,16 @@ Via UI
${contact_id} = Get Current Record Id
Store Session Record Contact ${contact_id}
Validate Contact ${contact_id} ${first_name} ${last_name}


*** Keywords ***

Validate Contact
[Arguments] ${contact_id} ${first_name} ${last_name}
[Documentation] Validate via UI and API
# Validate via UI
Go To Record Home ${contact_id}
Page Should Contain ${first_name} ${last_name}
# Validate via API
&{contact} = Salesforce Get Contact ${contact_id}
Should Be Equal ${first_name} &{contact}[FirstName]
Should Be Equal ${last_name} &{contact}[LastName]


0 comments on commit d192c34

Please sign in to comment.