fix(#6): ✅ Rewritten a few testcase to use more robust selectors (html ids)
Fixes #6
This commit is contained in:
parent
2bd1b9529c
commit
8161e77c7a
@ -8,19 +8,21 @@ describe('Should allow valid user and block the rest', () => {
|
||||
// title
|
||||
cy.title().should('eq', 'QA @ Trusk')
|
||||
// elements
|
||||
cy.get('h1').should('be.visible')
|
||||
cy.get('p').should('be.visible')
|
||||
cy.get('label').should('be.visible')
|
||||
cy.get('input').should('be.visible')
|
||||
cy.get('button').should('be.visible')
|
||||
cy.get('#hello').should('be.visible')
|
||||
cy.get('#guess').should('be.visible')
|
||||
cy.get('#email-label').should('be.visible')
|
||||
cy.get('#email-input').should('be.visible')
|
||||
cy.get('#password-label').should('be.visible')
|
||||
cy.get('#password-input').should('be.visible')
|
||||
cy.get('#submit').should('be.visible')
|
||||
|
||||
});
|
||||
|
||||
it('Prevent submiting empty credentials', function() {
|
||||
// submit empty
|
||||
cy.get('input').first().clear()
|
||||
cy.get('input').last().clear()
|
||||
cy.get('button').click()
|
||||
cy.get('#email-input').clear()
|
||||
cy.get('#password-input').clear()
|
||||
cy.get('#submit').click()
|
||||
cy.contains('Renseignes une adresse e-mail!').should('be.visible')
|
||||
cy.contains('Renseignes un mot de passe!').should('be.visible')
|
||||
});
|
||||
@ -28,31 +30,34 @@ describe('Should allow valid user and block the rest', () => {
|
||||
|
||||
it('Prevent submiting malformed email', function() {
|
||||
// submit invalid email
|
||||
cy.get('input').first().clear().type('adrian-trusk')
|
||||
cy.get('button').click()
|
||||
cy.get('#email-input').clear().type('adrian-trusk')
|
||||
cy.get('#password-input').clear()
|
||||
cy.get('#submit').click()
|
||||
cy.contains('Renseignes une adresse e-mail valide!').should('be.visible')
|
||||
});
|
||||
|
||||
it('Prevent submiting an unexisting user', function() {
|
||||
// submit wrong email
|
||||
cy.get('input').first().clear().type('adrian.pothuaud@trusk.com')
|
||||
cy.get('button').click()
|
||||
cy.get('#email-input').clear().type('adrian.pothuaud@trusk.com')
|
||||
cy.get('#password-input').clear().type('badpassword')
|
||||
cy.get('#submit').click()
|
||||
cy.contains('Renseignes la bonne adresse e-mail!').should('be.visible')
|
||||
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
||||
});
|
||||
|
||||
it('Prevent submiting invalid password of an existing user', function() {
|
||||
// submit bad password
|
||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
||||
cy.get('input').last().clear().type('adrian')
|
||||
cy.get('button').click()
|
||||
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||
cy.get('#password-input').clear().type('adrian')
|
||||
cy.get('#submit').click()
|
||||
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
||||
});
|
||||
|
||||
it('Allow connect a user in the system with right credentials', function() {
|
||||
// submit valid credentials
|
||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
||||
cy.get('input').last().clear().type('adrian@trusk.com')
|
||||
cy.get('button').click()
|
||||
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||
cy.get('#password-input').clear().type('adrian@trusk.com')
|
||||
cy.get('#submit').click()
|
||||
cy.contains('Salut testeur !').should('be.visible')
|
||||
|
||||
});
|
||||
@ -65,7 +70,7 @@ describe('Should allow valid user and block the rest', () => {
|
||||
cy.get('p').should('be.visible')
|
||||
cy.get('label').should('be.visible')
|
||||
cy.get('input').should('be.visible')
|
||||
cy.get('button').should('be.visible')
|
||||
cy.get('#submit').should('be.visible')
|
||||
});
|
||||
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user