diff --git a/cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js b/cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js index 93e9d6796..231fc0e61 100644 --- a/cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js +++ b/cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js @@ -117,6 +117,8 @@ if (Cypress.env('SECURITY_ENABLED') && Cypress.env('AGGREGATION_VIEW')) { ADMIN_AUTH.newUser = Cypress.env('username'); ADMIN_AUTH.newPassword = Cypress.env('password'); CURRENT_TENANT.newTenant = 'private'; + cy.deleteIndexPattern('index-pattern1', { failOnStatusCode: false }); + cy.deleteIndexPattern('index-pattern2', { failOnStatusCode: false }); }); }); } diff --git a/cypress/integration/plugins/security-dashboards-plugin/inaccessible_tenancy_features.js b/cypress/integration/plugins/security-dashboards-plugin/inaccessible_tenancy_features.js index 4bf16ba8e..11b4605a2 100644 --- a/cypress/integration/plugins/security-dashboards-plugin/inaccessible_tenancy_features.js +++ b/cypress/integration/plugins/security-dashboards-plugin/inaccessible_tenancy_features.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -import { TENANTS_MANAGE_PATH } from '../../../utils/dashboards/constants'; +import { SECURITY_PLUGIN_PATH } from '../../../utils/dashboards/constants'; if (Cypress.env('SECURITY_ENABLED') && !Cypress.env('MULTITENANCY_ENABLED')) { describe('Multi Tenancy Tests: ', () => { @@ -12,10 +12,10 @@ if (Cypress.env('SECURITY_ENABLED') && !Cypress.env('MULTITENANCY_ENABLED')) { }); it('Test Dashboards tenancy features should not be accessible ', () => { // This test is to ensure tenancy related features are not accessible when opensearch_security.multitenancy.enabled is disabled in the opensearchdashboard.yaml - cy.visit(TENANTS_MANAGE_PATH); + cy.visit(SECURITY_PLUGIN_PATH); cy.waitForLoader(); - cy.contains('You have not enabled multi tenancy').should('exist'); + cy.get('[title="Tenants"]').should('not.exist'); // Switch tenants button should not exist when multi-tenancy is disabled. cy.get('#user-icon-btn').click(); diff --git a/cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js b/cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js index 988b84412..d6852d14d 100644 --- a/cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js +++ b/cypress/integration/plugins/security-dashboards-plugin/multi_tenancy.js @@ -39,6 +39,10 @@ if (Cypress.env('SECURITY_ENABLED')) { indexPatternPrivateTenantHeaderSetUp ); }); + after(() => { + cy.deleteIndexPattern('index-pattern1', { failOnStatusCode: false }); + cy.deleteIndexPattern('index-pattern2', { failOnStatusCode: false }); + }); it('Test 1 Disable Multi Tenancy ', () => { CURRENT_TENANT.newTenant = 'private'; diff --git a/cypress/utils/commands.js b/cypress/utils/commands.js index 96d8dfc1d..c09198dd9 100644 --- a/cypress/utils/commands.js +++ b/cypress/utils/commands.js @@ -90,7 +90,7 @@ Cypress.Commands.overwrite('visit', (orig, url, options) => { } newOptions.qs = { security_tenant: CURRENT_TENANT.defaultTenant }; if (waitForGetTenant) { - cy.intercept('GET', '/api/v1/multitenancy/tenant').as('getTenant'); + cy.intercept('GET', '/api/v1/multitenancy/tenant*').as('getTenant'); orig(url, newOptions); supressNoRequestOccurred(); cy.wait('@getTenant'); diff --git a/cypress/utils/dashboards/constants.js b/cypress/utils/dashboards/constants.js index f79209283..4079a5235 100644 --- a/cypress/utils/dashboards/constants.js +++ b/cypress/utils/dashboards/constants.js @@ -7,6 +7,9 @@ import { BASE_PATH } from '../base_constants'; // STACK MANAGEMENT PATH export const STACK_MANAGEMENT_PATH = BASE_PATH + '/app/management'; +export const SECURITY_PLUGIN_PATH = + BASE_PATH + '/app/security-dashboards-plugin#/'; + export const TENANTS_MANAGE_PATH = BASE_PATH + '/app/security-dashboards-plugin#/tenants';