2020-07-03 17:25:23 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Retire Project Browser Testing', () => {
|
2020-07-03 17:27:55 +00:00
|
|
|
let menuQuery = [
|
2020-07-16 13:50:16 +00:00
|
|
|
'solid-display.project-tab',
|
|
|
|
'solid-display:last-child',
|
|
|
|
'solid-display[order-by="customer.name"]'
|
|
|
|
],
|
|
|
|
menuCountQuery = [
|
|
|
|
'solid-display.project-tab',
|
|
|
|
'solid-display',
|
|
|
|
'solid-display[order-by="customer.name"]'
|
|
|
|
];
|
2020-07-03 17:25:23 +00:00
|
|
|
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:27:55 +00:00
|
|
|
it('should visit user login screend', () => 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 Retirement process', () => {
|
2020-07-16 13:50:16 +00:00
|
|
|
let projectsLength;
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the projects list screen', () => {
|
2021-01-22 13:21:25 +00:00
|
|
|
cy.visit('/admin-projects');
|
2020-09-17 11:08:44 +00:00
|
|
|
cy.location().should((loc) => {
|
2021-01-22 13:21:25 +00:00
|
|
|
expect(loc.pathname).to.eq('/admin-projects');
|
2020-09-17 11:08:44 +00:00
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit the last project edit screen', () => {
|
2020-07-03 17:27:55 +00:00
|
|
|
cy.get(menuQuery.join(' '))
|
2020-07-03 17:25:23 +00:00
|
|
|
.invoke('attr', 'data-src')
|
|
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
2021-02-22 20:27:58 +00:00
|
|
|
cy.visit('/projects/@' + id + '/projects-information/projects-edit');
|
2020-09-17 11:08:44 +00:00
|
|
|
cy.location().should((loc) => {
|
2021-02-22 20:27:58 +00:00
|
|
|
expect(loc.pathname).to.eq('/projects/@' + id + '/projects-information/projects-edit');
|
2020-09-17 11:08:44 +00:00
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
}));
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should count the number of joined projects', () => {
|
|
|
|
cy.get(menuCountQuery.join(' ')).its('length').then(length => projectsLength = length);
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should click button to retire the project', () => {
|
2020-07-16 13:50:16 +00:00
|
|
|
cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click();
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
it('should stay on project edit screen', () => {
|
2020-07-03 17:27:55 +00:00
|
|
|
cy.get(menuQuery.join(' '))
|
2020-07-03 17:25:23 +00:00
|
|
|
.invoke('attr', 'data-src')
|
|
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
|
|
|
cy.location().should((loc) => {
|
2021-02-22 20:27:58 +00:00
|
|
|
expect(loc.pathname).to.eq('/projects/@' + id + '/projects-information/projects-edit');
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should check if project was retired', () => {
|
|
|
|
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
|
|
|
|
expect(length).to.eq(projectsLength - 1);
|
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
});
|