@@ -459,35 +459,76 @@ export default function({ getService, getPageObjects }) {
459459 } ) ;
460460
461461 describe ( 'date histogram interval' , ( ) => {
462- beforeEach ( async ( ) => await PageObjects . visEditor . toggleAccordion ( 'visEditorAggAccordion2' ) ) ;
463-
464- it ( 'should update accordion label when collapsed' , async ( ) => {
465- await PageObjects . visEditor . toggleAccordion ( 'visEditorAggAccordion2' , false ) ;
466- const accordionLabel = await (
467- await find . byCssSelector (
468- '[data-test-subj="visEditorAggAccordion2"] .visEditorSidebar__aggGroupAccordionButtonContent'
469- )
470- ) . getVisibleText ( ) ;
471- expect ( accordionLabel ) . to . include . string ( 'per month' ) ;
462+ before ( async ( ) => {
463+ await PageObjects . visualize . loadSavedVisualization ( vizName1 ) ;
464+ await PageObjects . visChart . waitForVisualization ( ) ;
472465 } ) ;
473466
474- it ( 'should update label inside when scaled to milliseconds' , async ( ) => {
475- await PageObjects . visEditor . setInterval ( 'Millisecond' ) ;
476- const accordionLabel = await (
477- await find . byCssSelector ( '[data-test-subj="currentlyScaledText"]' )
478- ) . getVisibleText ( ) ;
479- expect ( accordionLabel ) . to . include . string ( 'to week' ) ;
467+ beforeEach ( async ( ) => {
468+ const fromTime = 'Sep 20, 2015 @ 00:00:00.000' ;
469+ const toTime = 'Sep 20, 2015 @ 23:30:00.000' ;
470+ await PageObjects . timePicker . setAbsoluteRange ( fromTime , toTime ) ;
480471 } ) ;
481472
482- it ( 'should scale to 10 minutes and display the correct label when time range is changed and custom interval is set to 10s' , async ( ) => {
483- const fromTime = 'Sep 20, 2015 @ 00:00:00.000' ;
473+ it ( 'should update collapsed accordion label when time range is changed' , async ( ) => {
474+ const accordionLabel = await find . byCssSelector (
475+ '[data-test-subj="visEditorAggAccordion2"] .visEditorSidebar__aggGroupAccordionButtonContent'
476+ ) ;
477+ let accordionLabelText = await accordionLabel . getVisibleText ( ) ;
478+ expect ( accordionLabelText ) . to . include . string ( 'per 30 minutes' ) ;
479+ const fromTime = 'Sep 20, 2015 @ 08:30:00.000' ;
484480 const toTime = 'Sep 20, 2015 @ 23:30:00.000' ;
485481 await PageObjects . timePicker . setAbsoluteRange ( fromTime , toTime ) ;
486- await PageObjects . visEditor . setInterval ( '10s' , { type : 'custom' } ) ;
487- const accordionLabel = await (
488- await find . byCssSelector ( '[data-test-subj="currentlyScaledText"]' )
489- ) . getVisibleText ( ) ;
490- expect ( accordionLabel ) . to . include . string ( 'to 10 minutes' ) ;
482+ accordionLabelText = await accordionLabel . getVisibleText ( ) ;
483+ expect ( accordionLabelText ) . to . include . string ( 'per 10 minutes' ) ;
484+ } ) ;
485+
486+ describe ( 'expanded accordion' , ( ) => {
487+ before ( async ( ) => await PageObjects . visEditor . toggleAccordion ( 'visEditorAggAccordion2' ) ) ;
488+
489+ it ( 'should update label inside the opened accordion when scaled to milliseconds' , async ( ) => {
490+ const isHelperScaledLabelExists = await find . existsByCssSelector (
491+ '[data-test-subj="currentlyScaledText"]'
492+ ) ;
493+ expect ( isHelperScaledLabelExists ) . to . be ( false ) ;
494+ await PageObjects . visEditor . setInterval ( 'Millisecond' ) ;
495+ const helperScaledLabelText = await (
496+ await find . byCssSelector ( '[data-test-subj="currentlyScaledText"]' )
497+ ) . getVisibleText ( ) ;
498+ expect ( helperScaledLabelText ) . to . include . string ( 'to 10 minutes' ) ;
499+ } ) ;
500+
501+ it ( 'should display updated scaled label text after time range is changed' , async ( ) => {
502+ await PageObjects . visEditor . setInterval ( 'Millisecond' ) ;
503+ const isHelperScaledLabelExists = await find . existsByCssSelector (
504+ '[data-test-subj="currentlyScaledText"]'
505+ ) ;
506+ expect ( isHelperScaledLabelExists ) . to . be ( true ) ;
507+ const helperScaledLabel = await find . byCssSelector (
508+ '[data-test-subj="currentlyScaledText"]'
509+ ) ;
510+ let helperScaledLabelText = await helperScaledLabel . getVisibleText ( ) ;
511+ expect ( helperScaledLabelText ) . to . include . string ( 'to 10 minutes' ) ;
512+ const fromTime = 'Sep 20, 2015 @ 22:30:00.000' ;
513+ const toTime = 'Sep 20, 2015 @ 23:30:00.000' ;
514+ await PageObjects . timePicker . setAbsoluteRange ( fromTime , toTime ) ;
515+ helperScaledLabelText = await helperScaledLabel . getVisibleText ( ) ;
516+ expect ( helperScaledLabelText ) . to . include . string ( 'to 30 seconds' ) ;
517+ } ) ;
518+
519+ it ( 'should update scaled label text after custom interval is set and time range is changed' , async ( ) => {
520+ await PageObjects . visEditor . setInterval ( '10s' , { type : 'custom' } ) ;
521+ const helperScaledLabel = await find . byCssSelector (
522+ '[data-test-subj="currentlyScaledText"]'
523+ ) ;
524+ let helperScaledLabelText = await helperScaledLabel . getVisibleText ( ) ;
525+ expect ( helperScaledLabelText ) . to . include . string ( 'to 10 minutes' ) ;
526+ const fromTime = 'Sep 20, 2015 @ 21:30:00.000' ;
527+ const toTime = 'Sep 20, 2015 @ 23:30:00.000' ;
528+ await PageObjects . timePicker . setAbsoluteRange ( fromTime , toTime ) ;
529+ helperScaledLabelText = await helperScaledLabel . getVisibleText ( ) ;
530+ expect ( helperScaledLabelText ) . to . include . string ( 'to minute' ) ;
531+ } ) ;
491532 } ) ;
492533 } ) ;
493534 } ) ;
0 commit comments