Skip to content

Instantly share code, notes, and snippets.

@Julian88Tex
Last active July 8, 2022 01:57
Show Gist options
  • Save Julian88Tex/a361ef757f75b4babcae7fc6e0d652d1 to your computer and use it in GitHub Desktop.
Save Julian88Tex/a361ef757f75b4babcae7fc6e0d652d1 to your computer and use it in GitHub Desktop.
Example Salesforce Playwright Library Robot Framework Test
*** Settings ***
Resource cumulusci/robotframework/SalesforcePlaywright.robot
Suite Setup Run Keywords
... Open Test Browser
... Suite Setup Keywords
Suite Teardown Run Keywords
... Delete Records And Close Browser
*** Test Cases ***
Create Contact
[Documentation] Creates a contact and validates it has synced with Access.
Go To Marketing App
${contact_id}= Create Contact
... Contact
... Joe Contact
Go To Record Page Contact
... ${contact_id}
Validate Contact Synced ${contact_id}
*** Keywords ***
Suite Setup Keywords
[Documentation] Run all keywords required before tests starts.
Get Salesforce Instance URL
Get Salesforce Instance URL
[Documentation]
... Get Salesforce Org Instance URL.
... Sets as a Test Variable.
${org_info} = Get Org Info
${instance_url} = Get From Dictionary ${org_info}
... instance_url
${instance_url} = Set Suite Variable ${instance_url}
Go To Marketing App
Click button:has-text("App Launcher")
Fill Text input[placeholder='Search apps and items...'] Marketing
Click one-app-launcher-menu-item:has-text("Marketing")
Go To Record Page
[Documentation] Navigates to object's record page.
[Arguments] ${object} ${id}
Go To ${instance_url}/lightning/r/${object}/${id}/view
Validate Contact Synced
[Documentation] Validates that provided contact has synced successfully.
[Arguments] ${contact_id}
Set Browser Timeout 2m
Get Element span.custom-truncate.uiOutputText:has-text("Joe Contact")
${contact}= Salesforce Get
... Contact ${contact_id}
Should Be Equal ${contact['LastName']}
... Contact
Create Contact
[Documentation] Creates a contact based on provided object type and
... First Name, and Last.
[Arguments] ${object} ${first_name} ${last_name}
${contact_id}= Salesforce Insert ${object}
... FirstName=${first_name}
... LastName=${last_name}
... Title=AUTOMATION
[Return] ${contact_id}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment