       waitsForPromise ->
         activationPromise
 
-      waitsForAnimationFrame()
+      waits()
 
       runs ->
         expect(leftEditorElement.querySelector('.autocomplete')).toExist()

        atom.commands.dispatch document.activeElement, 'autocomplete:toggle'

      waitsForPromise -> activationPromise
      waitsForAnimationFrame()

      runs ->
        expect(editor.lineTextForBufferRow(10)).toBe "extra:shift:extra"

        atom.commands.dispatch document.activeElement, 'core:confirm'

      waitsForAnimationFrame()

      runs ->
        expect(editor.lineTextForBufferRow(10)).toBe "extra:shift:extra"

      waitsForPromise ->
        activationPromise

      waits()
      runs ->
        expect(textEditorElement.querySelector('.autocomplete')).toExist()
        atom.packages.deactivatePackage('autocomplete')

      waits()
      runs ->
        expect(textEditorElement.querySelector('.autocomplete')).not.toExist()

        atom.workspace.getActivePane().splitRight(copyActiveItem: true)
        atom.commands.dispatch atom.views.getView(atom.workspace.getActivePaneItem()), "autocomplete:toggle"

      waits()
      runs ->
        expect(workspaceElement.querySelector('.autocomplete')).not.toExist()

