hubl/cypress/integration/retire-project.spec.js

64 lines
2.3 KiB
JavaScript
Raw Normal View History

/// <reference types="Cypress" />
/* globals cy, expect */
context('Retire Project Browser Testing', () => {
2020-07-03 17:27:55 +00:00
let menuQuery = [
'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"]'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
2020-07-03 17:27:55 +00:00
it('should visit user login screend', () => cy.userLogin());
it('should login', () => cy.login());
describe('Project Retirement process', () => {
let projectsLength;
2020-09-17 11:08:44 +00:00
it('should visit the projects list screen', () => {
cy.visit('/admin/admin-projects');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin/admin-projects');
});
});
it('should visit the last project edit screen', () => {
2020-07-03 17:27:55 +00:00
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.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');
});
}));
});
it('should count the number of joined projects', () => {
cy.get(menuCountQuery.join(' ')).its('length').then(length => projectsLength = length);
});
it('should click button to retire the project', () => {
cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click();
});
it('should stay on project edit screen', () => {
2020-07-03 17:27:55 +00:00
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/project-edit');
});
}));
});
it('should check if project was retired', () => {
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(projectsLength - 1);
});
});
});
});