[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
This commit is contained in:
Ash 2023-09-04 09:43:47 +02:00 committed by GitHub
parent ccabaa8e9d
commit ada6671165
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View file

@ -127,14 +127,17 @@ const ensureEndpointRuleAlertsIndexExists = async (esClient: Client): Promise<vo
indexMappings.mappings._meta.kibana.version = kibanaPackageJson.version;
}
const doesIndexExist = await esClient.indices.exists({ index: indexMappings.index });
if (doesIndexExist) {
return;
}
try {
await esClient.indices.create({
index: indexMappings.index,
body: {
settings: indexMappings.settings,
mappings: indexMappings.mappings,
aliases: indexMappings.aliases,
},
settings: indexMappings.settings,
mappings: indexMappings.mappings,
aliases: indexMappings.aliases,
});
} catch (error) {
// ignore error that indicate index is already created

View file

@ -81,8 +81,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
);
};
// Failing: See https://github.com/elastic/kibana/issues/139260
describe.skip('Response Actions Responder', function () {
describe('Response Actions Responder', function () {
let indexedData: IndexedHostsAndAlertsResponse;
let endpointAgentId: string;
@ -183,6 +182,11 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
// 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');