feat: ci build/test/make (github workflows)

This commit is contained in:
Amadou Ada DIENE
2021-08-01 23:56:41 +02:00
parent 23dd9f5cc8
commit 351eb1a7f0
8 changed files with 129 additions and 46 deletions

View File

@@ -4,7 +4,6 @@ const { SpecReporter } = require('jasmine-spec-reporter');
const jasmine = new Jasmine();
jasmine.loadConfig({
showColors: true,
defaultTimeoutInterval: 15000,
spec_dir: 'workspaces/electron-e2e',
spec_files: ['./**/*-spec.ts'],
helpers: ['./**/*-helper.ts'],

View File

@@ -0,0 +1,32 @@
import * as path from 'path';
import { Application } from 'spectron';
export async function startApp(): Promise<Application> {
// Path to local electron binary
let electronPath = path.join(
__dirname,
'../../../node_modules/.bin/electron'
);
if (process.platform === 'win32') {
electronPath += '.cmd';
}
// Init local packaged app
const app = new Application({
path: electronPath,
args: ['.webpack/main/index.js'],
});
// Init local app and wait until window loaded
await app.start();
await app.client.waitUntilWindowLoaded();
return app;
}
export async function stopApp(app: Application): Promise<void> {
if (app && app.isRunning()) {
// Wait 1 second and then stop local app
await new Promise((resolve) => setTimeout(resolve, 1000));
await app.stop();
}
}

View File

@@ -1,25 +1,15 @@
import * as path from 'path';
import { Application } from 'spectron';
import { startApp, stopApp } from './_hooks';
describe('A simple test to verify a visible window is opened with a title', () => {
// Init local app
const app = new Application({
path: path.join(__dirname, '../../../node_modules/.bin/electron'),
args: [path.join(__dirname, '../../../.webpack/main/index.js')],
});
let app: Application;
beforeAll(async () => {
// Init local app and wait until window loaded
await app.start();
await app.client.waitUntilWindowLoaded();
app = await startApp();
});
afterAll(async () => {
if (app && app.isRunning()) {
// Wait 1 second and then stop local app
await new Promise((resolve) => setTimeout(resolve, 1000));
await app.stop();
}
await stopApp(app);
});
it('shows an initial window', async () => {