mirror of https://github.com/Kylart/KawAnime.git
Structured tests properly, no big file
This commit is contained in:
parent
25e53e269d
commit
18c913dd33
|
@ -1,31 +1,4 @@
|
|||
const { Application } = require('spectron')
|
||||
const electron = require('electron')
|
||||
const chai = require('chai')
|
||||
const chaiAsPromised = require('chai-as-promised')
|
||||
|
||||
chai.should()
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
describe('Launch app', function () {
|
||||
this.timeout(10000)
|
||||
|
||||
before(async function () {
|
||||
this.app = new Application({
|
||||
path: electron,
|
||||
args: ['dist/bundled/background.js']
|
||||
})
|
||||
|
||||
await this.app.start()
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
chaiAsPromised.transferPromiseness = this.app.transferPromiseness
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
return this.app.stop()
|
||||
})
|
||||
|
||||
module.exports = function () {
|
||||
describe('Downloader modal', function () {
|
||||
it('should open the downloader modal', function () {
|
||||
return this.app.client
|
||||
|
@ -59,18 +32,4 @@ describe('Launch app', function () {
|
|||
// return this.app.client
|
||||
// })
|
||||
})
|
||||
|
||||
it('should be visible', async 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)
|
||||
})
|
||||
})
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
require('./downloader.spec')()
|
|
@ -0,0 +1 @@
|
|||
require('./window.spec')()
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = function () {
|
||||
describe('General window behaviour', function () {
|
||||
it('should be visible', async 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)
|
||||
})
|
||||
})
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
const { Application } = require('spectron')
|
||||
const electron = require('electron')
|
||||
const chai = require('chai')
|
||||
const chaiAsPromised = require('chai-as-promised')
|
||||
|
||||
chai.should()
|
||||
chai.use(chaiAsPromised)
|
||||
|
||||
module.exports = function () {
|
||||
before(async function () {
|
||||
this.app = new Application({
|
||||
path: electron,
|
||||
args: ['dist/bundled/background.js']
|
||||
})
|
||||
|
||||
await this.app.start()
|
||||
})
|
||||
|
||||
beforeEach(function () {
|
||||
chaiAsPromised.transferPromiseness = this.app.transferPromiseness
|
||||
})
|
||||
|
||||
after(async function () {
|
||||
return this.app.stop()
|
||||
})
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
/**
|
||||
* We have to do it that way because we don't want to restart the app
|
||||
* several times. Restarting would mean spamming the providers and
|
||||
* might get us useless 429.
|
||||
*
|
||||
* Also, the end user will probably only start the app once.
|
||||
*
|
||||
* We'll make each app test so that it leaves the app in a neutral state,
|
||||
* meaning that any action should be possible once any test is done.
|
||||
*/
|
||||
|
||||
describe('KawAnime main test routine', function () {
|
||||
require('./hooks')()
|
||||
|
||||
require('./container')
|
||||
require('./app')
|
||||
})
|
Loading…
Reference in New Issue