KawAnime/tests/unit/electron.spec.js

42 lines
1.1 KiB
JavaScript

import testWithSpectron from 'vue-cli-plugin-electron-builder/lib/testWithSpectron'
import chai from 'chai'
import chaiAsPromised from 'chai-as-promised'
chai.should()
chai.use(chaiAsPromised)
describe('Application launch', function () {
this.timeout(30000)
beforeEach(function () {
return testWithSpectron().then(instance => {
this.app = instance.app
this.stopServe = instance.stopServe
})
})
beforeEach(function () {
chaiAsPromised.transferPromiseness = this.app.transferPromiseness
})
afterEach(function () {
if (this.app && this.app.isRunning()) {
return this.stopServe()
}
})
it('opens a window', function () {
return this.app.client
.getWindowCount()
.should.eventually.have.at.least(1)
.browserWindow.isMinimized()
.should.eventually.be.false.browserWindow.isVisible()
.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)
})
})