Skip to content

Commit

Permalink
Merge branch 'main' into 3.0-alerting-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SuZhou-Joe authored Jul 31, 2024
2 parents b836950 + 0f4cd75 commit 35feef4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,7 @@ describe('ClusterMetricsMonitor', () => {
beforeEach(() => {
cy.deleteAllMonitors();
cy.reload();
});

it('for the Cluster Health API', () => {
// Confirm empty monitor list is loaded
cy.contains('There are no existing monitors');

Expand All @@ -117,11 +115,15 @@ describe('ClusterMetricsMonitor', () => {
force: true,
});

// Wait for API types to load to reduce flakiness
cy.wait(5000);
});

it('for the Cluster Health API', () => {
// Wait for input to load and then type in the monitor name
cy.get('input[name="name"]').type(SAMPLE_CLUSTER_METRICS_HEALTH_MONITOR);

// Wait for the API types to load and then type in the Cluster Health API
cy.wait(5000);
// Type in the Cluster Health API
cy.get('[data-test-subj="clusterMetricsApiTypeComboBox"]').type(
'cluster health{enter}'
);
Expand Down Expand Up @@ -168,21 +170,12 @@ describe('ClusterMetricsMonitor', () => {
});

it('for the Nodes Stats API', () => {
// Confirm empty monitor list is loaded
cy.contains('There are no existing monitors');

// Go to create monitor page
cy.contains('Create monitor').click();

// Select ClusterMetrics radio card
cy.get('[data-test-subj="clusterMetricsMonitorRadioCard"]').click();

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

// Wait for the API types to load and then type in the Cluster Health API
// Type in the Cluster Health API
cy.get('[data-test-subj="clusterMetricsApiTypeComboBox"]').type(
'nodes stats{enter}'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import sampleCompositeJson from '../../../fixtures/plugins/alerting-dashboards-plugin/sample_composite_level_monitor.json';
import * as _ from 'lodash';
import { BASE_PATH } from '../../../utils/base_constants';
import { setupIntercept } from '../../../utils/plugins/security-analytics-dashboards-plugin/helpers';

const sample_index_1 = 'sample_index_1';
const sample_index_2 = 'sample_index_2';
Expand Down Expand Up @@ -109,8 +110,7 @@ describe('CompositeLevelMonitor', () => {
.type('{backspace}', { force: true })
.type('Composite trigger', { force: true });

cy.intercept('api/alerting/workflows').as('createMonitorRequest');
cy.intercept(`api/alerting/monitors?*`).as('getMonitorsRequest');
setupIntercept(cy, 'api/alerting/workflows', 'createMonitorRequest');
cy.get('button').contains('Create').click({ force: true });

// Wait for monitor to be created
Expand Down Expand Up @@ -192,7 +192,12 @@ describe('CompositeLevelMonitor', () => {
.type('monitorThree', { delay: 50 })
.type('{enter}');

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

// Wait for monitor to be created
Expand Down

0 comments on commit 35feef4

Please sign in to comment.