Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport main] Update gantt chart tenant #1227

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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',
Expand Down Expand Up @@ -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')
Expand All @@ -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"]')
Expand Down Expand Up @@ -138,20 +147,20 @@ 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();
cy.contains('Panel settings').click({ force: true });
});

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');
Expand All @@ -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');
Expand Down Expand Up @@ -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,
});
Expand Down
Loading