Move another integration test

This commit is contained in:
Antonio Scandurra
2016-08-12 10:06:10 +02:00
parent a8c73f0529
commit e8c7b27af4
2 changed files with 16 additions and 16 deletions

View File

@@ -24,22 +24,6 @@ describe "Starting Atom", ->
tempDirPath = temp.mkdirSync("empty-dir")
otherTempDirPath = temp.mkdirSync("another-temp-dir")
describe "opening a new file", ->
it "opens the parent directory and creates an empty text editor", ->
runAtom [path.join(tempDirPath, "new-file")], {ATOM_HOME: atomHome}, (client) ->
client
.treeViewRootDirectories()
.then ({value}) -> expect(value).toEqual([tempDirPath])
.waitForExist("atom-text-editor", 5000)
.then (exists) -> expect(exists).toBe true
.waitForPaneItemCount(1, 1000)
.click("atom-text-editor")
.keys("Hello!")
.execute -> atom.workspace.getActiveTextEditor().getText()
.then ({value}) -> expect(value).toBe "Hello!"
.dispatchCommand("editor:delete-line")
describe "launching with no path", ->
it "reopens any previously opened windows", ->
runAtom [tempDirPath], {ATOM_HOME: atomHome}, (client) ->

View File

@@ -277,6 +277,21 @@ describe('AtomApplication', function () {
})
assert.equal(itemCount, 0)
})
it('opens an empty text editor and loads its parent directory in the tree-view when launched with a new file path', async function () {
const atomApplication = buildAtomApplication()
const newFilePath = path.join(makeTempDir(), 'new-file')
const window = atomApplication.openWithOptions(parseCommandLine([newFilePath]))
await window.loadedPromise
const {editorTitle, editorText} = await evalInWebContents(window.browserWindow.webContents, function (sendBackToMainProcess) {
atom.workspace.onDidChangeActivePaneItem(function (editor) {
sendBackToMainProcess({editorTitle: editor.getTitle(), editorText: editor.getText()})
})
})
assert.equal(editorTitle, path.basename(newFilePath))
assert.equal(editorText, '')
assert.deepEqual(await getTreeViewRootDirectories(window), [path.dirname(newFilePath)])
})
})
function buildAtomApplication () {
@@ -287,6 +302,7 @@ describe('AtomApplication', function () {
atomApplicationsToDestroy.push(atomApplication)
return atomApplication
}
function makeTempDir (name) {
return fs.realpathSync(temp.mkdirSync(name))
}