77 lines
2.8 KiB
JavaScript
77 lines
2.8 KiB
JavaScript
/// <reference types="cypress" />
|
|
|
|
describe('Should allow valid user and block the rest', () => {
|
|
|
|
beforeEach(function() {
|
|
// Changed theses should as required conditions to perform other tests
|
|
cy.visit('/')
|
|
// title
|
|
cy.title().should('eq', 'QA @ Trusk')
|
|
// elements
|
|
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('#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')
|
|
});
|
|
|
|
|
|
it('Prevent submiting malformed email', function() {
|
|
// submit invalid email
|
|
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('#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('#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('#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')
|
|
|
|
});
|
|
|
|
it.skip('Allow to disconnect a connected user', function() {
|
|
// cy.visit("ok.html")
|
|
// get back
|
|
cy.contains('Retour').click()
|
|
cy.title().should('eq', 'QA @ Trusk')
|
|
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('#submit').should('be.visible')
|
|
});
|
|
|
|
}); |