feat: ci build/test/make (github workflows)
This commit is contained in:
@@ -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'],
|
||||
|
||||
32
workspaces/electron-e2e/src/_hooks.ts
Normal file
32
workspaces/electron-e2e/src/_hooks.ts
Normal 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();
|
||||
}
|
||||
}
|
||||
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user