2020-06-30 12:27:20 +00:00
|
|
|
/// <reference types="Cypress" />
|
2020-07-03 17:25:23 +00:00
|
|
|
/* globals cy */
|
2020-06-30 12:27:20 +00:00
|
|
|
|
|
|
|
context('Signup Browser Testing', () => {
|
2020-07-03 17:25:23 +00:00
|
|
|
let username = 'testuser_creation_',
|
|
|
|
email = '',
|
|
|
|
password = 'testpwd';
|
2020-06-30 12:27:20 +00:00
|
|
|
before(() => {
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.randomNum().then(num => {
|
|
|
|
username += num;
|
|
|
|
email = username + '@testemail.com';
|
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
cy.clearLocalStorageSnapshot();
|
2020-06-30 12:27:20 +00:00
|
|
|
cy.clearLocalStorage({ domain: null });
|
|
|
|
cy.clearCookies({ domain: null });
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit user login screen', () => cy.userLogin());
|
2020-06-30 12:27:20 +00:00
|
|
|
describe('Signup process', () => {
|
|
|
|
it('should click on signup page link', () => {
|
|
|
|
cy.get('.sib-link.sib-register-link').click();
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should write incorrect user data', () => {
|
2020-06-30 12:27:20 +00:00
|
|
|
cy.get('#id_username').type('!"#$%&');
|
|
|
|
cy.get('#id_username').should('have.value', '!"#$%&');
|
|
|
|
cy.get('#id_email').type(email.split('.')[0]);
|
|
|
|
cy.get('#id_email').should('have.value', email.split('.')[0]);
|
|
|
|
cy.get('#id_password1').type(password + 'wrong1');
|
|
|
|
cy.get('#id_password1').should('have.value', password + 'wrong1');
|
|
|
|
cy.get('#id_password2').type(password + 'wrong2');
|
|
|
|
cy.get('#id_password2').should('have.value', password + 'wrong2');
|
|
|
|
});
|
|
|
|
it('should click on signup button', () => {
|
|
|
|
cy.get('.sib-registration-btn').click();
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should provide errors about incorrect user data', () => {
|
2020-06-30 12:27:20 +00:00
|
|
|
cy.get('tbody tr:nth-child(1) ul.errorlist li')
|
|
|
|
.should('contain.text', 'Enter a valid username. This value may contain only letters, numbers, and ./+/-/_ characters.');
|
|
|
|
cy.get('tbody tr:nth-child(2) ul.errorlist li')
|
|
|
|
.should('contain.text', 'Enter a valid email address.');
|
|
|
|
cy.get('tbody tr:nth-child(4) ul.errorlist li')
|
|
|
|
.should('contain.text', 'The two password fields didn\'t match.');
|
|
|
|
});
|
|
|
|
it('should write correct user data', () => {
|
|
|
|
cy.get('#id_username').clear().type(username);
|
|
|
|
cy.get('#id_username').should('have.value', username);
|
|
|
|
cy.get('#id_email').clear().type(email);
|
|
|
|
cy.get('#id_email').should('have.value', email);
|
|
|
|
cy.get('#id_password1').clear().type(password);
|
|
|
|
cy.get('#id_password1').should('have.value', password);
|
|
|
|
cy.get('#id_password2').clear().type(password);
|
|
|
|
cy.get('#id_password2').should('have.value', password);
|
|
|
|
});
|
|
|
|
it('should click on signup button', () => {
|
|
|
|
cy.get('.sib-registration-btn').click();
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should show email confirmation dialog', () => {
|
|
|
|
cy.contains('h1.text-center', 'Un e-mail d\'activation a été envoyé.').should("exist");
|
|
|
|
cy.contains('p.text-center', 'Vérifie ta boite mail et clique sur le lien pour activer ton compte.').should("exist");
|
|
|
|
});
|
2020-06-30 12:27:20 +00:00
|
|
|
});
|
|
|
|
});
|