From a60fa70abb43f4db1b0469e7ca46cb2aa7bcead8 Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Tue, 23 Apr 2024 22:36:00 -0700 Subject: [PATCH] Update gantt chart tenant (#1226) * update gantt chart tenant Signed-off-by: Shenoy Pratik * fix add index pattern request Signed-off-by: Shenoy Pratik * make default tenant global Signed-off-by: Shenoy Pratik --------- Signed-off-by: Shenoy Pratik --- .../gantt-chart-dashboards/gantt_ui.spec.js | 47 +++++++++++-------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js b/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js index 5c304c1f5..08db32b3e 100644 --- a/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js +++ b/cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js @@ -8,8 +8,8 @@ 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'; +import { CURRENT_TENANT } from '../../../utils/commands'; dayjs.extend(customParseFormat); @@ -20,16 +20,22 @@ const X_LABEL = 'A unique label for X-axis'; const DEFAULT_SIZE = 10; describe('Dump test data', () => { - it('Indexes test data for gantt chart', () => { + beforeEach(() => { + CURRENT_TENANT.newTenant = 'global'; if (Cypress.env('SECURITY_ENABLED')) { - // Set default tenant to private to avoid tenant popup + /** + * Security plugin is using private tenant as default. + * So here we'd need to set global tenant as default manually. + */ cy.changeDefaultTenant({ multitenancy_enabled: true, private_tenant_enabled: true, - default_tenant: 'private', + default_tenant: 'global', }); } - CURRENT_TENANT.newTenant = 'private'; + }); + + it('Indexes test data for gantt chart', () => { const dumpDataSet = (ndjson, index) => cy.request({ method: 'POST', @@ -67,10 +73,12 @@ describe('Dump test data', () => { describe('Save a gantt chart', { defaultCommandTimeout: 20000 }, () => { beforeEach(() => { + CURRENT_TENANT.newTenant = 'global'; cy.visit(`${BASE_PATH}/app/visualize#`); }); it('Creates and saves a gantt chart', () => { + CURRENT_TENANT.newTenant = 'global'; cy.get('.euiButton__text').contains('Create ').click({ force: true }); cy.get('[data-test-subj="visTypeTitle"]') .contains('Gantt Chart') @@ -91,10 +99,11 @@ describe( { defaultCommandTimeout: 20000 }, () => { beforeEach(() => { - CURRENT_TENANT.newTenant = 'private'; + CURRENT_TENANT.newTenant = 'global'; cy.visit(`${BASE_PATH}/app/visualize#`); cy.intercept('**').as('searchRequest'); - cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME); + cy.get('.euiFieldSearch').focus(); + cy.get('.euiFieldSearch').type(GANTT_VIS_NAME); cy.wait('@searchRequest'); cy.wait(5000); cy.get('[data-test-subj="itemsInMemTable"]') @@ -138,9 +147,11 @@ describe( describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => { beforeEach(() => { + CURRENT_TENANT.newTenant = 'global'; cy.visit(`${BASE_PATH}/app/visualize#`); cy.intercept('**').as('searchRequest'); - cy.get('.euiFieldSearch').focus().type(GANTT_VIS_NAME); + cy.get('.euiFieldSearch').focus(); + cy.get('.euiFieldSearch').type(GANTT_VIS_NAME); cy.wait('@searchRequest'); cy.wait(5000); cy.contains(GANTT_VIS_NAME).should('exist').click(); @@ -148,10 +159,8 @@ describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => { }); it('Changes y-axis label', () => { - cy.get('input.euiFieldText[placeholder="Label"]') - .eq(0) - .focus() - .type(Y_LABEL); + cy.get('input.euiFieldText[placeholder="Label"]').eq(0).focus(); + cy.get('input.euiFieldText[placeholder="Label"]').eq(0).type(Y_LABEL); cy.get('.euiButton__text').contains('Update').click({ force: true }); cy.get('text.ytitle').contains(Y_LABEL).should('exist'); @@ -165,10 +174,8 @@ describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => { }); it('Changes x-axis label', () => { - cy.get('input.euiFieldText[placeholder="Label"]') - .eq(1) - .focus() - .type(X_LABEL); + cy.get('input.euiFieldText[placeholder="Label"]').eq(1).focus(); + cy.get('input.euiFieldText[placeholder="Label"]').eq(1).type(X_LABEL); cy.get('.euiButton__text').contains('Update').click({ force: true }); cy.get('text.xtitle').contains(X_LABEL).should('exist'); @@ -264,11 +271,13 @@ describe( { defaultCommandTimeout: 20000 }, () => { it('Adds gantt chart to dashboard', () => { + CURRENT_TENANT.newTenant = 'global'; cy.visit(`${BASE_PATH}/app/dashboards#/create`); cy.contains('Add an existing').click({ force: true }); - cy.get('input[data-test-subj="savedObjectFinderSearchInput"]') - .focus() - .type(GANTT_VIS_NAME); + cy.get('input[data-test-subj="savedObjectFinderSearchInput"]').focus(); + cy.get('input[data-test-subj="savedObjectFinderSearchInput"]').type( + GANTT_VIS_NAME + ); cy.get(`.euiListGroupItem__label[title="${GANTT_VIS_NAME}"]`).click({ force: true, });