@@ -63,8 +63,7 @@ define(function (require, exports, module) {
6363 ProjectManager = null ;
6464 testWindow = null ;
6565 brackets = null ;
66- // comment out below line if you want to debug the test window post running tests
67- //SpecRunnerUtils.closeTestWindow();
66+ SpecRunnerUtils . closeTestWindow ( ) ;
6867 } ) ;
6968
7069 async function closeSession ( ) {
@@ -167,12 +166,21 @@ define(function (require, exports, module) {
167166 async function createAndVerifyFileContents ( fileName , firstLineOfContent ) {
168167 await awaitsForDone ( CommandManager . execute ( Commands . FILE_NEW ) ,
169168 "new file" ) ;
170- await awaits ( 300 ) ;
169+ await awaitsFor ( function ( ) {
170+ return ! ! $ ( ".jstree-rename-input" ) [ 0 ] ;
171+ } , "input to come" ) ;
171172 let fileNameInput = $ ( ".jstree-rename-input" ) ;
173+ expect ( fileNameInput [ 0 ] ) . toBeDefined ( ) ;
172174 await _deleteFile ( fileName ) ;
173175 fileNameInput . val ( fileName ) ;
174176 SpecRunnerUtils . simulateKeyEvent ( KeyEvent . DOM_VK_RETURN , "keydown" , fileNameInput [ 0 ] ) ;
175- await awaits ( 100 ) ;
177+
178+ await awaitsFor ( function ( ) {
179+ return ! $ ( ".jstree-rename-input" ) [ 0 ] ;
180+ } , "input to go away" ) ;
181+ await awaitsFor ( function ( ) {
182+ return ! ! EditorManager . getActiveEditor ( ) ;
183+ } , "wait for editor to be active" ) ;
176184 expect ( EditorManager . getActiveEditor ( ) . document . getText ( ) . split ( "\n" ) [ 0 ] )
177185 . toBe ( firstLineOfContent ) ;
178186 await closeSession ( ) ;
0 commit comments