Skip to content

Commit

Permalink
fix: revert timeout increases. Handle monitors page load properly.
Browse files Browse the repository at this point in the history
Signed-off-by: vikhy-aws <[email protected]>
  • Loading branch information
vikhy-aws committed Jan 7, 2025
1 parent 90e8c60 commit 49ed545
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions cypress/integration/acknowledge_alerts_modal_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ const QUERY_TRIGGER = 'sample_alerts_flyout_query_level_trigger';

const TWENTY_SECONDS = 20000;

const SIXTY_SECONDS = 60000;

describe('AcknowledgeAlertsModal', () => {
before(() => {
// Delete any existing monitors
Expand All @@ -31,11 +29,21 @@ describe('AcknowledgeAlertsModal', () => {
cy.createMonitor(sampleAlertsFlyoutQueryMonitor);

// Visit Alerting OpenSearch Dashboards
cy.visit(`${Cypress.env('opensearch_dashboards')}/app/${PLUGIN_NAME}#/monitors`);
cy.visit(`${Cypress.env('opensearch_dashboards')}/app/${PLUGIN_NAME}#/monitors`, {
timeout: 30000,
retryOnStatusCodeFailure: true,
retryOnNetworkFailure: true
}).then(() => {
cy.get('body').then($body => {
if ($body.text().includes('OpenSearch Dashboards did not load properly')) {
cy.reload();
}
});
});

// Confirm test monitors were created successfully
cy.contains(BUCKET_MONITOR, { timeout: SIXTY_SECONDS });
cy.contains(QUERY_MONITOR, { timeout: SIXTY_SECONDS });
cy.contains(BUCKET_MONITOR, { timeout: TWENTY_SECONDS });
cy.contains(QUERY_MONITOR, { timeout: TWENTY_SECONDS });

// Wait 1 minute for the test monitors to trigger alerts, then go to the 'Alerts by trigger' dashboard page to view alerts
cy.wait(60000);
Expand All @@ -46,8 +54,8 @@ describe('AcknowledgeAlertsModal', () => {
cy.visit(`${Cypress.env('opensearch_dashboards')}/app/${PLUGIN_NAME}#/dashboard`);

// Confirm dashboard is displaying rows for the test monitors.
cy.contains(BUCKET_MONITOR, { timeout: SIXTY_SECONDS });
cy.contains(QUERY_MONITOR, { timeout: SIXTY_SECONDS });
cy.contains(BUCKET_MONITOR, { timeout: TWENTY_SECONDS });
cy.contains(QUERY_MONITOR, { timeout: TWENTY_SECONDS });
});

it('Acknowledge button disabled when more than 1 trigger selected', () => {
Expand Down

0 comments on commit 49ed545

Please sign in to comment.