Add e2e seed and test event creation
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
// https://docs.cypress.io/api/introduction/api.html
|
||||
import { onBeforeLoad } from './browser-language';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.saveLocalStorage();
|
||||
});
|
||||
|
||||
describe('Homepage', () => {
|
||||
it('Checks the footer', () => {
|
||||
cy.visit('/', { onBeforeLoad });
|
||||
|
||||
44
js/tests/e2e/specs/event.js
Normal file
44
js/tests/e2e/specs/event.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import { onBeforeLoad } from './browser-language';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage();
|
||||
cy.checkoutSession();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.dropSession();
|
||||
});
|
||||
|
||||
describe('Events', () => {
|
||||
it('Shows my current events', () => {
|
||||
const EVENT = { title: 'My first event'};
|
||||
|
||||
cy.loginUser();
|
||||
cy.visit('/events/me', { onBeforeLoad });
|
||||
cy.contains('.message.is-danger', 'No events found');
|
||||
cy.contains('.navbar-item', 'Create').click();
|
||||
|
||||
cy.url().should('include', 'create');
|
||||
cy.get('.field').first().find('input').type(EVENT.title);
|
||||
cy.get('.field').eq(1).find('input').type('my tag, holo{enter}');
|
||||
cy.get('.field').eq(2).find('.datepicker .dropdown-trigger').click();
|
||||
|
||||
cy.get('.field').eq(3).find('.pagination-list .control').first().find('.select select').select('September');
|
||||
cy.get('.field').eq(3).find('.pagination-list .control').last().find('.select select').select('2021');
|
||||
cy.wait(1000);
|
||||
cy.get('.field').eq(3).contains('.datepicker-cell', '15').click();
|
||||
|
||||
cy.contains('.button.is-primary', 'Create my event').click();
|
||||
cy.url().should('include', '/events/');
|
||||
cy.contains('.title', EVENT.title);
|
||||
cy.contains('.title-and-informations span small', 'You\'re the only one going to this event');
|
||||
cy.contains('.date-and-privacy', 'On Wednesday, September 15, 2021 from');
|
||||
cy.contains('.visibility .tag', 'Public event');
|
||||
|
||||
cy.contains('.navbar-item', 'My events').click();
|
||||
cy.contains('.title', EVENT.title);
|
||||
cy.contains('.content.column', 'You\'re organizing this event');
|
||||
cy.contains('.title-wrapper .date-component .datetime-container .month', 'Sep');
|
||||
cy.contains('.title-wrapper .date-component .datetime-container .day', '15');
|
||||
});
|
||||
});
|
||||
@@ -1,11 +1,7 @@
|
||||
import { onBeforeLoad } from './browser-language';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.saveLocalStorage();
|
||||
cy.clearLocalStorage();
|
||||
});
|
||||
|
||||
describe('Login', () => {
|
||||
@@ -42,4 +38,46 @@ describe('Login', () => {
|
||||
|
||||
cy.contains('.message.is-danger', 'User with email not found');
|
||||
});
|
||||
|
||||
it('Tries to login with valid credentials', () => {
|
||||
cy.visit('/login', { onBeforeLoad });
|
||||
cy.get('input[type=email]').type('user@email.com');
|
||||
cy.get('input[type=password]').type('some password');
|
||||
cy.get('form').submit();
|
||||
cy.contains('.navbar-link', 'test_user');
|
||||
cy.contains('article.message.is-info', 'Welcome back I\'m a test user');
|
||||
cy.contains('.navbar-item.has-dropdown', 'test_user').click();
|
||||
cy.get('.navbar-item').last().contains('Log out').click();
|
||||
});
|
||||
|
||||
it('Tries to login with valid credentials but unconfirmed account', () => {
|
||||
cy.visit('/login', { onBeforeLoad });
|
||||
cy.get('input[type=email]').type('unconfirmed@email.com');
|
||||
cy.get('input[type=password]').type('some password');
|
||||
cy.get('form').submit();
|
||||
cy.contains('.message.is-danger', 'User with email not found');
|
||||
});
|
||||
|
||||
it('Tries to login with valid credentials, confirmed account but no profile', () => {
|
||||
cy.visit('/login', { onBeforeLoad });
|
||||
cy.get('input[type=email]').type('confirmed@email.com');
|
||||
cy.get('input[type=password]').type('some password');
|
||||
cy.get('form').submit();
|
||||
|
||||
cy.contains('.message', 'To achieve your registration, please create a first identity profile.');
|
||||
cy.get('form .field').first().contains('label', 'Username').parent().find('input').type('test_user');
|
||||
cy.get('form .field').eq(2).contains('label', 'Displayed name').parent().find('input').type('Duplicate');
|
||||
cy.get('form .field').eq(3).contains('label', 'Description').parent().find('textarea').type('This shouln\'t work because it\' using a dupublicated username');
|
||||
cy.get('.control.has-text-centered').contains('button', 'Create my profile').click();
|
||||
cy.contains('.help.is-danger', 'Username is already taken');
|
||||
|
||||
cy.get('form .field input').first(0).clear().type('test_user_2');
|
||||
cy.get('form .field input').eq(1).type('Not');
|
||||
cy.get('form .field textarea').clear().type('This will now work');
|
||||
cy.get('form').submit();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.contains('.navbar-link', 'test_user_2');
|
||||
cy.contains('article.message.is-info', 'Welcome back DuplicateNot');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
import { onBeforeLoad } from './browser-language';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.restoreLocalStorage();
|
||||
cy.checkoutSession();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.saveLocalStorage();
|
||||
cy.dropSession();
|
||||
});
|
||||
|
||||
@@ -34,7 +32,7 @@ describe('Registration', () => {
|
||||
|
||||
it('Tests that registration works', () => {
|
||||
cy.visit('/register/user', { onBeforeLoad });
|
||||
cy.get('input[type=email]').type('user@email.com');
|
||||
cy.get('input[type=email]').type('user2register@email.com');
|
||||
cy.get('input[type=password]').type('userPassword');
|
||||
cy.get('form').contains('button.button.is-primary', 'Register').click();
|
||||
|
||||
@@ -45,7 +43,7 @@ describe('Registration', () => {
|
||||
cy.get('form .field').eq(3).contains('label', 'Description').parent().find('textarea').type('This is a test account');
|
||||
cy.get('.control.has-text-centered').contains('button', 'Create my profile').click();
|
||||
|
||||
cy.contains('article.message.is-success', 'Your account is nearly ready, tester').contains('A validation email was sent to user@email.com');
|
||||
cy.contains('article.message.is-success', 'Your account is nearly ready, tester').contains('A validation email was sent to user2register@email.com');
|
||||
|
||||
cy.visit('/sent_emails');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user