Skip to content

Commit

Permalink
Overwrite removed and moved to after in unit test
Browse files Browse the repository at this point in the history
Signed-off-by: leanneeliatra <[email protected]>
Signed-off-by: [email protected] <[email protected]>
  • Loading branch information
leanneeliatra committed Sep 29, 2023
1 parent b3e2b74 commit df07263
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
});
});
});
}
2 changes: 1 addition & 1 deletion cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit df07263

Please sign in to comment.