Skip to content

Commit

Permalink
[2.13] Switch to Private Tenant for Gantt Charts Tests (#1195) (#1197)
Browse files Browse the repository at this point in the history
* trying on 2.13

Signed-off-by: Sean Li <[email protected]>

* adding a should when searching for visualization

Signed-off-by: Sean Li <[email protected]>

* specifying which row to click

Signed-off-by: Sean Li <[email protected]>

* adding wait for request

Signed-off-by: Sean Li <[email protected]>

* remove force click

Signed-off-by: Sean Li <[email protected]>

* add hardcoded wait

Signed-off-by: Sean Li <[email protected]>

* add another wait

Signed-off-by: Sean Li <[email protected]>

* add default private tenant

Signed-off-by: Sean Li <[email protected]>

* add kibana refresh

Signed-off-by: Sean Li <[email protected]>

* uncommenting

Signed-off-by: Sean Li <[email protected]>

* remove wait for request

Signed-off-by: Sean Li <[email protected]>

---------

Signed-off-by: Sean Li <[email protected]>
(cherry picked from commit e3105d6)

Co-authored-by: Sean Li <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and sejli authored Apr 2, 2024
1 parent 6cb31c2 commit 32b8037
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat';
import dayjs from 'dayjs';
import { BASE_PATH } from '../../../utils/constants';
import { CURRENT_TENANT } from '../../../utils/commands';
import { devToolsRequest } from '../../../utils/helpers';

dayjs.extend(customParseFormat);

Expand All @@ -20,7 +21,15 @@ const DEFAULT_SIZE = 10;

describe('Dump test data', () => {
it('Indexes test data for gantt chart', () => {
CURRENT_TENANT.newTenant = 'global';
if (Cypress.env('SECURITY_ENABLED')) {
// Set default tenant to private to avoid tenant popup
cy.changeDefaultTenant({
multitenancy_enabled: true,
private_tenant_enabled: true,
default_tenant: 'private',
});
}
CURRENT_TENANT.newTenant = 'private';
const dumpDataSet = (ndjson, index) =>
cy.request({
method: 'POST',
Expand Down Expand Up @@ -52,13 +61,11 @@ describe('Dump test data', () => {
},
body: JSON.stringify({ attributes: { title: 'jaeger' } }),
});
devToolsRequest('.kibana*/_refresh', 'POST');
});
});

describe('Save a gantt chart', { defaultCommandTimeout: 20000 }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
});
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/visualize#`);
});
Expand All @@ -83,13 +90,18 @@ describe(
'Render and configure a gantt chart',
{ defaultCommandTimeout: 20000 },
() => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
});
beforeEach(() => {
CURRENT_TENANT.newTenant = 'private';
cy.visit(`${BASE_PATH}/app/visualize#`);
cy.intercept('**').as('searchRequest');
cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME);
cy.contains(GANTT_VIS_NAME).click({ force: true });
cy.wait('@searchRequest');
cy.wait(5000);
cy.get('[data-test-subj="itemsInMemTable"]')
.contains(GANTT_VIS_NAME)
.click({
force: true,
});
});

it('Renders no data message', () => {
Expand Down Expand Up @@ -125,13 +137,13 @@ describe(
);

describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
});
beforeEach(() => {
cy.visit(`${BASE_PATH}/app/visualize#`);
cy.intercept('**').as('searchRequest');
cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME);
cy.contains(GANTT_VIS_NAME).click({ force: true });
cy.wait('@searchRequest');
cy.wait(5000);
cy.contains(GANTT_VIS_NAME).should('exist').click();
cy.contains('Panel settings').click({ force: true });
});

Expand Down Expand Up @@ -251,9 +263,6 @@ describe(
'Add gantt chart to dashboard',
{ defaultCommandTimeout: 20000 },
() => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
});
it('Adds gantt chart to dashboard', () => {
cy.visit(`${BASE_PATH}/app/dashboards#/create`);
cy.contains('Add an existing').click({ force: true });
Expand Down

0 comments on commit 32b8037

Please sign in to comment.