8
8
import customParseFormat from 'dayjs/plugin/customParseFormat' ;
9
9
import dayjs from 'dayjs' ;
10
10
import { BASE_PATH } from '../../../utils/constants' ;
11
- import { CURRENT_TENANT } from '../../../utils/commands' ;
12
11
import { devToolsRequest } from '../../../utils/helpers' ;
12
+ import { CURRENT_TENANT } from '../../../utils/commands' ;
13
13
14
14
dayjs . extend ( customParseFormat ) ;
15
15
@@ -20,16 +20,22 @@ const X_LABEL = 'A unique label for X-axis';
20
20
const DEFAULT_SIZE = 10 ;
21
21
22
22
describe ( 'Dump test data' , ( ) => {
23
- it ( 'Indexes test data for gantt chart' , ( ) => {
23
+ beforeEach ( ( ) => {
24
+ CURRENT_TENANT . newTenant = 'global' ;
24
25
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
+ */
26
30
cy . changeDefaultTenant ( {
27
31
multitenancy_enabled : true ,
28
32
private_tenant_enabled : true ,
29
- default_tenant : 'private ' ,
33
+ default_tenant : 'global ' ,
30
34
} ) ;
31
35
}
32
- CURRENT_TENANT . newTenant = 'private' ;
36
+ } ) ;
37
+
38
+ it ( 'Indexes test data for gantt chart' , ( ) => {
33
39
const dumpDataSet = ( ndjson , index ) =>
34
40
cy . request ( {
35
41
method : 'POST' ,
@@ -67,10 +73,12 @@ describe('Dump test data', () => {
67
73
68
74
describe ( 'Save a gantt chart' , { defaultCommandTimeout : 20000 } , ( ) => {
69
75
beforeEach ( ( ) => {
76
+ CURRENT_TENANT . newTenant = 'global' ;
70
77
cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
71
78
} ) ;
72
79
73
80
it ( 'Creates and saves a gantt chart' , ( ) => {
81
+ CURRENT_TENANT . newTenant = 'global' ;
74
82
cy . get ( '.euiButton__text' ) . contains ( 'Create ' ) . click ( { force : true } ) ;
75
83
cy . get ( '[data-test-subj="visTypeTitle"]' )
76
84
. contains ( 'Gantt Chart' )
@@ -91,10 +99,11 @@ describe(
91
99
{ defaultCommandTimeout : 20000 } ,
92
100
( ) => {
93
101
beforeEach ( ( ) => {
94
- CURRENT_TENANT . newTenant = 'private ' ;
102
+ CURRENT_TENANT . newTenant = 'global ' ;
95
103
cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
96
104
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 ) ;
98
107
cy . wait ( '@searchRequest' ) ;
99
108
cy . wait ( 5000 ) ;
100
109
cy . get ( '[data-test-subj="itemsInMemTable"]' )
@@ -138,20 +147,20 @@ describe(
138
147
139
148
describe ( 'Configure panel settings' , { defaultCommandTimeout : 20000 } , ( ) => {
140
149
beforeEach ( ( ) => {
150
+ CURRENT_TENANT . newTenant = 'global' ;
141
151
cy . visit ( `${ BASE_PATH } /app/visualize#` ) ;
142
152
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 ) ;
144
155
cy . wait ( '@searchRequest' ) ;
145
156
cy . wait ( 5000 ) ;
146
157
cy . contains ( GANTT_VIS_NAME ) . should ( 'exist' ) . click ( ) ;
147
158
cy . contains ( 'Panel settings' ) . click ( { force : true } ) ;
148
159
} ) ;
149
160
150
161
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 ) ;
155
164
cy . get ( '.euiButton__text' ) . contains ( 'Update' ) . click ( { force : true } ) ;
156
165
157
166
cy . get ( 'text.ytitle' ) . contains ( Y_LABEL ) . should ( 'exist' ) ;
@@ -165,10 +174,8 @@ describe('Configure panel settings', { defaultCommandTimeout: 20000 }, () => {
165
174
} ) ;
166
175
167
176
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 ) ;
172
179
cy . get ( '.euiButton__text' ) . contains ( 'Update' ) . click ( { force : true } ) ;
173
180
174
181
cy . get ( 'text.xtitle' ) . contains ( X_LABEL ) . should ( 'exist' ) ;
@@ -264,11 +271,13 @@ describe(
264
271
{ defaultCommandTimeout : 20000 } ,
265
272
( ) => {
266
273
it ( 'Adds gantt chart to dashboard' , ( ) => {
274
+ CURRENT_TENANT . newTenant = 'global' ;
267
275
cy . visit ( `${ BASE_PATH } /app/dashboards#/create` ) ;
268
276
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
+ ) ;
272
281
cy . get ( `.euiListGroupItem__label[title="${ GANTT_VIS_NAME } "]` ) . click ( {
273
282
force : true ,
274
283
} ) ;
0 commit comments