From 4de5f30bc892a8e12524a4ff7525ef9f10500a91 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Sat, 3 Aug 2024 16:51:20 -0700 Subject: [PATCH] Fixed alerting cypress tests. (#1500) Signed-off-by: AWSHurneyt (cherry picked from commit 5ce06df44fc58ddb303934e71ce8409cccc5cb33) --- .../bucket_level_monitor_spec.js | 6 ++--- .../query_level_monitor_spec.js | 27 +++++++++---------- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/cypress/integration/plugins/alerting-dashboards-plugin/bucket_level_monitor_spec.js b/cypress/integration/plugins/alerting-dashboards-plugin/bucket_level_monitor_spec.js index 7bdcd8027..1c32a04ac 100644 --- a/cypress/integration/plugins/alerting-dashboards-plugin/bucket_level_monitor_spec.js +++ b/cypress/integration/plugins/alerting-dashboards-plugin/bucket_level_monitor_spec.js @@ -166,6 +166,7 @@ describe('Bucket-Level Monitors', () => { cy.get('input[name="name"]').type(SAMPLE_EXTRACTION_QUERY_MONITOR); // Wait for input to load and then type in the index name + cy.contains('Select clusters'); cy.get('#index').type('*{enter}', { force: true }); // Input extraction query @@ -225,6 +226,7 @@ describe('Bucket-Level Monitors', () => { // Wait for input to load and then type in the index name // Pressing enter at the end to create combo box entry and trigger change events for time field below + cy.contains('Select clusters'); cy.get('#index').type(`${ALERTING_INDEX.SAMPLE_DATA_ECOMMERCE}{enter}`, { force: true, }); @@ -344,9 +346,7 @@ describe('Bucket-Level Monitors', () => { cy.contains('Edit').click({ force: true }); // Wait for page to load - // The default admin user for a docker-created domain doesn't have the permissions needed to select clusters. Disabling this check when security is enabled - if (!Cypress.env('SECURITY_ENABLED')) - cy.contains('Select clusters').click({ force: true }); + cy.contains('Select clusters'); // Click on the Index field and type in multiple index names to replicate the bug cy.get('#index') diff --git a/cypress/integration/plugins/alerting-dashboards-plugin/query_level_monitor_spec.js b/cypress/integration/plugins/alerting-dashboards-plugin/query_level_monitor_spec.js index bd4415f54..f7521728f 100644 --- a/cypress/integration/plugins/alerting-dashboards-plugin/query_level_monitor_spec.js +++ b/cypress/integration/plugins/alerting-dashboards-plugin/query_level_monitor_spec.js @@ -120,6 +120,7 @@ describe('Query-Level Monitors', () => { cy.get('input[name="name"]').type(SAMPLE_MONITOR, { force: true }); // Wait for input to load and then type in the index name + cy.contains('Select clusters'); cy.get('#index').type('*', { force: true }); // Add a trigger @@ -212,9 +213,7 @@ describe('Query-Level Monitors', () => { }); // Wait for page to load - // The default admin user for a docker-created domain doesn't have the permissions needed to select clusters. Disabling this check when security is enabled - if (!Cypress.env('SECURITY_ENABLED')) - cy.contains('Select clusters').click({ force: true }); + cy.contains('Select clusters'); // Click on the Index field and type in multiple index names to replicate the bug cy.get('#index') @@ -342,9 +341,7 @@ describe('Query-Level Monitors', () => { cy.get('[data-test-subj="visualEditorRadioCard"]').click({ force: true }); // Wait for page to load - // The default admin user for a docker-created domain doesn't have the permissions needed to select clusters. Disabling this check when security is enabled - if (!Cypress.env('SECURITY_ENABLED')) - cy.contains('Select clusters').click({ force: true }); + cy.contains('Select clusters'); // Wait for input to load and then type in the index name cy.get('#index').type( @@ -482,13 +479,13 @@ describe('Query-Level Monitors', () => { }); }); - after(() => { - // Delete all existing monitors and destinations - cy.deleteAllMonitors(); - - // Delete sample data - cy.deleteIndexByName(`${ALERTING_INDEX.SAMPLE_DATA_ECOMMERCE}`); - cy.deleteIndexByName(TESTING_INDEX_A); - cy.deleteIndexByName(TESTING_INDEX_B); - }); + // after(() => { + // // Delete all existing monitors and destinations + // cy.deleteAllMonitors(); + // + // // Delete sample data + // cy.deleteIndexByName(`${ALERTING_INDEX.SAMPLE_DATA_ECOMMERCE}`); + // cy.deleteIndexByName(TESTING_INDEX_A); + // cy.deleteIndexByName(TESTING_INDEX_B); + // }); });