         waitsForFileToOpen ->
           sampleJs.click()
 
+        waitsForPromise ->
+          atom.workspace.open(atom.project.resolve('tree-view.txt'))
+
         runs ->
-          atom.workspaceView.openSync(atom.project.resolve('tree-view.txt'))
           expect(sampleTxt).toHaveClass 'selected'
           expect(treeView.find('.selected').length).toBe 1
 
       it "selects the path's parent dir if its entry is not visible", ->
-        atom.workspaceView.openSync('dir1/sub-dir1/sub-file1')
-        dirView = treeView.root.find('.directory:contains(dir1)').view()
-        expect(dirView).toHaveClass 'selected'
+        waitsForPromise ->
+          atom.workspace.open('dir1/sub-dir1/sub-file1')
+
+        runs ->
+          dirView = treeView.root.find('.directory:contains(dir1)').view()
+          expect(dirView).toHaveClass 'selected'
 
     describe "when the item has no path", ->
       it "deselects the previously selected entry", ->

        copyDialog = null

        beforeEach ->
          atom.workspaceView.openSync('tree-view.js')
          editorView = atom.workspaceView.getActiveView()
          editorView.trigger "tree-view:duplicate"
          copyDialog = atom.workspaceView.find(".tree-view-dialog").view()

        it "duplicates the current file", ->
          expect(copyDialog.miniEditor.getText()).toBe('tree-view.js')


    describe "when the tree view is shown", ->
      it "focuses the tree view", ->
        waitsForPromise ->
          atom.workspace.open() # When we call focus below, we want an editor to become focused

        runs ->
          atom.workspaceView.focus()
          expect(treeView).toBeVisible()
          atom.workspaceView.trigger 'tree-view:toggle-focus'
          expect(treeView).toBeVisible()
          expect(treeView.list).toMatchSelector(':focus')

      describe "when the tree view is focused", ->
        it "unfocuses the tree view", ->
          waitsForPromise ->
            atom.workspace.open() # When we call focus below, we want an editor to become focused

          runs ->
            treeView.focus()
            expect(treeView).toBeVisible()
            atom.workspaceView.trigger 'tree-view:toggle-focus'
            expect(treeView).toBeVisible()
            expect(treeView.list).not.toMatchSelector(':focus')

  describe "when tree-view:reveal-current-file is triggered on the root view", ->
    beforeEach ->
