hubl/cypress/integration/leave-project.spec.js
Jean-Baptiste Pasquier 4ab6ab9764 cy: no more naviagte
2020-09-17 13:08:44 +02:00

43 lines
1.3 KiB
JavaScript

/// <reference types="Cypress" />
/* globals cy, expect */
context('Leave Project Browser Testing', () => {
let tableQuery = [
'solid-display.table-body',
'solid-display:last-child',
'hubl-admin-project-leave-button',
'solid-delete'
],
tableListQuery = [
'solid-display[nested-field="projects"]',
'div >',
'solid-display'
];
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());
it('should login', () => cy.login());
describe('Project Leaving process', () => {
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 click the last project leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('projectsLength');
cy.get(tableQuery.join(' ')).click();
});
it('should check if project was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.projectsLength - 1);
});
});
});
});