diff --git a/package.json b/package.json index 0bf805b6..7163c1e3 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/tests/index.js b/tests/index.js index a76690b2..1d00f75e 100644 --- a/tests/index.js +++ b/tests/index.js @@ -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'), @@ -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 () { @@ -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