hubl/cypress/integration/retire-project.spec.js
2020-07-14 16:11:54 +02:00

44 lines
1.6 KiB
JavaScript

/// <reference types="Cypress" />
/* globals cy, expect */
context('Retire Project Browser Testing', () => {
let menuQuery = [
'solid-display.project-tab',
'solid-display:last-child',
'solid-display[order-by="customer.name"]'
];
before(() => {
cy.clearLocalStorageSnapshot();
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
beforeEach(() => cy.restoreLocalStorage());
afterEach(() => cy.saveLocalStorage());
it('should visit user login screend', () => cy.userLogin());
describe('Project Retirement process', () => {
it('should login', () => cy.login());
it('should visit the projects list screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the last project edit screen', () => {
cy.get(menuQuery.join(' '))
.invoke('attr', 'data-src')
.then(url => cy.encodeUrl(url).then(id => {
cy.naviagte('/project/@' + id + '/project-information/project-edit');
}));
});
it('should click button to retire the project', () => {
cy.scrollTo('bottom');
cy.get('solid-delete[data-label="Retirer"] button').click();
});
it('should stay on project edit 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/project-edit');
});
}));
});
// TO-DO: clearify what needs to happen after and do the checks
});
});