Skip to content

Commit

Permalink
updated cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <[email protected]>
  • Loading branch information
amsiglan committed Jul 11, 2023
1 parent a492813 commit 2c363ec
Showing 1 changed file with 5 additions and 46 deletions.
51 changes: 5 additions & 46 deletions cypress/integration/composite_level_monitor_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,43 +55,31 @@ describe('CompositeLevelMonitor', () => {

it('by visual editor', () => {
// Select visual editor for method of definition
// cy.intercept('GET', '/api/notifications/get_configs?*', channelResponse);
cy.get('[data-test-subj="visualEditorRadioCard"]').click({ force: true });

// Wait for input to load and then type in the monitor name
cy.get('input[name="name"]').type(SAMPLE_VISUAL_EDITOR_MONITOR);

// Select delegate monitors
// Select associated monitors
cy.get('[data-test-subj="monitors_list_0"]')
.type('monitorOne', { delay: 50 })
.type('{enter}');
cy.get('[data-test-subj="monitors_list_1"]')
.type('monitorTwo', { delay: 50 })
.type('{enter}');

cy.get('button').contains('Add trigger').click({ force: true });

// Type trigger name
cy.get('[data-test-subj="composite-trigger-name"]')
.type('{selectall}')
.type('{backspace}')
.type('Composite trigger');

// Add associated monitors to condition
cy.get('[data-test-subj="condition-add-options-btn"]').click({ force: true });

cy.get('[data-test-subj="select-expression_0"]').click({ force: true });
cy.wait(1000);
cy.get('[data-test-subj="monitors-combobox-0"]')
.type('monitorOne', { delay: 50 })
.type('{enter}');

cy.get('[data-test-subj="select-expression_1"]').click({ force: true });
cy.wait(1000);
cy.get('[data-test-subj="monitors-combobox-1"]')
.type('monitorTwo', { delay: 50 })
.type('{enter}');

// TODO: Test with Notifications plugin
// Select notification channel
// cy.get('[title="Notification 1"]').type('Channel name');
// cy.get('[name="channel_name_0_0"]').find('input').type('Slack QA').type('{enter}');

cy.intercept('api/alerting/workflows').as('createMonitorRequest');
cy.intercept(`api/alerting/monitors?*`).as('getMonitorsRequest');
Expand Down Expand Up @@ -172,35 +160,6 @@ describe('CompositeLevelMonitor', () => {
}
});
});

it('by visual editor', () => {
// Verify edit page
cy.contains('Edit monitor', { timeout: 20000 });
cy.get('input[name="name"]').type('_edited');

cy.get('label').contains('Visual editor').click({ force: true });

cy.get('button').contains('Associate another monitor').click({ force: true });

cy.get('[data-test-subj="monitors_list_2"]')
.type('monitorThree', { delay: 50 })
.type('{enter}');

cy.get('[data-test-subj="condition-add-options-btn"]').click({ force: true });
cy.get('[data-test-subj="select-expression_2"]').click({ force: true });
cy.wait(1000);
cy.get('[data-test-subj="monitors-combobox-2"]')
.type('monitorThree', { delay: 50 })
.type('{enter}');

cy.intercept('api/alerting/workflows/*').as('updateMonitorRequest');
cy.get('button').contains('Update').click({ force: true });

// Wait for monitor to be created
cy.wait('@updateMonitorRequest').then(() => {
cy.get('.euiTitle--large').contains(`${SAMPLE_VISUAL_EDITOR_MONITOR}_edited`);
});
});
});

after(() => clearAll());
Expand Down

0 comments on commit 2c363ec

Please sign in to comment.