import { expect } from 'chai' ; import { EditorView , ModalDialog , TextEditor , Workbench } from 'vscode-extension-tester' ; describe ( 'Sample Modal Dialog Tests' , ( ) => { let dialog ; before ( async ( ) => { await new Workbench ( ) . executeCommand ( 'create new file' ) ; const editor = new TextEditor ( ) ; await editor . typeTextAt ( 1 , 1 , 'text' ) ; await new EditorView ( ) . closeEditor ( await editor . getTitle ( ) ) ; dialog = new ModalDialog ( ) ; } ) ; it ( 'Get the message' , async ( ) => { const message = await dialog . getMessage ( ) ; expect ( message ) . contains ( 'Do you want to save the changes you made' ) ; } ) ; it ( 'Get the details' , async ( ) => { const details = await dialog . getDetails ( ) ; expect ( details ) . equals ( `Your changes will be lost if you don't save them.` ) ; } ) ; it ( 'Use the buttons' , async ( ) => { const buttons = await dialog . getButtons ( ) ; expect ( buttons . length ) . equals ( 3 ) ; await dialog . pushButton ( `Don't Save` ) ; } ) ; } ) ;