         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()
+          waitsForPromise ->
+            atom.workspace.open('tree-view.js')
+
+          runs ->
+            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')

        waitsForFileToOpen ->
          sampleJs.click()

        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'

    describe "when the item has no path", ->
      it "deselects the previously selected entry", ->


  describe "when tool-panel:unfocus is triggered on the tree view", ->
    it "surrenders focus to the root view but remains open", ->
      waitsForPromise ->
        atom.workspace.open() # When we trigger 'tool-panel:unfocus' below, we want an editor to become focused

      runs ->
        atom.workspaceView.attachToDom()
        treeView.focus()
        expect(treeView.list).toMatchSelector(':focus')
        treeView.trigger 'tool-panel:unfocus'
        expect(treeView).toBeVisible()
        expect(treeView.list).not.toMatchSelector(':focus')
        expect(atom.workspaceView.getActiveView().isFocused).toBeTruthy()

  describe "copy path commands", ->
    [pathToSelect, relativizedPath] = []
