             expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])).toHaveLength 0
             expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
 
-            atom.packages.activatePackage("package-with-keymaps")
-
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
-            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
+            waitsForPromise ->
+              atom.packages.activatePackage("package-with-keymaps")
+
+            runs ->
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe "test-1"
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element2[0])[0].command).toBe "test-2"
+              expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element3[0])).toHaveLength 0
 
         describe "when the metadata contains a 'keymaps' manifest", ->
           it "loads only the keymaps specified by the manifest, in the specified order", ->


            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])).toHaveLength 0

            atom.packages.activatePackage("package-with-keymaps-manifest")

            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-z', target:element1[0])[0].command).toBe 'keymap-1'
            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-n', target:element1[0])[0].command).toBe 'keymap-2'
            expect(atom.keymaps.findKeyBindings(keystrokes:'ctrl-y', target:element3[0])).toHaveLength 0

      describe "menu loading", ->
        beforeEach ->


            expect(atom.contextMenu.templateForElement(element)).toEqual []

            waitsForPromise ->
              atom.packages.activatePackage("package-with-menus")

            runs ->
              expect(atom.menu.template.length).toBe 2
              expect(atom.menu.template[0].label).toBe "Second to Last"
              expect(atom.menu.template[1].label).toBe "Last"
              expect(atom.contextMenu.templateForElement(element)[0].label).toBe "Menu item 1"
              expect(atom.contextMenu.templateForElement(element)[1].label).toBe "Menu item 2"
              expect(atom.contextMenu.templateForElement(element)[2].label).toBe "Menu item 3"

        describe "when the metadata contains a 'menus' manifest", ->
          it "loads only the menus specified by the manifest, in the specified order", ->
