mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
build: fix configuration for e2e tests
This commit is contained in:
5 files changed
+52
-49
No files matched your search
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"require": "ts-node/register",
|
||||
"watch-files": [
|
||||
"./e2e/**/*.ts"
|
||||
],
|
||||
"timeout": 300000
|
||||
}
|
||||
+26
-30
@@ -3,39 +3,35 @@ const electronPath = require('electron'); // Require Electron from the binaries
|
||||
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,
|
||||
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
|
||||
// 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.
|
||||
// |__ 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: {}
|
||||
// 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();
|
||||
});
|
||||
await this.app.start();
|
||||
const browser = this.app.client;
|
||||
await browser.waitUntilWindowLoaded();
|
||||
|
||||
browser.timeouts('script', 15000);
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
if (this.app && this.app.isRunning()) {
|
||||
return this.app.stop();
|
||||
}
|
||||
});
|
||||
afterEach(function () {
|
||||
if (this.app && this.app.isRunning()) {
|
||||
return this.app.stop();
|
||||
}
|
||||
});
|
||||
}
|
||||
+14
-16
@@ -4,24 +4,22 @@ import { SpectronClient } from 'spectron';
|
||||
import commonSetup from './common-setup';
|
||||
|
||||
describe('angular-electron App', function () {
|
||||
commonSetup.apply(this);
|
||||
commonSetup.apply(this);
|
||||
|
||||
let browser: any;
|
||||
let client: SpectronClient;
|
||||
let client: SpectronClient;
|
||||
|
||||
beforeEach(function () {
|
||||
client = this.app.client;
|
||||
browser = client as any;
|
||||
});
|
||||
beforeEach(function () {
|
||||
client = this.app.client;
|
||||
});
|
||||
|
||||
it('should display message saying App works !', async function () {
|
||||
const text = await browser.getText('app-home h1');
|
||||
expect(text).to.equal('App works !');
|
||||
});
|
||||
|
||||
it('creates initial windows', async function () {
|
||||
const count = await client.getWindowCount();
|
||||
expect(count).to.equal(1);
|
||||
});
|
||||
it('creates initial windows', async function () {
|
||||
const count = await client.getWindowCount();
|
||||
expect(count).to.equal(1);
|
||||
});
|
||||
|
||||
it('should contain name of the app', async function () {
|
||||
const elem = await client.$('.title');
|
||||
const text = await elem.getText();
|
||||
expect(text).to.equal('IPTVnator');
|
||||
});
|
||||
});
|
||||
@@ -4,10 +4,11 @@
|
||||
"outDir": "../out-tsc/e2e",
|
||||
"module": "commonjs",
|
||||
"types": [
|
||||
"mocha"
|
||||
"mocha",
|
||||
"node"
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"e2e/**/*.ts"
|
||||
"**.ts"
|
||||
]
|
||||
}
|
||||
+2
-1
@@ -35,7 +35,8 @@
|
||||
"electron:build": "npm run build:prod && electron-builder build",
|
||||
"test": "jest",
|
||||
"test:watch": "jest --watch",
|
||||
"e2e": "npm run build:prod && cross-env TS_NODE_PROJECT='e2e/tsconfig.e2e.json' mocha --timeout 300000 --require ts-node/register e2e/**/*.e2e.ts",
|
||||
"e2e": "npm run build:prod && cross-env TS_NODE_PROJECT='e2e/tsconfig.e2e.json' mocha e2e/**/*.ts --config ./.mocharc.json",
|
||||
"e2e:watch": "npm run e2e -- --watch",
|
||||
"version": "conventional-changelog -i CHANGELOG.md -p angular -s -r 0 && git add CHANGELOG.md",
|
||||
"lint": "ng lint"
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user