         atom.packages.activatePackage('tree-view')
 
       runs ->
-        atom.workspaceView.trigger 'tree-view:toggle'
-        treeView = atom.workspaceView.find(".tree-view").view()
+        atom.commands.dispatch(workspaceElement, 'tree-view:toggle')
+        treeView = $(atom.workspace.getLeftPanels()[0].getItemView()).view()
         dirView = $(treeView.root.entries).find('.directory:contains(test-dir)')
         dirView[0].expand()
         fileView1 = treeView.find('.file:contains(test-file1.txt)')

      describe "when the tree view is focused", ->
        it "hides the tree view", ->
          treeView.focus()
          atom.workspaceView.trigger 'tree-view:toggle'
          expect(treeView).toBeHidden()

      describe "when the tree view is not focused", ->
        it "hides the tree view", ->
          treeView.focus()
          atom.workspaceView.trigger 'tree-view:toggle'
          expect(treeView).toBeHidden()

    describe "when the tree view is hidden", ->
      it "shows and focuses the tree view", ->
        treeView.detach()
        atom.workspaceView.trigger 'tree-view:toggle'
        expect(treeView.hasParent()).toBeTruthy()
        expect(treeView.list).toMatchSelector(':focus')

    describe "when tree-view:toggle-side is triggered on the root view", ->
      beforeEach ->
        atom.workspaceView.attachToDom()

      describe "when the tree view is on the left", ->
        it "should be moved to the right", ->
          expect(treeView).toBeVisible()
          atom.workspaceView.trigger 'tree-view:toggle-side'
          expect(treeView).toMatchSelector('[data-show-on-right-side="true"]')

      describe "when the tree view is on the right", ->
        beforeEach ->
          atom.workspaceView.trigger 'tree-view:toggle-side'

        it "should be moved to the left", ->
          expect(treeView).toBeVisible()
          atom.workspaceView.trigger 'tree-view:toggle-side'
          expect(treeView).toMatchSelector('[data-show-on-right-side="false"]')

  describe "when tree-view:toggle-focus is triggered on the root view", ->
    beforeEach ->
      atom.workspaceView.attachToDom()

    describe "when the tree view is hidden", ->
      it "shows and focuses the tree view", ->
        treeView.detach()
        atom.workspaceView.trigger 'tree-view:toggle-focus'
        expect(treeView.hasParent()).toBeTruthy()
        expect(treeView.list).toMatchSelector(':focus')



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

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