91 lines
4.0 KiB
JavaScript
91 lines
4.0 KiB
JavaScript
/// <reference types="Cypress" />
|
|
/* globals cy, expect */
|
|
|
|
context('Create Project Browser Testing', () => {
|
|
before(() => {
|
|
cy.clearLocalStorageSnapshot();
|
|
cy.clearLocalStorage({ domain: null });
|
|
cy.clearCookies({ domain: null });
|
|
});
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
afterEach(() => cy.saveLocalStorage());
|
|
it('should visit user login screen', () => cy.userLogin());
|
|
it('should login', () => cy.login());
|
|
describe('Project Creation process #1', () => {
|
|
let projectName = 'Test Project ',
|
|
customerName = 'Test Customer ',
|
|
description = 'Test Description ';
|
|
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');
|
|
});
|
|
});
|
|
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);
|
|
});
|
|
});
|
|
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");
|
|
});
|
|
});
|
|
});
|
|
describe('Project Creation process #2', () => {
|
|
let projectName = 'Test Project ',
|
|
customerName = 'Test Customer ',
|
|
description = 'Test Description ';
|
|
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');
|
|
});
|
|
});
|
|
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);
|
|
});
|
|
});
|
|
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");
|
|
});
|
|
});
|
|
});
|
|
});
|