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',