         expect(symbolsView.error).not.toBeVisible()
 
     it "caches tags until the buffer changes", ->
-      editor = atom.workspaceView.openSync('sample.js')
-      atom.workspaceView.getActiveView().trigger "symbols-view:toggle-file-symbols"
+      waitsForPromise ->
+        atom.workspace.open('sample.js')
+
+      runs ->
+        editor = atom.workspace.getActiveEditor()
+        atom.workspaceView.getActiveView().trigger "symbols-view:toggle-file-symbols"
 
       waitsForPromise ->
         activationPromise

        expect(editor.getCursorBufferPosition()).toEqual [0,2]

    it "moves the cursor to the declaration there is a single matching declaration", ->
      atom.workspaceView.openSync("tagged.js")
      editor = atom.workspaceView.getActivePaneItem()
      editor.setCursorBufferPosition([6,24])
      spyOn(SymbolsView.prototype, "moveToPosition").andCallThrough()
      atom.workspaceView.getActiveView().trigger 'symbols-view:go-to-declaration'

      waitsFor ->
        SymbolsView::moveToPosition.callCount is 1


    describe "return from declaration", ->
      it "doesn't do anything when no go-to have been triggered", ->
        waitsForPromise ->
          atom.workspace.open("tagged.js")

        runs ->
          editor = atom.workspaceView.getActivePaneItem()
          editor.setCursorBufferPosition([6,0])
          atom.workspaceView.getActiveView().trigger 'symbols-view:return-from-declaration'
          expect(editor.getCursorBufferPosition()).toEqual [6,0]

      it "returns to previous row and column", ->
        waitsForPromise ->
          atom.workspace.open("tagged.js")

        runs ->
          editor = atom.workspaceView.getActivePaneItem()
          editor.setCursorBufferPosition([6,24])
          spyOn(SymbolsView.prototype, "moveToPosition").andCallThrough()
          atom.workspaceView.getActiveView().trigger 'symbols-view:go-to-declaration'

        waitsFor ->
          SymbolsView::moveToPosition.callCount is 1
