n8n/cypress/e2e/10-settings-log-streaming.cy.ts
कारतोफ्फेलस्क्रिप्ट™ 0e071724ee
ci: Refactor e2e tests to delete boilerplate code (no-changelog) (#6524)
2023-06-23 00:38:12 +02:00

101 lines
4.8 KiB
TypeScript

import { SettingsLogStreamingPage } from '../pages';
const settingsLogStreamingPage = new SettingsLogStreamingPage();
describe('Log Streaming Settings', () => {
it('should show the unlicensed view when the feature is disabled', () => {
cy.visit('/settings/log-streaming');
settingsLogStreamingPage.getters.getActionBoxUnlicensed().should('be.visible');
settingsLogStreamingPage.getters.getContactUsButton().should('be.visible');
settingsLogStreamingPage.getters.getActionBoxLicensed().should('not.exist');
});
it('should show the licensed view when the feature is enabled', () => {
cy.enableFeature('logStreaming');
cy.visit('/settings/log-streaming');
settingsLogStreamingPage.getters.getActionBoxLicensed().should('be.visible');
settingsLogStreamingPage.getters.getAddFirstDestinationButton().should('be.visible');
settingsLogStreamingPage.getters.getActionBoxUnlicensed().should('not.exist');
});
it('should show the add destination modal', () => {
cy.visit('/settings/log-streaming');
settingsLogStreamingPage.actions.clickAddFirstDestination();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');
settingsLogStreamingPage.getters.getSelectDestinationType().should('be.visible');
settingsLogStreamingPage.getters.getSelectDestinationButton().should('be.visible');
settingsLogStreamingPage.getters.getSelectDestinationButton().should('have.attr', 'disabled');
settingsLogStreamingPage.getters
.getDestinationModalDialog()
.invoke('css', 'width')
.then((widthStr) => parseInt((widthStr as unknown as string).replace('px', '')))
.should('be.lessThan', 500);
settingsLogStreamingPage.getters.getSelectDestinationType().click();
settingsLogStreamingPage.getters.getSelectDestinationTypeItems().eq(0).click();
settingsLogStreamingPage.getters
.getSelectDestinationButton()
.should('not.have.attr', 'disabled');
settingsLogStreamingPage.getters.getDestinationModal().click(1, 1);
settingsLogStreamingPage.getters.getDestinationModal().should('not.exist');
});
it('should create a destination and delete it', () => {
cy.visit('/settings/log-streaming');
settingsLogStreamingPage.actions.clickAddFirstDestination();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');
settingsLogStreamingPage.getters.getSelectDestinationType().click();
settingsLogStreamingPage.getters.getSelectDestinationTypeItems().eq(0).click();
settingsLogStreamingPage.getters.getSelectDestinationButton().click();
settingsLogStreamingPage.getters.getDestinationNameInput().click()
settingsLogStreamingPage.getters.getDestinationNameInput().find('input').clear().type('Destination 0');
settingsLogStreamingPage.getters.getDestinationSaveButton().click();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().click(1, 1);
cy.reload();
settingsLogStreamingPage.getters.getDestinationCards().eq(0).click();
settingsLogStreamingPage.getters.getDestinationDeleteButton().should('be.visible').click();
cy.get('.el-message-box').should('be.visible').find('.btn--cancel').click();
settingsLogStreamingPage.getters.getDestinationDeleteButton().click();
cy.get('.el-message-box').should('be.visible').find('.btn--confirm').click();
cy.reload();
});
it('should create a destination and delete it via card actions', () => {
cy.visit('/settings/log-streaming');
settingsLogStreamingPage.actions.clickAddFirstDestination();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');
settingsLogStreamingPage.getters.getSelectDestinationType().click();
settingsLogStreamingPage.getters.getSelectDestinationTypeItems().eq(0).click();
settingsLogStreamingPage.getters.getSelectDestinationButton().click();
settingsLogStreamingPage.getters.getDestinationNameInput().click()
settingsLogStreamingPage.getters.getDestinationNameInput().find('input').clear().type('Destination 1');
settingsLogStreamingPage.getters.getDestinationSaveButton().should('not.have.attr', 'disabled');
settingsLogStreamingPage.getters.getDestinationSaveButton().click();
cy.wait(100);
settingsLogStreamingPage.getters.getDestinationModal().click(1, 1);
cy.reload();
settingsLogStreamingPage.getters
.getDestinationCards()
.eq(0)
.find('.el-dropdown-selfdefine')
.click();
cy.get('.el-dropdown-menu').find('.el-dropdown-menu__item').eq(0).click();
settingsLogStreamingPage.getters.getDestinationSaveButton().should('not.exist');
settingsLogStreamingPage.getters.getDestinationModal().click(1, 1);
settingsLogStreamingPage.getters
.getDestinationCards()
.eq(0)
.find('.el-dropdown-selfdefine')
.click();
cy.get('.el-dropdown-menu').find('.el-dropdown-menu__item').eq(1).click();
cy.get('.el-message-box').should('be.visible').find('.btn--confirm').click();
cy.reload();
});
});