feature: user, project, channel and job offer create test flows and project, channel and job offer edit test flows

This commit is contained in:
Jure Ursic
2020-07-03 19:25:23 +02:00
parent e5e2815f0d
commit 8b84de7b37
13 changed files with 533 additions and 89 deletions

View File

@ -1,45 +1,26 @@
/// <reference types="Cypress" />
/* globals cy, expect */
context('Creat User Browser Testing', () => {
const firstName = 'First',
lastName = 'Last',
username = 'testuser_creation_' + Math.floor(1000 + Math.random() * 9000),
email = username + '@testemail.com';
context('Create User Browser Testing', () => {
let firstName = 'First ',
lastName = 'Last ',
username = 'testuser_creation_',
email = '';
before(() => {
cy.clearLocalStorage({ domain: null});
cy.randomNum().then(num => {
firstName += num;
lastName += num;
username += num;
email = username + '@testemail.com';
});
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
it('visit the homepage', () => {
cy.visit('/');
});
it('should await for an user login', () => {
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/auth/login/');
});
});
it('should visit user login screen', () => cy.userLogin());
describe('User Creation process', () => {
it('should login', () => {
cy.get('#id_username').type('admin');
cy.get('#id_username').should('have.value', 'admin');
cy.get('#id_password').type('admin');
cy.get('#id_password').should('have.value', 'admin');
cy.get('.connection-btn').click();
cy.get('.accept-button').click();
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/');
});
});
it('should visit the user creation screen', () => {
cy.visit('/admin/admin-users/admin-users-create');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-users/admin-users-create');
});
// Workaround - seems to be a bug when accessing the route directly
cy.get('.accept-button').click();
// End workaround
});
/*it('should enter erroneous user data and submit', () => {
it('should login', () => cy.login());
it('should visit the user creation screen', () => cy.naviagte('/admin/admin-users/admin-users-create'));
/*it('should enter incorrect user data', () => {
cy.get('#admin-users-create input[name="first_name"]').type(firstName);
cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);
cy.get('#admin-users-create input[name="last_name"]').type(lastName);
@ -52,12 +33,12 @@ context('Creat User Browser Testing', () => {
it('should click on create user button', () => {
cy.get('#admin-users-create input[type="submit"]').click();
});
it('should provide errors about erroneous user data', () => {
it('should provide errors about incorrect user data', () => {
// TO-DO: Check for error messages
cy.get('element')
.should('contain.text', 'Error message.');
});*/
it('should enter user data and submit', () => {
it('should enter correct user data', () => {
cy.get('#admin-users-create input[name="first_name"]').clear().type(firstName);
cy.get('#admin-users-create input[name="first_name"]').should('have.value', firstName);
cy.get('#admin-users-create input[name="last_name"]').clear().type(lastName);
@ -75,5 +56,9 @@ context('Creat User Browser Testing', () => {
expect(loc.pathname).to.eq('/admin/admin-users');
});
});
it('should land newly created user on users list screen', () => {
cy.contains('solid-display-value[name="name"]', firstName + ' ' + lastName).should("exist");
cy.contains('solid-display-value[name="username"]', username).should("exist");
});
});
});