Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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