Skip to content

Instantly share code, notes, and snippets.

@fityanos
Last active May 25, 2022 04:59
Show Gist options
  • Save fityanos/33388ef30c6450f7ece3f71e85fcd96e to your computer and use it in GitHub Desktop.
Save fityanos/33388ef30c6450f7ece3f71e85fcd96e to your computer and use it in GitHub Desktop.
Work around for cypress.io accessing salesforce
const sales_force_login_url = 'your salesforce login screen to land directly'
const sales_force_email = 'salesforce email address'
const sales_force_password = 'salesforce password'
const sales_force_ui_screen_url = 'desired salesforce screen/page'
describe(' Attempt salesforce login through API call', () => {
it('should perform magic', () => {
cy
.request(`${sales_force_login_url}?un=${sales_force_email}&pw=${sales_force_password}&startURL=%2Fhome`)
cy
.visit(`${sales_force_ui_screen_url}`)
// assertion...
cy
.get('screen_header_selector_for_example')
.should('be.visible')
.then((el) => {
expect(el).to.contain.text('Title text for example')
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment