11import { Organization } from '../../../src/types'
22import { points , makeGraphSnapshot } from '../../support/commands'
3+
34const VIS_TYPES = [
45 'band' ,
56 // 'check',
@@ -15,6 +16,7 @@ const VIS_TYPES = [
1516 'table' ,
1617]
1718const NUM_POINTS = 360
19+
1820describe ( 'visualizations' , ( ) => {
1921 beforeEach ( ( ) => {
2022 cy . flush ( )
@@ -29,6 +31,7 @@ describe('visualizations', () => {
2931 cy . writeData ( points ( NUM_POINTS ) )
3032 cy . getByTestID ( 'time-machine--bottom' )
3133 } )
34+
3235 describe ( 'empty states' , ( ) => {
3336 it ( 'shows a message if no queries have been created' , ( ) => {
3437 cy . getByTestID ( 'empty-graph--no-queries' ) . should ( 'exist' )
@@ -130,7 +133,7 @@ describe('visualizations', () => {
130133
131134 // cycle through all the visualizations of the data
132135 VIS_TYPES . forEach ( type => {
133- if ( type !== 'mosaic' && type !== 'band' ) {
136+ if ( type !== 'mosaic' ) {
134137 // mosaic graph is behind feature flag
135138 cy . getByTestID ( 'view-type--dropdown' ) . click ( )
136139 cy . getByTestID ( `view-type--${ type } ` ) . click ( )
@@ -372,4 +375,45 @@ describe('visualizations', () => {
372375 } )
373376 } )
374377 } )
378+
379+ describe ( 'Band plot behaves correctly' , ( ) => {
380+ it ( 'can find its main column before adjusting view options' , ( ) => {
381+ cy . get < string > ( '@defaultBucketListSelector' ) . then (
382+ ( defaultBucketListSelector : string ) => {
383+ const AGGREGATE_FUNCTION = 'last'
384+
385+ cy . getByTestID ( 'query-builder' ) . should ( 'exist' )
386+ // build the query to return data from beforeEach
387+ cy . getByTestID ( 'selector-list _monitoring' ) . should ( 'be.visible' )
388+ cy . getByTestID ( 'selector-list _monitoring' ) . click ( )
389+
390+ cy . getByTestID ( defaultBucketListSelector ) . should ( 'be.visible' )
391+ cy . getByTestID ( defaultBucketListSelector ) . click ( )
392+
393+ cy . getByTestID ( 'selector-list m' ) . should ( 'be.visible' )
394+ cy . getByTestID ( 'selector-list m' ) . clickAttached ( )
395+
396+ cy . getByTestID ( 'selector-list v' ) . should ( 'be.visible' )
397+ cy . getByTestID ( 'selector-list v' ) . clickAttached ( )
398+
399+ cy . getByTestID ( 'selector-list tv1' ) . clickAttached ( )
400+
401+ cy . getByTestID ( `selector-list ${ AGGREGATE_FUNCTION } ` )
402+ . scrollIntoView ( )
403+ . should ( 'be.visible' )
404+ . click ( )
405+
406+ cy . getByTestID ( 'view-type--dropdown' ) . click ( )
407+ cy . getByTestID ( `view-type--band` ) . click ( )
408+ cy . getByTestID ( 'time-machine-submit-button' ) . click ( )
409+ cy . getByTestID ( `vis-graphic--band` ) . should ( 'exist' )
410+
411+ cy . get ( 'button.cf-button[title="Customize"' ) . click ( )
412+ cy . getByTestID ( 'dropdown--button-main-column' ) . within ( ( ) => {
413+ cy . get ( '.cf-dropdown--selected' ) . contains ( AGGREGATE_FUNCTION )
414+ } )
415+ }
416+ )
417+ } )
418+ } )
375419} )
0 commit comments