From 3017d60fba8fdb16f5efa086b02ac4af2b7b6485 Mon Sep 17 00:00:00 2001 From: leanneeliatra <131779422+leanneeliatra@users.noreply.github.com> Date: Fri, 29 Sep 2023 16:51:28 +0100 Subject: [PATCH] Overwrite removed and moved to after in unit test Signed-off-by: leanneeliatra --- .../tenancy_change_on_shortlink.js | 14 ++++++++++++++ cypress/utils/commands.js | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cypress/integration/plugins/security-dashboards-plugin/tenancy_change_on_shortlink.js b/cypress/integration/plugins/security-dashboards-plugin/tenancy_change_on_shortlink.js index 958746740..eddc3cb94 100644 --- a/cypress/integration/plugins/security-dashboards-plugin/tenancy_change_on_shortlink.js +++ b/cypress/integration/plugins/security-dashboards-plugin/tenancy_change_on_shortlink.js @@ -130,5 +130,19 @@ if (Cypress.env('SECURITY_ENABLED')) { ); }); }); + after(() => { + cy.deleteIndexPattern('index-pattern1', { + headers: { + securitytenant: ['global'], + 'osd-xsrf': true, + }, + }); + cy.deleteIndexPattern('index-pattern2', { + headers: { + securitytenant: ['private'], + 'osd-xsrf': true, + }, + }); + }); }); } diff --git a/cypress/utils/commands.js b/cypress/utils/commands.js index 90127014f..2c9076263 100644 --- a/cypress/utils/commands.js +++ b/cypress/utils/commands.js @@ -356,7 +356,7 @@ Cypress.Commands.add('deleteSavedObjectByType', (type, search) => { Cypress.Commands.add('createIndexPattern', (id, attributes, header = {}) => { const url = `${ Cypress.config().baseUrl - }/api/saved_objects/index-pattern/${id}?overwrite=true`; // When running tests locally if ran multiple times the tests fail. The fix is to set Overwrite to true. + }/api/saved_objects/index-pattern/${id}`; cy.request({ method: 'POST',