hubl/cypress/integration/leave-channel.spec.js
Jean-Baptiste Pasquier e65def6234 major: orbit branding
2021-06-15 13:48:49 +02:00

43 lines
1.3 KiB
JavaScript

/// <reference types="Cypress" />
/* globals cy, expect */
context('Leave Channel Browser Testing', () => {
let tableQuery = [
'solid-display.table-body',
'solid-display:last-child',
'orbit-admin-circle-leave-button',
'solid-delete'
],
tableListQuery = [
'solid-display[nested-field="circles"]',
'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('Channel Leaving process', () => {
it('should visit the channels list screen', () => {
cy.visit('/admin-circles');
cy.location().should((loc) => {
expect(loc.pathname).to.eq('/admin-circles');
});
});
it('should click the last channel leave button', () => {
cy.get(tableListQuery.join(' ')).its('length').as('channelsLength');
cy.get(tableQuery.join(' ')).click();
});
it('should check if channel was left', () => {
cy.get(tableListQuery.join(' ')).its('length').should(length => {
expect(length).to.eq(this.channelsLength - 1);
});
});
});
});