             atom.workspace.open('tree-view.js')
 
           runs ->
-            editorView = atom.workspaceView.getActiveView()
-            editorView.trigger "tree-view:duplicate"
-            copyDialog = atom.workspaceView.find(".tree-view-dialog").view()
+            editorElement = atom.views.getView(atom.workspace.getActivePaneItem())
+            atom.commands.dispatch(editorElement, "tree-view:duplicate")
+            copyDialog = $(atom.workspace.getModalPanels()[0].getItemView()).view()
 
         it "duplicates the current file", ->
           expect(copyDialog.miniEditor.getText()).toBe('tree-view.js')


          runs ->
            treeView.trigger "tree-view:duplicate"
            copyDialog = atom.workspaceView.find(".tree-view-dialog").view()

        it "selects the entire file name", ->
          expect(copyDialog).toExist()


          runs ->
            treeView.trigger "tree-view:move"
            moveDialog = $(atom.workspace.getModalPanels()[0].getItemView()).view()

        it "selects the entire file name", ->
          expect(moveDialog).toExist()
