mirror of
https://github.com/desktop/desktop
synced 2024-09-19 16:12:20 +00:00
Add initial integration test using spectron
This commit is contained in:
parent
3110cb5f9a
commit
92395f6279
47
app/test/integration/launch-test.ts
Normal file
47
app/test/integration/launch-test.ts
Normal file
|
@ -0,0 +1,47 @@
|
|||
import * as chai from 'chai'
|
||||
|
||||
const chaiAsPromised = require('chai-as-promised')
|
||||
const { Application } = require('spectron')
|
||||
const path = require('path')
|
||||
|
||||
chai.should()
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
describe('App', () => {
|
||||
let app: any
|
||||
|
||||
beforeEach(function () {
|
||||
let appPath = path.join(__dirname, '..', '..', '..', 'node_modules', '.bin', 'electron')
|
||||
if (process.platform === 'win32') {
|
||||
appPath += '.cmd'
|
||||
}
|
||||
app = new Application({
|
||||
path: appPath,
|
||||
args: [
|
||||
path.join(__dirname, '..', '..', '..', 'out')
|
||||
]
|
||||
})
|
||||
return app.start()
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
chaiAsPromised.transferPromiseness = app.transferPromiseness
|
||||
})
|
||||
|
||||
afterEach(function () {
|
||||
if (app && app.isRunning()) {
|
||||
return app.stop()
|
||||
}
|
||||
})
|
||||
|
||||
it('opens a window on launch', function () {
|
||||
return app.client.waitUntilWindowLoaded()
|
||||
.getWindowCount().should.eventually.equal(2)
|
||||
.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)
|
||||
})
|
||||
})
|
|
@ -5,7 +5,9 @@
|
|||
},
|
||||
"description": "The People's Glorious GitHub Client's build dependencies",
|
||||
"scripts": {
|
||||
"test": "cross-env TEST_ENV=1 ELECTRON_NO_ATTACH_CONSOLE=1 electron-mocha --renderer --require ts-node/register app/test/*.ts app/test/*.tsx",
|
||||
"test:integration": "cross-env TEST_ENV=1 ELECTRON_NO_ATTACH_CONSOLE=1 mocha --require ts-node/register app/test/integration/*.ts",
|
||||
"test:unit": "cross-env TEST_ENV=1 ELECTRON_NO_ATTACH_CONSOLE=1 electron-mocha --renderer --require ts-node/register app/test/*.ts app/test/*.tsx",
|
||||
"test": "npm run test:unit && npm run test:integration",
|
||||
"postinstall": "typings install && cd app && npm install && cd .. && git submodule update --recursive --init",
|
||||
"start": "node script/start",
|
||||
"compile:dev": "cross-env NODE_ENV=development webpack --config app/webpack.development.js",
|
||||
|
@ -35,6 +37,7 @@
|
|||
"babel-preset-react-hmre": "^1.1.1",
|
||||
"babel-preset-stage-0": "^6.5.0",
|
||||
"chai": "^3.5.0",
|
||||
"chai-as-promised": "^5.3.0",
|
||||
"cross-env": "^1.0.8",
|
||||
"css-loader": "^0.23.1",
|
||||
"electron-mocha": "2.1.0",
|
||||
|
@ -52,6 +55,7 @@
|
|||
"request": "^2.72.0",
|
||||
"rimraf": "^2.5.2",
|
||||
"sass-loader": "^3.2.0",
|
||||
"spectron": "^3.3.0",
|
||||
"style-loader": "^0.13.1",
|
||||
"to-camel-case": "^1.0.0",
|
||||
"ts-loader": "^0.8.2",
|
||||
|
|
Loading…
Reference in a new issue