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

36 lines
1.5 KiB
JavaScript

/// <reference types="Cypress" />
/* globals cy, expect */
context('Retire Project Browser Testing', () => {
before(() => {
cy.clearLocalStorage({ domain: null });
cy.clearCookies({ domain: null });
});
it('should visit user login screen', () => cy.userLogin());
describe('Project Retirement process', () => {
it('should login', () => cy.login());
it('should visit the project creation screen', () => cy.naviagte('/admin/admin-projects'));
it('should visit the last project edit screen', () => {
cy.get('solid-display[widget-project="hubl-menu-fix-url-project"][fields="project"]:last-child solid-display')
.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('solid-display[widget-project="hubl-menu-fix-url-project"]:last-child solid-display')
.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: ceraify what needs to happen after and do the checks
});
});