Created
August 14, 2020 05:33
-
-
Save RockChild/90b5cd3fec1f85c52d4dd976f3f1ea12 to your computer and use it in GitHub Desktop.
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
// You can keep it inside of the test but it's preferable to store such commands in cypress/support/commands.js | |
// or create a separate file for related commands e.g. cypress/support/buttons.js | |
// but don't forget to import it in cypress/support/index.js | |
Cypress.Commands.add('getLoginButton', (label) => { | |
switch(label) { | |
case 'login': | |
return cy.get(loginBtnSelector); | |
case 'register': | |
return cy.get(registerBtnSelector); | |
} | |
}); | |
//Use it in test | |
it('should click on login button', () => { | |
cy.getLoginButton('login').click(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment