2020-07-03 17:25:23 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Create Project Browser Testing', () => {
|
|
|
|
before(() => {
|
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-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());
|
|
|
|
describe('Project Creation process #1', () => {
|
|
|
|
let projectName = 'Test Project ',
|
|
|
|
customerName = 'Test Customer ',
|
|
|
|
description = 'Test Description ';
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the project creation screen', () => {
|
|
|
|
cy.visit('/admin/admin-projects/admin-project-create');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-projects/admin-project-create');
|
|
|
|
});
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should enter correct project data', () => {
|
|
|
|
cy.randomNum().then(num => {
|
|
|
|
projectName += num;
|
|
|
|
customerName += num;
|
|
|
|
description += num;
|
|
|
|
cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName);
|
|
|
|
cy.get('#admin-project-create input[name="customer.name"]').should('have.value', customerName);
|
|
|
|
cy.get('#admin-project-create input[name="name"]').clear().type(projectName);
|
|
|
|
cy.get('#admin-project-create input[name="name"]').should('have.value', projectName);
|
|
|
|
cy.get('#admin-project-create textarea[name="description"]').clear().type(description);
|
|
|
|
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description);
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
it('should click on create project button', () => {
|
|
|
|
cy.get('#admin-project-create input[type="submit"]').click();
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should land on projects list screen', () => {
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-projects');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it('should land newly created project on projects list screen', () => {
|
|
|
|
cy.contains('solid-display-value[name="project.name"]', projectName).should("exist");
|
|
|
|
cy.fixture('admin.json').then(admin => {
|
|
|
|
cy.contains('solid-display-value[name="username"]', admin.username).should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
describe('Project Creation process #2', () => {
|
|
|
|
let projectName = 'Test Project ',
|
|
|
|
customerName = 'Test Customer ',
|
|
|
|
description = 'Test Description ';
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the project creation screen', () => {
|
|
|
|
cy.visit('/admin/admin-projects/admin-project-create');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-projects/admin-project-create');
|
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should enter correct project data', () => {
|
2020-07-16 13:50:16 +00:00
|
|
|
cy.randomNum().then(num => {
|
|
|
|
projectName += num;
|
|
|
|
customerName += num;
|
|
|
|
description += num;
|
|
|
|
cy.get('#admin-project-create input[name="customer.name"]').clear().type(customerName);
|
|
|
|
cy.get('#admin-project-create input[name="customer.name"]').should('have.value', customerName);
|
|
|
|
cy.get('#admin-project-create input[name="name"]').clear().type(projectName);
|
|
|
|
cy.get('#admin-project-create input[name="name"]').should('have.value', projectName);
|
|
|
|
cy.get('#admin-project-create textarea[name="description"]').clear().type(description);
|
|
|
|
cy.get('#admin-project-create textarea[name="description"]').should('have.value', description);
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
it('should click on create project button', () => {
|
|
|
|
cy.get('#admin-project-create input[type="submit"]').click();
|
|
|
|
});
|
|
|
|
it('should land on projects list screen', () => {
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-projects');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
it('should land newly created project on projects list screen', () => {
|
|
|
|
cy.contains('solid-display-value[name="project.name"]', projectName).should("exist");
|
|
|
|
cy.fixture('admin.json').then(admin => {
|
|
|
|
cy.contains('solid-display-value[name="username"]', admin.username).should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|