Commit cdb3c70a authored by Tasso Evangelista's avatar Tasso Evangelista

Add a simple application launch e2e test

parent 3fc75b8b
import { expect } from 'chai';
import testUtils from './utils';
describe('application launch', function () {
beforeEach(testUtils.beforeEach);
afterEach(testUtils.afterEach);
it.skip('shows hello world text on screen after launch', function () {
return this.app.client.getText('#greet').then(function (text) {
expect(text).to.equal('Hello World!');
});
});
});
import { expect } from 'chai';
import { app, startApp, stopApp } from './utils';
import packageJson from '../package.json';
describe('application launch', function () {
before(startApp);
after(stopApp);
it('shows the main window', async function () {
expect(await app.browserWindow.isVisible()).to.be.true;
expect(await app.browserWindow.getTitle()).to.be.equal(packageJson.productName);
});
});
import path from 'path';
import electron from 'electron';
import { Application } from 'spectron';
var beforeEach = function () {
export let app = null;
export async function startApp () {
this.timeout(10000);
this.app = new Application({
app = new Application({
path: electron,
args: ['.'],
startTimeout: 10000,
waitTimeout: 10000,
cwd: process.cwd(),
args: [path.join(__dirname, '..')],
quitTimeout: 5000,
startTimeout: 5000,
waitTimeout: 5000,
});
return this.app.start();
await app.start();
await app.client.waitUntilWindowLoaded();
};
var afterEach = function () {
export async function stopApp () {
this.timeout(10000);
if (this.app && this.app.isRunning()) {
return this.app.stop();
}
};
export default {
beforeEach: beforeEach,
afterEach: afterEach,
if (app && app.isRunning()) {
const logs = await app.client.getMainProcessLogs();
logs.forEach(log => console.log(log));
await app.stop();
app = null;
}
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment