import { browser , by , element , ExpectedConditions as EC } from 'protractor' ; describe ( 'contacts test' , ( ) => { beforeEach ( ( ) => { return browser . waitForAngularEnabled ( true ) . then ( ( ) => { return browser . get ( '/#/contact/4' ) ; } ) ; } ) ; it ( 'should open the dialog with waitForAngular' , ( done ) => { let feedButton = element ( by . css ( 'button.feed-button' ) ) ; let closeButton = element ( by . css ( 'button[mat-dialog-close]' ) ) ; let dialogTitle = element ( by . css ( 'app-contact-feed h2.mat-dialog-title' ) ) ; return feedButton . click ( ) . then ( ( ) => { return dialogTitle . getText ( ) ; } ) . then ( ( dialogText ) => { expect ( dialogText ) . toContain ( 'Latest posts from Craig Service' ) ; return closeButton . click ( ) ; } ) . then ( ( ) => { return browser . wait ( EC . stalenessOf ( dialogTitle ) , 3000 , 'Waiting for dialog to close' ) ; } ) . then ( ( ) => { return dialogTitle . isPresent ( ) ; } ) . then ( ( dialogTitleIsPresent ) => { expect ( dialogTitleIsPresent ) . toBeFalsy ( ) ; done ( ) ; } ) ; } ) ; it ( 'should open the dialog with waitForAngular' , async ( ) => { let feedButton = element ( by . css ( 'button.feed-button' ) ) ; let closeButton = element ( by . css ( 'button[mat-dialog-close]' ) ) ; let dialogTitle = element ( by . css ( 'app-contact-feed h2.mat-dialog-title' ) ) ; await feedButton . click ( ) ; let dialogText = await dialogTitle . getText ( ) ; expect ( dialogText ) . toContain ( 'Latest posts from Craig Service' ) ; debugger ; await closeButton . click ( ) ; await browser . wait ( EC . stalenessOf ( dialogTitle ) , 3000 , 'Waiting for dialog to close' ) ; let dialogTitleIsPresent = await dialogTitle . isPresent ( ) ; expect ( dialogTitleIsPresent ) . toBeFalsy ( ) ; } ) ; } ) ;