64 lines
3.0 KiB
JavaScript
64 lines
3.0 KiB
JavaScript
/// <reference types="Cypress" />
|
|
/* globals cy, expect */
|
|
|
|
context('Create Project Browser Testing', () => {
|
|
let projectName = 'Test Project ',
|
|
customerName = 'Test Customer ',
|
|
description = 'Test Description ';
|
|
before(() => {
|
|
cy.randomNum().then(num => {
|
|
projectName += num;
|
|
customerName += num;
|
|
description += num;
|
|
});
|
|
cy.clearLocalStorageSnapshot();
|
|
cy.clearLocalStorage({ domain: null });
|
|
cy.clearCookies({ domain: null });
|
|
});
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
afterEach(() => cy.saveLocalStorage());
|
|
it('should visit user login screen', () => cy.userLogin());
|
|
describe('Project Creation process', () => {
|
|
it('should login', () => cy.login());
|
|
it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects/admin-project-create'));
|
|
/*it('should enter incorrect project data', () => {
|
|
cy.get('#admin-project-create input[name="customer.name"]').type('!"#$%&');
|
|
cy.get('#admin-project-create input[name="customer.name"]').should('have.value', '!"#$%&');
|
|
cy.get('#admin-project-create input[name="name"]').type('!"#$%&');
|
|
cy.get('#admin-project-create input[name="name"]').should('have.value', '!"#$%&');
|
|
cy.get('#admin-project-create textarea[name="description"]').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 provide errors about incorrect project data', () => {
|
|
// TO-DO: Check for error messages
|
|
cy.get('element')
|
|
.should('contain.text', 'Error message.');
|
|
});*/
|
|
it('should enter correct project data', () => {
|
|
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");
|
|
});
|
|
});
|
|
});
|
|
});
|