Skip to content

Instantly share code, notes, and snippets.

@ckenst
Created October 30, 2020 02:53
Show Gist options
  • Save ckenst/4667e1a0f8ada064e976df54d56a9561 to your computer and use it in GitHub Desktop.
Save ckenst/4667e1a0f8ada064e976df54d56a9561 to your computer and use it in GitHub Desktop.
Login Examples
describe('My Login application', () => {
it('Should login with valid credentials', () =>{
cy.visit(`https://the-internet.herokuapp.com/login`);
cy.get('#username')
.type('tomsmith')
cy.get('#password')
.type('SuperSecretPassword!')
cy.get('button[type="submit"]')
.click();
cy.get('#flash')
.should('exist')
.contains('You logged into a secure area!');
})
});
describe('My Login application', () => {
it('Should login with valid credentials', () =>{
})
});
describe('My Login application', () => {
it('should login with valid credentials', () => {
browser.url('https://the-internet.herokuapp.com/login');
$('#username').setValue('tomsmith');
$('#password').setValue('SuperSecretPassword!');
$('button[type="submit"]').click();
expect($('#flash')).toBeExisting();
expect($('#flash')).toHaveTextContaining(
'You logged into a secure area!');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment