Created
October 30, 2020 16:23
-
-
Save mikelondon/2ebf4474c5dbbf2c57d4280cf01bcaff to your computer and use it in GitHub Desktop.
Salesforce + Cypress Helper Functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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