2020-06-30 12:27:20 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
2020-07-03 17:25:23 +00:00
|
|
|
context('Create User Browser Testing', () => {
|
|
|
|
let firstName = 'First ',
|
|
|
|
lastName = 'Last ',
|
|
|
|
username = 'testuser_creation_',
|
|
|
|
email = '';
|
2020-06-30 12:27:20 +00:00
|
|
|
before(() => {
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.randomNum().then(num => {
|
|
|
|
firstName += num;
|
|
|
|
lastName += num;
|
|
|
|
username += num;
|
|
|
|
email = username + '@testemail.com';
|
2020-06-30 12:27:20 +00:00
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
cy.clearLocalStorageSnapshot();
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.clearLocalStorage({ domain: null });
|
|
|
|
cy.clearCookies({ domain: null });
|
2020-06-30 12:27:20 +00:00
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
|
|
afterEach(() => cy.saveLocalStorage());
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit user login screen', () => cy.userLogin());
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should login', () => cy.login());
|
2020-06-30 12:27:20 +00:00
|
|
|
describe('User Creation process', () => {
|
2020-09-17 11:08:44 +00:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should enter correct user data', () => {
|
2020-06-30 12:27:20 +00:00
|
|
|
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);
|
|
|
|
cy.get('#admin-users-create input[name="last_name"]').should('have.value', lastName);
|
|
|
|
cy.get('#admin-users-create input[name="username"]').clear().type(username);
|
|
|
|
cy.get('#admin-users-create input[name="username"]').should('have.value', username);
|
|
|
|
cy.get('#admin-users-create input[name="email"]').clear().type(email);
|
|
|
|
cy.get('#admin-users-create input[name="email"]').should('have.value', email);
|
|
|
|
});
|
|
|
|
it('should click on create user button', () => {
|
|
|
|
cy.get('#admin-users-create input[type="submit"]').click();
|
|
|
|
});
|
|
|
|
it('should land on users list screen', () => {
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-users');
|
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
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");
|
|
|
|
});
|
2020-06-30 12:27:20 +00:00
|
|
|
});
|
|
|
|
});
|