From dfba84ef505cd17801b17da99ccb4dab3e08015e Mon Sep 17 00:00:00 2001 From: Ash <1849116+ashokaditya@users.noreply.github.com> Date: Mon, 4 Sep 2023 09:43:47 +0200 Subject: [PATCH] [Security Solution][Endpoint] Fix and unskip flaky test (#165466) ## Summary Fixes and un-skips a test. Ensures that the test data doesn't create an existing index. If it still does, as a temp. measure we're dismissing the error toast that is blocking the button so the rest of the test can continue. closes elastic/kibana/issues/139260 **flakey test runner** https://buildkite.com/elastic/kibana-flaky-test-suite-runner/builds/3036 x 200 ( all green) ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios (cherry picked from commit ada6671165ecfc2c27014fa0aa43c58ed8e965df) --- .../data_loaders/index_endpoint_rule_alerts.ts | 13 ++++++++----- .../apps/endpoint/responder.ts | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_rule_alerts.ts b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_rule_alerts.ts index 1c5883c052135..f6a394e8c46c9 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_rule_alerts.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_loaders/index_endpoint_rule_alerts.ts @@ -127,14 +127,17 @@ const ensureEndpointRuleAlertsIndexExists = async (esClient: Client): Promise { // Show event/alert details for the first one in the list await pageObjects.timeline.showEventDetails(); + // TODO: The index already exists error toast should not show up + // close and dismiss it if it does + if (await testSubjects.exists('globalToastList')) { + await testSubjects.click('toastCloseButton'); + } // Click responder from the take action button await testSubjects.click('take-action-dropdown-btn'); await testSubjects.clickWhenNotDisabled('endpointResponseActions-action-item');