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
|
// title
|
||||||
cy.title().should('eq', 'QA @ Trusk')
|
cy.title().should('eq', 'QA @ Trusk')
|
||||||
// elements
|
// elements
|
||||||
cy.get('h1').should('be.visible')
|
cy.get('#hello').should('be.visible')
|
||||||
cy.get('p').should('be.visible')
|
cy.get('#guess').should('be.visible')
|
||||||
cy.get('label').should('be.visible')
|
cy.get('#email-label').should('be.visible')
|
||||||
cy.get('input').should('be.visible')
|
cy.get('#email-input').should('be.visible')
|
||||||
cy.get('button').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() {
|
it('Prevent submiting empty credentials', function() {
|
||||||
// submit empty
|
// submit empty
|
||||||
cy.get('input').first().clear()
|
cy.get('#email-input').clear()
|
||||||
cy.get('input').last().clear()
|
cy.get('#password-input').clear()
|
||||||
cy.get('button').click()
|
cy.get('#submit').click()
|
||||||
cy.contains('Renseignes une adresse e-mail!').should('be.visible')
|
cy.contains('Renseignes une adresse e-mail!').should('be.visible')
|
||||||
cy.contains('Renseignes un mot de passe!').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() {
|
it('Prevent submiting malformed email', function() {
|
||||||
// submit invalid email
|
// submit invalid email
|
||||||
cy.get('input').first().clear().type('adrian-trusk')
|
cy.get('#email-input').clear().type('adrian-trusk')
|
||||||
cy.get('button').click()
|
cy.get('#password-input').clear()
|
||||||
|
cy.get('#submit').click()
|
||||||
cy.contains('Renseignes une adresse e-mail valide!').should('be.visible')
|
cy.contains('Renseignes une adresse e-mail valide!').should('be.visible')
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prevent submiting an unexisting user', function() {
|
it('Prevent submiting an unexisting user', function() {
|
||||||
// submit wrong email
|
// submit wrong email
|
||||||
cy.get('input').first().clear().type('adrian.pothuaud@trusk.com')
|
cy.get('#email-input').clear().type('adrian.pothuaud@trusk.com')
|
||||||
cy.get('button').click()
|
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 la bonne adresse e-mail!').should('be.visible')
|
||||||
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
cy.contains('Renseignes le bon mot de passe').should('be.visible')
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Prevent submiting invalid password of an existing user', function() {
|
it('Prevent submiting invalid password of an existing user', function() {
|
||||||
// submit bad password
|
// submit bad password
|
||||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||||
cy.get('input').last().clear().type('adrian')
|
cy.get('#password-input').clear().type('adrian')
|
||||||
cy.get('button').click()
|
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() {
|
it('Allow connect a user in the system with right credentials', function() {
|
||||||
// submit valid credentials
|
// submit valid credentials
|
||||||
cy.get('input').first().clear().type('adrian@trusk.com')
|
cy.get('#email-input').clear().type('adrian@trusk.com')
|
||||||
cy.get('input').last().clear().type('adrian@trusk.com')
|
cy.get('#password-input').clear().type('adrian@trusk.com')
|
||||||
cy.get('button').click()
|
cy.get('#submit').click()
|
||||||
cy.contains('Salut testeur !').should('be.visible')
|
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('p').should('be.visible')
|
||||||
cy.get('label').should('be.visible')
|
cy.get('label').should('be.visible')
|
||||||
cy.get('input').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