5
5
6
6
/// <reference types="cypress" />
7
7
8
+ import { suppressResizeObserverIssue } from '../utils/constants' ;
8
9
import {
9
10
delay ,
10
- TEST_PANEL ,
11
- PPL_VISUALIZATIONS ,
12
- PPL_VISUALIZATIONS_NAMES ,
13
11
NEW_VISUALIZATION_NAME ,
14
12
PPL_FILTER ,
15
- SAMPLE_PANEL ,
16
- SAMPLE_VISUALIZATIONS_NAMES ,
13
+ PPL_VISUALIZATIONS ,
14
+ PPL_VISUALIZATIONS_NAMES ,
15
+ TEST_PANEL ,
17
16
} from '../utils/panel_constants' ;
18
17
19
- import { suppressResizeObserverIssue } from '../utils/constants' ;
20
-
21
18
describe ( 'Adding sample data and visualization' , ( ) => {
22
19
it ( 'Adds sample flights data for visualization paragraph' , ( ) => {
23
20
cy . visit ( `${ Cypress . env ( 'opensearchDashboards' ) } /app/home#/tutorial_directory/sampleData` ) ;
@@ -195,6 +192,34 @@ describe('Testing panels table', () => {
195
192
cy . get ( 'button[data-test-subj="popoverModal__deleteButton"]' ) . click ( ) ;
196
193
cy . get ( 'h2[data-test-subj="customPanels__noPanelsHome"]' ) . should ( 'exist' ) ;
197
194
} ) ;
195
+
196
+ it ( 'Redirects to observability dashboard from OSD dashboards' , ( ) => {
197
+ moveToOsdDashboards ( ) ;
198
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/dashboards' ) ;
199
+ cy . get ( '[data-test-subj="dashboardListingTitleLink-Test-Panel"]' ) . click ( ) ;
200
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/observability-dashboards' ) ;
201
+ } ) ;
202
+
203
+ it ( 'Redirects to observability dashboard from OSD dashboards with edit' , ( ) => {
204
+ moveToOsdDashboards ( ) ;
205
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/dashboards' ) ;
206
+ cy . get ( '[data-test-subj="dashboardListingTitleLink-Test-Panel"]' )
207
+ . closest ( 'tr' )
208
+ . get ( 'span.euiToolTipAnchor > button.euiButtonIcon' )
209
+ . eq ( 0 )
210
+ . click ( ) ;
211
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/observability-dashboards' ) ;
212
+ cy . location ( 'hash' ) . should ( 'include' , '/edit' ) ;
213
+ } ) ;
214
+
215
+ it ( 'Redirects to observability dashboard from OSD dashboards with create' , ( ) => {
216
+ moveToOsdDashboards ( ) ;
217
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/dashboards' ) ;
218
+ cy . get ( 'div#createMenuPopover' ) . click ( ) ;
219
+ cy . get ( '[data-test-subj="contextMenuItem-observability-panel"]' ) . click ( ) ;
220
+ cy . location ( 'pathname' ) . should ( 'eq' , '/app/observability-dashboards' ) ;
221
+ cy . location ( 'hash' ) . should ( 'include' , '/create' ) ;
222
+ } ) ;
198
223
} ) ;
199
224
200
225
it ( 'Searches existing panel' , ( ) => {
@@ -274,7 +299,7 @@ describe('Testing a panel', () => {
274
299
275
300
cy . get ( `input.euiFieldText[value="${ TEST_PANEL } (copy)"]` )
276
301
. focus ( )
277
- . clear ( { force : true } )
302
+ . clear ( { force : true } )
278
303
. focus ( )
279
304
. type ( 'Renamed Panel' , {
280
305
delay : 200 ,
@@ -347,9 +372,9 @@ describe('Testing a panel', () => {
347
372
348
373
cy . get ( 'h5[data-test-subj="visualizationHeader"]' )
349
374
. contains ( PPL_VISUALIZATIONS_NAMES [ 1 ] )
350
- . trigger ( 'mousedown' , { which : 1 } )
351
- . trigger ( 'mousemove' , { clientX : 1100 , clientY : 0 } )
352
- . trigger ( 'mouseup' , { force : true } ) ;
375
+ . trigger ( 'mousedown' , { which : 1 } )
376
+ . trigger ( 'mousemove' , { clientX : 1100 , clientY : 0 } )
377
+ . trigger ( 'mouseup' , { force : true } ) ;
353
378
354
379
cy . get ( 'button[data-test-subj="savePanelButton"]' ) . click ( ) ;
355
380
cy . wait ( delay * 3 ) ;
@@ -364,9 +389,9 @@ describe('Testing a panel', () => {
364
389
365
390
cy . get ( '.react-resizable-handle' )
366
391
. eq ( 1 )
367
- . trigger ( 'mousedown' , { which : 1 } )
368
- . trigger ( 'mousemove' , { clientX : 2000 , clientY : 800 } )
369
- . trigger ( 'mouseup' , { force : true } ) ;
392
+ . trigger ( 'mousedown' , { which : 1 } )
393
+ . trigger ( 'mousemove' , { clientX : 2000 , clientY : 800 } )
394
+ . trigger ( 'mouseup' , { force : true } ) ;
370
395
371
396
cy . get ( 'button[data-test-subj="savePanelButton"]' ) . click ( ) ;
372
397
cy . wait ( delay * 3 ) ;
@@ -481,7 +506,7 @@ describe('Testing a panel', () => {
481
506
cy . get ( '[data-test-subj="eventExplorer__saveManagementPopover"]' ) . trigger ( 'mouseover' ) . click ( ) ;
482
507
cy . wait ( 1000 ) ;
483
508
cy . get ( '[data-test-subj="eventExplorer__querySaveName"]' )
484
- . clear ( { force : true } )
509
+ . clear ( { force : true } )
485
510
. type ( NEW_VISUALIZATION_NAME , {
486
511
delay : 200 ,
487
512
} ) ;
@@ -535,6 +560,11 @@ describe('Clean up all test data', () => {
535
560
} ) ;
536
561
} ) ;
537
562
563
+ const moveToOsdDashboards = ( ) => {
564
+ cy . visit ( `${ Cypress . env ( 'opensearchDashboards' ) } /app/dashboards#/` ) ;
565
+ cy . wait ( delay * 3 ) ;
566
+ } ;
567
+
538
568
const moveToEventsHome = ( ) => {
539
569
cy . visit ( `${ Cypress . env ( 'opensearchDashboards' ) } /app/observability-logs#/` ) ;
540
570
cy . wait ( delay * 3 ) ;
@@ -615,7 +645,8 @@ const eraseTestPanels = () => {
615
645
eraseLegacyPanels ( ) ;
616
646
eraseSavedObjectPaenls ( ) ;
617
647
} ;
618
- const uuidRx = / [ 0 - 9 a - f A - F ] { 8 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 12 } / ;
648
+ const uuidRx =
649
+ / [ 0 - 9 a - f A - F ] { 8 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 4 } \b - [ 0 - 9 a - f A - F ] { 12 } / ;
619
650
620
651
const clickCreatePanelButton = ( ) =>
621
652
cy . get ( 'a[data-test-subj="customPanels__createNewPanels"]' ) . click ( ) ;
0 commit comments