         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


    describe "return from declaration", ->
      it "doesn't do anything when no go-to have been triggered", ->
        atom.workspaceView.openSync("tagged.js")
        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", ->
        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 "project symbols", ->
    it "displays all tags", ->
      jasmine.unspy(window, 'setTimeout')

      waitsForPromise ->
        atom.workspace.open("tagged.js")

      runs ->
        expect(atom.workspaceView.find('.symbols-view')).not.toExist()
        atom.workspaceView.trigger "symbols-view:toggle-project-symbols"

      waitsForPromise ->
        activationPromise
