2020-07-03 17:25:23 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Edit Project Browser Testing', () => {
|
|
|
|
let projectName = 'Edited Test Project ',
|
|
|
|
customerName = 'Edited Test Customer ',
|
|
|
|
description = 'Edited Test Description ',
|
|
|
|
menuQuery = [
|
|
|
|
'solid-display.project-tab',
|
|
|
|
'solid-display:last-child',
|
|
|
|
'solid-display[order-by="customer.name"]'
|
|
|
|
];
|
|
|
|
before(() => {
|
|
|
|
cy.randomNum().then(num => {
|
|
|
|
projectName += num;
|
|
|
|
customerName += num;
|
|
|
|
description += num;
|
|
|
|
});
|
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());
|
2020-07-03 17:25:23 +00:00
|
|
|
describe('Project Edition process', () => {
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the project list screen', () => {
|
|
|
|
cy.visit('/admin/admin-projects');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin/admin-projects');
|
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit the last project edit screen', () => {
|
|
|
|
cy.get(menuQuery.join(' '))
|
|
|
|
.invoke('attr', 'data-src')
|
2020-09-17 11:17:55 +00:00
|
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
2020-09-17 11:08:44 +00:00
|
|
|
cy.visit('/project/@' + id + '/project-information/project-edit');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/project/@' + id + '/project-information/project-edit');
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should enter new project data', () => {
|
|
|
|
cy.get('#project-edit input[name="customer.name"]').clear().type(customerName);
|
|
|
|
cy.get('#project-edit input[name="customer.name"]').should('have.value', customerName);
|
|
|
|
cy.get('#project-edit input[name="name"]').clear().type(projectName);
|
|
|
|
cy.get('#project-edit input[name="name"]').should('have.value', projectName);
|
|
|
|
cy.get('#project-edit textarea[name="description"]').clear().type(description);
|
|
|
|
cy.get('#project-edit textarea[name="description"]').should('have.value', description);
|
|
|
|
});
|
|
|
|
it('should click button to save the project', () => {
|
|
|
|
cy.get('#project-edit input[value="Enregistrer"]').click();
|
|
|
|
});
|
|
|
|
it('should land on project information screen', () => {
|
|
|
|
cy.get(menuQuery.join(' '))
|
|
|
|
.invoke('attr', 'data-src')
|
|
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/project/@' + id + '/project-information');
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should show edited project data on project information screen', () => {
|
|
|
|
cy.contains('solid-display-value[name="customer.name"]', customerName).should("exist");
|
|
|
|
cy.contains('solid-display-value[name="name"]', projectName).should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|