Files
WowUp/wowup-electron/e2e/common-setup.ts
jliddev 6819b300af Fix all lint errors
Fix broken open dialog
2021-06-10 23:25:34 -05:00

39 lines
1.2 KiB
TypeScript

const Application = require("spectron").Application;
const electronPath = require("electron"); // Require Electron from the binaries included in node_modules.
const path = require("path");
export default function setup(): void {
beforeEach(async function () {
this.app = new Application({
// Your electron path can be any binary
// i.e for OSX an example path could be '/Applications/MyApp.app/Contents/MacOS/MyApp'
// But for the sake of the example we fetch it from our node_modules.
path: electronPath,
// Assuming you have the following directory structure
// |__ my project
// |__ ...
// |__ main.js
// |__ package.json
// |__ index.html
// |__ ...
// |__ test
// |__ spec.js <- You are here! ~ Well you should be.
// The following line tells spectron to look and use the main.js file
// and the package.json located 1 level above.
args: [path.join(__dirname, "..")],
webdriverOptions: {},
});
await this.app.start();
});
afterEach(async function () {
if (this.app && this.app.isRunning()) {
await this.app.stop();
}
});
}