2023-01-04 00:47:48 -08:00
|
|
|
import { SettingsLogStreamingPage } from '../pages';
|
2023-07-28 00:51:07 -07:00
|
|
|
import { getVisibleModalOverlay } from '../utils/modal';
|
|
|
|
import { getVisibleDropdown } from '../utils';
|
2023-01-04 00:47:48 -08:00
|
|
|
|
|
|
|
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', () => {
|
2023-06-22 15:38:12 -07:00
|
|
|
cy.enableFeature('logStreaming');
|
2023-01-04 00:47:48 -08:00
|
|
|
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', () => {
|
2023-07-28 00:51:07 -07:00
|
|
|
cy.enableFeature('logStreaming');
|
2023-01-04 00:47:48 -08:00
|
|
|
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
|
2023-07-28 00:51:07 -07:00
|
|
|
.getDestinationModal()
|
2023-01-04 00:47:48 -08:00
|
|
|
.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');
|
2023-07-28 00:51:07 -07:00
|
|
|
getVisibleModalOverlay().click(1, 1);
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.getters.getDestinationModal().should('not.exist');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create a destination and delete it', () => {
|
2023-07-28 00:51:07 -07:00
|
|
|
cy.enableFeature('logStreaming');
|
2023-01-04 00:47:48 -08:00
|
|
|
cy.visit('/settings/log-streaming');
|
2023-07-28 00:51:07 -07:00
|
|
|
cy.wait(1000); // Race condition with getDestinationDataFromBackend()
|
2023-01-04 00:47:48 -08:00
|
|
|
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();
|
2023-07-28 00:51:07 -07:00
|
|
|
settingsLogStreamingPage.getters.getDestinationNameInput().click();
|
2023-03-02 07:50:21 -08:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
settingsLogStreamingPage.getters
|
|
|
|
.getDestinationNameInput()
|
|
|
|
.find('input')
|
|
|
|
.clear()
|
|
|
|
.type('Destination 0');
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.getters.getDestinationSaveButton().click();
|
|
|
|
cy.wait(100);
|
2023-07-28 00:51:07 -07:00
|
|
|
getVisibleModalOverlay().click(1, 1);
|
2023-01-04 00:47:48 -08:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should create a destination and delete it via card actions', () => {
|
2023-07-28 00:51:07 -07:00
|
|
|
cy.enableFeature('logStreaming');
|
2023-01-04 00:47:48 -08:00
|
|
|
cy.visit('/settings/log-streaming');
|
2023-07-28 00:51:07 -07:00
|
|
|
cy.wait(1000); // Race condition with getDestinationDataFromBackend()
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.actions.clickAddFirstDestination();
|
|
|
|
cy.wait(100);
|
|
|
|
settingsLogStreamingPage.getters.getDestinationModal().should('be.visible');
|
|
|
|
settingsLogStreamingPage.getters.getSelectDestinationType().click();
|
2023-01-10 02:45:51 -08:00
|
|
|
settingsLogStreamingPage.getters.getSelectDestinationTypeItems().eq(0).click();
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.getters.getSelectDestinationButton().click();
|
2023-07-28 00:51:07 -07:00
|
|
|
settingsLogStreamingPage.getters.getDestinationNameInput().click();
|
|
|
|
settingsLogStreamingPage.getters
|
|
|
|
.getDestinationNameInput()
|
|
|
|
.find('input')
|
|
|
|
.clear()
|
|
|
|
.type('Destination 1');
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.getters.getDestinationSaveButton().should('not.have.attr', 'disabled');
|
|
|
|
settingsLogStreamingPage.getters.getDestinationSaveButton().click();
|
|
|
|
cy.wait(100);
|
2023-07-28 00:51:07 -07:00
|
|
|
getVisibleModalOverlay().click(1, 1);
|
2023-01-04 00:47:48 -08:00
|
|
|
cy.reload();
|
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
settingsLogStreamingPage.getters.getDestinationCards().eq(0).find('.el-dropdown').click();
|
|
|
|
getVisibleDropdown().find('.el-dropdown-menu__item').eq(0).click();
|
2023-01-04 00:47:48 -08:00
|
|
|
settingsLogStreamingPage.getters.getDestinationSaveButton().should('not.exist');
|
2023-07-28 00:51:07 -07:00
|
|
|
getVisibleModalOverlay().click(1, 1);
|
2023-01-04 00:47:48 -08:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
settingsLogStreamingPage.getters.getDestinationCards().eq(0).find('.el-dropdown').click();
|
|
|
|
getVisibleDropdown().find('.el-dropdown-menu__item').eq(1).click();
|
2023-01-04 00:47:48 -08:00
|
|
|
cy.get('.el-message-box').should('be.visible').find('.btn--confirm').click();
|
|
|
|
});
|
|
|
|
});
|