Skip to content

Instantly share code, notes, and snippets.

@mikelondon
Created October 30, 2020 16:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikelondon/2ebf4474c5dbbf2c57d4280cf01bcaff to your computer and use it in GitHub Desktop.
Save mikelondon/2ebf4474c5dbbf2c57d4280cf01bcaff to your computer and use it in GitHub Desktop.
Salesforce + Cypress Helper Functions
//Helper function for Optimizely Entity Creation Modal pops up (Project, Experiment, Event)
Cypress.Commands.add('fillOutForm', (selector, index, text) => {
cy.get('.isModal').find(selector).then((response) => {
cy.get(response[index]).type(text)
})
})
//Helper function for clicking the save button on the entity creation form.
Cypress.Commands.add('clickSave',() => {
cy.get('.isModal').find('button').then((response)=>{
cy.get(response[3]).click()
})
})
//Helper function for toggling the metric input box on the event creation form.
Cypress.Commands.add('toggleMetricInput', () => {
cy.get('.isModal').find('input').then((response) => {
cy.get(response[0]).check();
})
})
Helper function for filling out dropdown menus.
Cypress.Commands.add('completeDropdown', (index, text) => {
cy.get('.isModal').find('a').then((response) => {
cy.get(response[index]).click().then(() => {
cy.contains(text).click();
})
}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment