mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Always quit Atom realistically in integration specs
This commit is contained in:
@@ -94,6 +94,15 @@ buildAtomClient = (args, env) ->
|
||||
]), env: extend({}, process.env, env))
|
||||
done()
|
||||
|
||||
.addCommand "dispatchCommand", (command, done) ->
|
||||
@execute "atom.commands.dispatch(document.activeElement, '#{command}')"
|
||||
.call(done)
|
||||
|
||||
.addCommand "simulateQuit", (done) ->
|
||||
@execute -> atom.unloadEditorWindow()
|
||||
.execute -> require("remote").require("app").emit("before-quit")
|
||||
.call(done)
|
||||
|
||||
module.exports = (args, env, fn) ->
|
||||
[chromedriver, chromedriverLogs, chromedriverExit] = []
|
||||
|
||||
@@ -119,6 +128,7 @@ module.exports = (args, env, fn) ->
|
||||
waitsFor("webdriver to finish", (done) ->
|
||||
finish = once ->
|
||||
client
|
||||
.simulateQuit()
|
||||
.end()
|
||||
.then(-> chromedriver.kill())
|
||||
.then(chromedriverExit.then(
|
||||
@@ -133,7 +143,7 @@ module.exports = (args, env, fn) ->
|
||||
client = buildAtomClient(args, env)
|
||||
|
||||
client.on "error", (err) ->
|
||||
jasmine.getEnv().currentSpec.fail(JSON.stringify(err))
|
||||
jasmine.getEnv().currentSpec.fail(new Error(err.response?.body?.value?.message))
|
||||
finish()
|
||||
|
||||
fn(client.init()).then(finish)
|
||||
|
||||
@@ -36,6 +36,7 @@ describe "Starting Atom", ->
|
||||
.keys("Hello!")
|
||||
.execute -> atom.workspace.getActiveTextEditor().getText()
|
||||
.then ({value}) -> expect(value).toBe "Hello!"
|
||||
.dispatchCommand("editor:delete-line")
|
||||
|
||||
describe "when there is already a window open", ->
|
||||
it "reuses that window when opening files, but not when opening directories", ->
|
||||
@@ -75,7 +76,6 @@ describe "Starting Atom", ->
|
||||
.waitForPaneItemCount(0, 3000)
|
||||
.execute -> atom.workspace.open()
|
||||
.waitForPaneItemCount(1, 3000)
|
||||
.execute -> atom.unloadEditorWindow()
|
||||
|
||||
runAtom [tempDirPath], {ATOM_HOME: atomHome}, (client) ->
|
||||
client
|
||||
|
||||
Reference in New Issue
Block a user