Skip to content

isalew/selenium-sfdc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Salesforce REST API for Selenium IDE

Table of Contents


Overview

The selenium-sfdc extension allows Selenium IDE tests to interact at a higher level with the Salesforce UI, and at a deeper level with the Salesforce API.

This repo is in rough development, and has plenty of areas for growth. If you would like to see improvements in this extension, please submit a pull request.

Use Cases

  • Simplify IDE usage with high-level Salesforce commands
  • Query field metadata to create more precise field selectors
  • Query hidden data after users make an update from the UI
  • Execute Unit tests as part of a Selenium test suite
  • Generate core test records in a new sandbox (Account > Contact > Opportunity)

Setup

Create a Salesforce Connected App

  • Log into Salesforce as an admin user
  • Navigate to Setup > Build > Create > Apps
  • Follow the instructions from Salesforce here and here to create a new Connected App.
  • Provide the following details for your connected app:
    • Connected App Name : selenium_ide
    • Description : Salesforce REST APIs for the Selenium IDE
    • Enable OAuth Settings : Checked
    • Selected OAuth Scope : Full access (full)
  • Open the Connected App and write down the values for Consumer Key and Consumer Secret
  • Follow the instructions from Salesforce here to assign user access to the Connected App
  • For the logging in user, write down the values for Username, Password and Security Token

Configure the Selenium IDE

  • Download the selenium-sfdc project repository.
  • Open the Selenium IDE and navigate to Options > General > Selenium Core extensions (user-extensions.js) > Browse...
  • Locate selenium-sfdc.js and click Open
  • Restart the Selenium IDE

SFDC API Methods

  • For detailed API specifications, please open the Jasmine Test Runner (Local).
  • For samples of API usage in Selenium, please open the [Selenium Test Suite](/Test Suite/Test Suite - Selenium for Salesforce.html) ([Local](/Users/isaac.lewis/repos/selenium/selenium-sfdc/Test Suite/Test Suite - Selenium for Salesforce.html)).
Command Description
sfdc.util
sfdc.util.encodeParams
sfdc.util.printObject
sfdc.api
sfdc.api.callout
sfdc.api.login
sfdc.api.query
sfdc.api.toolingQuery
sfdc.api.describeSObject
sfdc.api.runTestsSynchronous
sfdc.ui

SFDC Selenium Methods

Command Description
sfdcLogin
sfdcLoginAsUser
sfdcLogoutAsUser
sfdcOpenHomeAndWait
sfdcOpenRecordAndWait
sfdcDescribePageLayout (ObjectName, RecordTypeName)
sfdcAssertButton
sfdcAssertField
sfdcAssertRelatedList
sfdcGetFieldMap
sfdcGetFieldValue
sfdcSetFieldValue
sfdcSetFieldRecordType
sfdcSetFieldLookup

Examples

Authentication

Command Target Value
store CONNECTED_APP_CONSUMER_KEY client_id
store CONNECTED_APP_CONSUMER_SECRET client_secret
store user@email.com username
store P@SSW0RD password
store K2vgoIeiDBufPQNUVAAukwix security_token
loginSFDC ${username} ${password}${security_token}

Queries

Command Target Value
querySOQL SELECT Id, Name FROM Account LIMIT 5 accounts
echo javascript{storedVars['accounts'][0].Name} -
queryTooling SELECT Id, DeveloperName FROM CustomField WHERE TableEnumOrId = 'Account' LIMIT 5 account_fields
echo javascript{storedVars['account_fields'][0].Id} -


Additional Resources

HTTP Requests

Selenium Extensions

Selenium Loading Issues

Salesforce API

Code Standards

Jasmine Testing

About

Selenium IDE Actions for Salesforce Testing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published