2020-07-16 13:50:16 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Retire Channel Browser Testing', () => {
|
|
|
|
let menuQuery = [
|
|
|
|
'solid-display.circle-tab',
|
|
|
|
'solid-display:last-child',
|
|
|
|
'solid-display[order-by="name"]'
|
|
|
|
],
|
|
|
|
menuCountQuery = [
|
|
|
|
'solid-display.circle-tab',
|
|
|
|
'solid-display',
|
|
|
|
'solid-display[order-by="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());
|
|
|
|
it('should login', () => cy.login());
|
|
|
|
describe('Channel Retirement process', () => {
|
|
|
|
let channelsLength;
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the channels list screen', () => {
|
|
|
|
cy.visit('/admin');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/admin');
|
|
|
|
});
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should visit the last channel edit screen', () => {
|
|
|
|
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('/circle/@' + id + '/circle-information/circle-edit');
|
|
|
|
cy.location().should((loc) => {
|
|
|
|
expect(loc.pathname).to.eq('/circle/@' + id + '/circle-information/circle-edit');
|
|
|
|
});
|
2020-07-16 13:50:16 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should count the number of joined channels', () => {
|
|
|
|
cy.get(menuCountQuery.join(' ')).its('length').then(length => channelsLength = length);
|
|
|
|
});
|
|
|
|
it('should click button to retire the channel', () => {
|
|
|
|
cy.get('solid-multiple[name="members"] solid-delete[data-label="Retirer"] button').click();
|
|
|
|
});
|
|
|
|
it('should stay on channel 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('/circle/@' + id + '/circle-information/circle-edit');
|
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should check if chennel was retired', () => {
|
|
|
|
cy.get(menuCountQuery.join(' ')).its('length').should(length => {
|
|
|
|
expect(length).to.eq(channelsLength - 1);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|