Skip to content

Instantly share code, notes, and snippets.

@Julian88Tex
Created August 23, 2023 02:21
Show Gist options
  • Save Julian88Tex/35c6ae126e4f5679995b13f1690b0989 to your computer and use it in GitHub Desktop.
Save Julian88Tex/35c6ae126e4f5679995b13f1690b0989 to your computer and use it in GitHub Desktop.
*** Settings ***
Resource cumulusci/robotframework/Salesforce.robot
Library cumulusci.robotframework.PageObjects
Library Process
Suite Setup Run Keywords
... Setup Test Data
... Open Test Browser
Suite Teardown Delete Records And Close Browser
*** Tasks ***
Edit And Save Named Credential
[Documentation] Edit and save Named Credential so that it can
... update to status "Authenticated".
Navigate To Named Credentials
Edit Named Credentials ${credential}
Click Save
Verify Authentication Status Is Authenticated
*** Variables ***
${credential} = //setup_platform_namedcredential-credential-table//a[text()='Credential Label']//parent::*
${edit_button} = //input[@title='Edit']
*** Keywords ***
Setup Test Data
[Documentation] Sets up all data required for test.
Get Salesforce Instance URL
Get Salesforce Instance URL
[Documentation]
... Get Salesforce Org Instance URL.
... Sets as a Test Variable.
${org_info} = Get Org Info
Log ${org_info}
${instance_url} = Get From Dictionary ${org_info}
... instance_url
${instance_url} = Set Suite Variable ${instance_url}
Navigate To Named Credentials
[Documentation] Navigates to the Object Field History page.
${history_url} = Set Variable
... ${instance_url}/lightning/setup/NamedCredential/home
Go To ${history_url}
Edit Named Credentials
[Documentation] Click on edit button for provided Named Credential.
[Arguments] ${named_credential}
# iframe for Salesforce Classic setup pages
Click Element ${named_credential}
Select Frame //*[@id="setupComponent"]/div/div/div/force-aloha-page/div/iframe
Click Element ${edit_button}
Unselect Frame
Sleep 15s
Click Save
[Documentation] Click Save Button on edit page.
Wait Until Page Contains Element
... //*[@id="setupComponent"]/div/div/div/force-aloha-page/div/iframe
Select Frame //*[@id="setupComponent"]/div/div/div/force-aloha-page/div/iframe
Wait Until Page Contains Element
... //*[@value="Save"]
Click Element //*[@value="Save"]
Unselect Frame
Sleep 15s
Verify Authentication Status Is Authenticated
[Documentation] Waits for Authenticaiton Status to load and then validates it's value
... is "Authenticated".
Wait Until Page Contains Element
... //*[@id="setupComponent"]/div/div/div/force-aloha-page/div/iframe
Select Frame //*[@id="setupComponent"]/div/div/div/force-aloha-page/div/iframe
Wait Until Page Contains Element
... //*[contains(@id,"authStatusSection")]
SeleniumLibrary.Element Text Should Be
... //*[contains(@id,"authStatusSection")]
... Authenticated
Unselect Frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment