2020-07-03 17:25:23 +00:00
|
|
|
/// <reference types="Cypress" />
|
|
|
|
/* globals cy, expect */
|
|
|
|
|
|
|
|
context('Edit Channel Browser Testing', () => {
|
|
|
|
let channelName = 'Edited Test Channel ',
|
|
|
|
description = 'Edited Test Description ',
|
|
|
|
menuQuery = [
|
|
|
|
'solid-display.circle-tab',
|
|
|
|
'solid-display:last-child',
|
|
|
|
'solid-display[order-by="name"]'
|
|
|
|
];
|
|
|
|
before(() => {
|
|
|
|
cy.randomNum().then(num => {
|
|
|
|
channelName += num;
|
|
|
|
description += num;
|
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
cy.clearLocalStorageSnapshot();
|
2020-07-03 17:25:23 +00:00
|
|
|
cy.clearLocalStorage({ domain: null });
|
|
|
|
cy.clearCookies({ domain: null });
|
|
|
|
});
|
2020-07-08 13:41:05 +00:00
|
|
|
beforeEach(() => cy.restoreLocalStorage());
|
|
|
|
afterEach(() => cy.saveLocalStorage());
|
2020-07-03 17:25:23 +00:00
|
|
|
it('should visit user login screen', () => cy.userLogin());
|
2020-07-16 13:50:16 +00:00
|
|
|
it('should login', () => cy.login());
|
2020-07-03 17:25:23 +00:00
|
|
|
describe('Channel Edition process', () => {
|
2020-09-17 11:08:44 +00:00
|
|
|
it('should visit the channel list screen', () => {
|
2021-01-22 13:21:25 +00:00
|
|
|
cy.visit('/admin-circles');
|
2020-09-17 11:08:44 +00:00
|
|
|
cy.location().should((loc) => {
|
2021-01-22 13:21:25 +00:00
|
|
|
expect(loc.pathname).to.eq('/admin-circles');
|
2020-09-17 11:08:44 +00:00
|
|
|
});
|
|
|
|
});
|
2020-07-03 17:25:23 +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 => {
|
2021-02-22 20:27:58 +00:00
|
|
|
cy.visit('/circles/@' + id + '/circles-information/circles-edit');
|
2020-09-17 11:08:44 +00:00
|
|
|
cy.location().should((loc) => {
|
2021-02-22 20:27:58 +00:00
|
|
|
expect(loc.pathname).to.eq('/circles/@' + id + '/circles-information/circles-edit');
|
2020-09-17 11:08:44 +00:00
|
|
|
});
|
2020-07-03 17:25:23 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should enter new channel data', () => {
|
2021-02-22 20:27:58 +00:00
|
|
|
cy.get('#circles-edit input[name="name"]').clear().type(channelName);
|
|
|
|
cy.get('#circles-edit input[name="name"]').should('have.value', channelName);
|
|
|
|
cy.get('#circles-edit input[name="description"]').clear().type(description);
|
|
|
|
cy.get('#circles-edit input[name="description"]').should('have.value', description);
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
it('should click button to save the channel', () => {
|
2021-02-22 20:27:58 +00:00
|
|
|
cy.get('#circles-edit input[value="Enregistrer"]').click();
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
it('should land on channel information screen', () => {
|
|
|
|
cy.get(menuQuery.join(' '))
|
|
|
|
.invoke('attr', 'data-src')
|
|
|
|
.then(url => cy.encodeUrl(url).then(id => {
|
|
|
|
cy.location().should((loc) => {
|
2021-02-22 20:27:58 +00:00
|
|
|
expect(loc.pathname).to.eq('/circles/@' + id + '/circles-information');
|
2020-07-03 17:25:23 +00:00
|
|
|
});
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
it('should show edited channel data on channel information screen', () => {
|
|
|
|
cy.contains('solid-display-value[name="name"]', channelName).should("exist");
|
|
|
|
cy.contains('solid-display-value[name="description"]', description).should("exist");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|