fix/ spectron e2e test
This commit is contained in:
@@ -3,34 +3,22 @@ const ELECTRON_PATH = require('electron'); // Require Electron from the binaries
|
||||
const PATH = require('path');
|
||||
|
||||
export default function setup(): void {
|
||||
beforeEach(async () => {
|
||||
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: ELECTRON_PATH,
|
||||
|
||||
// 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, '..')],
|
||||
// and the package.json located in app folder.
|
||||
args: [PATH.join(__dirname, '../app/main.js'), PATH.join(__dirname, '../app/package.json')],
|
||||
webdriverOptions: {}
|
||||
});
|
||||
|
||||
await this.app.start();
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
afterEach(async function() {
|
||||
if (this.app && this.app.isRunning()) {
|
||||
await this.app.stop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user