@@ -8,6 +8,7 @@ import { FtrProviderContext } from '../../ftr_provider_context';
88
99export default function ( { getService, getPageObjects } : FtrProviderContext ) {
1010 const PageObjects = getPageObjects ( [ 'visualize' , 'wizard' , 'visChart' ] ) ;
11+ const testSubjects = getService ( 'testSubjects' ) ;
1112 const log = getService ( 'log' ) ;
1213 const retry = getService ( 'retry' ) ;
1314
@@ -27,21 +28,33 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
2728 } ) ;
2829
2930 it ( 'should show visualization when a field is added' , async ( ) => {
30- await PageObjects . wizard . addField ( 'metric' , 'Average' , 'machine.ram' ) ;
31+ const expectedData = [ 2858 , 2904 , 2814 , 1322 , 2784 ] ;
32+ await PageObjects . wizard . addField ( 'metric' , 'Count' ) ;
33+ await PageObjects . wizard . addField ( 'segment' , 'Terms' , 'machine.os.raw' ) ;
3134
32- await retry . try ( async ( ) => {
33- const data = await PageObjects . visChart . getBarChartData ( 'Average machine.ram' ) ;
34- expect ( data ) . to . eql ( [ 13104038093 ] ) ;
35- } ) ;
35+ const data = await PageObjects . visChart . getBarChartData ( ) ;
36+ expect ( data ) . to . eql ( expectedData ) ;
3637 } ) ;
3738
3839 it ( 'should clear visualization when field is deleted' , async ( ) => {
3940 await PageObjects . wizard . removeField ( 'metric' , 0 ) ;
4041
41- await retry . try ( async function tryingForTime ( ) {
42- const isEmptyWorkspace = await PageObjects . wizard . isEmptyWorkspace ( ) ;
43- expect ( isEmptyWorkspace ) . to . be ( true ) ;
44- } ) ;
42+ const isEmptyWorkspace = await PageObjects . wizard . isEmptyWorkspace ( ) ;
43+ expect ( isEmptyWorkspace ) . to . be ( true ) ;
44+ } ) ;
45+
46+ it ( 'should show warning before changing visualization type' , async ( ) => {
47+ await PageObjects . wizard . selectVisType ( 'metric' , false ) ;
48+ const confirmModalExists = await testSubjects . exists ( 'confirmVisChangeModal' ) ;
49+ expect ( confirmModalExists ) . to . be ( true ) ;
50+
51+ await testSubjects . click ( 'confirmModalCancelButton' ) ;
52+ } ) ;
53+
54+ it ( 'should change visualization type' , async ( ) => {
55+ const pickerValue = await PageObjects . wizard . selectVisType ( 'metric' ) ;
56+
57+ expect ( pickerValue ) . to . eql ( 'Metric' ) ;
4558 } ) ;
4659 } ) ;
4760}
0 commit comments