|
| 1 | +const { Application } = require('spectron'); |
| 2 | +const assert = require('assert'); |
| 3 | +const path = require('path'); |
| 4 | +const electronPath = path.join(__dirname, '..', 'node_modules', '.bin', 'electron'); |
| 5 | + |
| 6 | +if(process.platform === "win32"){ |
| 7 | + electronPath += ".cmd"; |
| 8 | +} |
| 9 | + |
| 10 | +describe('Application launch', function () { |
| 11 | + this.timeout(30000); |
| 12 | + |
| 13 | + const app = new Application({ |
| 14 | + path: electronPath, |
| 15 | + args: [path.join(__dirname, '..')], |
| 16 | + }); |
| 17 | + |
| 18 | + beforeEach(()=>app.start()) |
| 19 | + afterEach(()=>app.stop()) |
| 20 | + |
| 21 | + it('shows an initial window', async () => { |
| 22 | + await app.client.waitUntilWindowLoaded(); |
| 23 | + const count = await app.client.getWindowCount(); |
| 24 | + assert.equal(count, 1); |
| 25 | + }); |
| 26 | + it('is window is visible', async () =>{ |
| 27 | + await app.client.waitUntilWindowLoaded(); |
| 28 | + const isVisible = await app.browserWindow.isVisible(); |
| 29 | + assert.equal(isVisible, true); |
| 30 | + }); |
| 31 | + it('window title is chronos', async () =>{ |
| 32 | + await app.client.waitUntilWindowLoaded(); |
| 33 | + const title = await app.browserWindow.getTitle(); |
| 34 | + assert.equal(title, 'chronos'); |
| 35 | + }); |
| 36 | +}); |
| 37 | + |
| 38 | + |
0 commit comments