Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

New Spectron! #168

Merged
merged 7 commits into from
Apr 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"request": "^2.70.0",
"rimraf": "^2.5.2",
"signcode": "^0.4.0",
"spectron": "~1.37.0",
"spectron": "~2.37.0",
"standard": "^6.0.8"
},
"dependencies": {
Expand Down
27 changes: 13 additions & 14 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ describe('demo app', function () {
}
}

const setupApp = function (app) {
chaiAsPromised.transferPromiseness = app.transferPromiseness
return app.client.waitUntilWindowLoaded()
}

const startApp = function () {
app = new Application({
path: path.join(__dirname, '..', 'node_modules', '.bin', 'electron'),
Expand All @@ -38,17 +43,11 @@ describe('demo app', function () {
waitTimeout: 10000
})

return app.start().then(function () {
chaiAsPromised.transferPromiseness = app.client.transferPromiseness
}).then(function () {
return app.client.waitUntilWindowLoaded()
})
return app.start().then(setupApp)
}

const restartApp = function () {
return app.stop().then(function () {
return startApp()
})
return app.restart().then(setupApp)
}

before(function () {
Expand All @@ -64,12 +63,12 @@ describe('demo app', function () {

it('opens a window displaying the about page', function () {
return app.client.getWindowCount().should.eventually.equal(1)
.isWindowMinimized().should.eventually.be.false
.isWindowDevToolsOpened().should.eventually.be.false
.isWindowVisible().should.eventually.be.true
.isWindowFocused().should.eventually.be.true
.getWindowWidth().should.eventually.be.above(0)
.getWindowHeight().should.eventually.be.above(0)
.browserWindow.isMinimized().should.eventually.be.false
.browserWindow.isDevToolsOpened().should.eventually.be.false
.browserWindow.isVisible().should.eventually.be.true
.browserWindow.isFocused().should.eventually.be.true
.browserWindow.getBounds().should.eventually.have.property('width').and.be.above(0)
.browserWindow.getBounds().should.eventually.have.property('height').and.be.above(0)
.getTitle().should.eventually.equal('Electron API Demos')
.waitForVisible('#about-modal').should.eventually.be.true
.isVisible('.js-nav').should.eventually.be.false
Expand Down