88import customParseFormat from 'dayjs/plugin/customParseFormat' ;
99import dayjs from 'dayjs' ;
1010import { BASE_PATH } from '../../../utils/constants' ;
11- import { CURRENT_TENANT } from '../../../utils/commands' ;
1211import { devToolsRequest } from '../../../utils/helpers' ;
12+ import { CURRENT_TENANT } from '../../../utils/commands' ;
1313
1414dayjs . extend ( customParseFormat ) ;
1515
@@ -20,16 +20,22 @@ const X_LABEL = 'A unique label for X-axis';
2020const DEFAULT_SIZE = 10 ;
2121
2222describe ( 'Dump test data' , ( ) => {
23- it ( 'Indexes test data for gantt chart' , ( ) => {
23+ beforeEach ( ( ) => {
24+ CURRENT_TENANT . newTenant = 'global' ;
2425 if ( Cypress . env ( 'SECURITY_ENABLED' ) ) {
25- // Set default tenant to private to avoid tenant popup
26+ /**
27+ * Security plugin is using private tenant as default.
28+ * So here we'd need to set global tenant as default manually.
29+ */
2630 cy . changeDefaultTenant ( {
2731 multitenancy_enabled : true ,
2832 private_tenant_enabled : true ,
29- default_tenant : 'private ' ,
33+ default_tenant : 'global ' ,
3034 } ) ;
3135 }
32- CURRENT_TENANT . newTenant = 'private' ;
36+ } ) ;
37+
38+ it ( 'Indexes test data for gantt chart' , ( ) => {
3339 const dumpDataSet = ( ndjson , index ) =>
3440 cy . request ( {
3541 method : 'POST' ,
@@ -67,10 +73,12 @@ describe('Dump test data', () => {
6773
6874describe ( 'Save a gantt chart' , { defaultCommandTimeout : 20000 } , ( ) => {
6975 beforeEach ( ( ) => {
76+ CURRENT_TENANT . newTenant = 'global' ;
7077 cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
7178 } ) ;
7279
7380 it ( 'Creates and saves a gantt chart' , ( ) => {
81+ CURRENT_TENANT . newTenant = 'global' ;
7482 cy . get ( '.euiButton__text' ) . contains ( 'Create ' ) . click ( { force : true } ) ;
7583 cy . get ( '[data-test-subj="visTypeTitle"]' )
7684 . contains ( 'Gantt Chart' )
@@ -91,10 +99,11 @@ describe(
9199 { defaultCommandTimeout : 20000 } ,
92100 ( ) => {
93101 beforeEach ( ( ) => {
94- CURRENT_TENANT . newTenant = 'private ' ;
102+ CURRENT_TENANT . newTenant = 'global ' ;
95103 cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
96104 cy . intercept ( '**' ) . as ( 'searchRequest' ) ;
97- cy . get ( '.euiFieldSearch' ) . focus ( ) . type ( GANTT_VIS_NAME ) ;
105+ cy . get ( '.euiFieldSearch' ) . focus ( ) ;
106+ cy . get ( '.euiFieldSearch' ) . type ( GANTT_VIS_NAME ) ;
98107 cy . wait ( '@searchRequest' ) ;
99108 cy . wait ( 5000 ) ;
100109 cy . get ( '[data-test-subj="itemsInMemTable"]' )
@@ -138,20 +147,20 @@ describe(
138147
139148describe ( 'Configure panel settings' , { defaultCommandTimeout : 20000 } , ( ) => {
140149 beforeEach ( ( ) => {
150+ CURRENT_TENANT . newTenant = 'global' ;
141151 cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
142152 cy . intercept ( '**' ) . as ( 'searchRequest' ) ;
143- cy . get ( '.euiFieldSearch' ) . focus ( ) . type ( GANTT_VIS_NAME ) ;
153+ cy . get ( '.euiFieldSearch' ) . focus ( ) ;
154+ cy . get ( '.euiFieldSearch' ) . type ( GANTT_VIS_NAME ) ;
144155 cy . wait ( '@searchRequest' ) ;
145156 cy . wait ( 5000 ) ;
146157 cy . contains ( GANTT_VIS_NAME ) . should ( 'exist' ) . click ( ) ;
147158 cy . contains ( 'Panel settings' ) . click ( { force : true } ) ;
148159 } ) ;
149160
150161 it ( 'Changes y-axis label' , ( ) => {
151- cy . get ( 'input.euiFieldText[placeholder="Label"]' )
152- . eq ( 0 )
153- . focus ( )
154- . type ( Y_LABEL ) ;
162+ cy . get ( 'input.euiFieldText[placeholder="Label"]' ) . eq ( 0 ) . focus ( ) ;
163+ cy . get ( 'input.euiFieldText[placeholder="Label"]' ) . eq ( 0 ) . type ( Y_LABEL ) ;
155164 cy . get ( '.euiButton__text' ) . contains ( 'Update' ) . click ( { force : true } ) ;
156165
157166 cy . get ( 'text.ytitle' ) . contains ( Y_LABEL ) . should ( 'exist' ) ;
@@ -165,10 +174,8 @@ describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => {
165174 } ) ;
166175
167176 it ( 'Changes x-axis label' , ( ) => {
168- cy . get ( 'input.euiFieldText[placeholder="Label"]' )
169- . eq ( 1 )
170- . focus ( )
171- . type ( X_LABEL ) ;
177+ cy . get ( 'input.euiFieldText[placeholder="Label"]' ) . eq ( 1 ) . focus ( ) ;
178+ cy . get ( 'input.euiFieldText[placeholder="Label"]' ) . eq ( 1 ) . type ( X_LABEL ) ;
172179 cy . get ( '.euiButton__text' ) . contains ( 'Update' ) . click ( { force : true } ) ;
173180
174181 cy . get ( 'text.xtitle' ) . contains ( X_LABEL ) . should ( 'exist' ) ;
@@ -264,11 +271,13 @@ describe(
264271 { defaultCommandTimeout : 20000 } ,
265272 ( ) => {
266273 it ( 'Adds gantt chart to dashboard' , ( ) => {
274+ CURRENT_TENANT . newTenant = 'global' ;
267275 cy . visit ( `${ BASE_PATH } /app/dashboards#/create` ) ;
268276 cy . contains ( 'Add an existing' ) . click ( { force : true } ) ;
269- cy . get ( 'input[data-test-subj="savedObjectFinderSearchInput"]' )
270- . focus ( )
271- . type ( GANTT_VIS_NAME ) ;
277+ cy . get ( 'input[data-test-subj="savedObjectFinderSearchInput"]' ) . focus ( ) ;
278+ cy . get ( 'input[data-test-subj="savedObjectFinderSearchInput"]' ) . type (
279+ GANTT_VIS_NAME
280+ ) ;
272281 cy . get ( `.euiListGroupItem__label[title="${ GANTT_VIS_NAME } "]` ) . click ( {
273282 force : true ,
274283 } ) ;
0 commit comments