fix/ e2e tests with Spectron

This commit is contained in:
Maxime GRIS
2020-08-12 22:21:04 +02:00
parent 84598a5146
commit 472afc8675
3 changed files with 16 additions and 16 deletions

View File

@@ -26,16 +26,13 @@ export default function setup(): void {
args: [path.join(__dirname, '..')],
webdriverOptions: {}
});
await this.app.start();
const browser = this.app.client;
await browser.waitUntilWindowLoaded();
browser.timeouts('script', 15000);
});
afterEach(function () {
afterEach(async function () {
if (this.app && this.app.isRunning()) {
return this.app.stop();
await this.app.stop();
}
});
}

View File

@@ -4,19 +4,15 @@ import { SpectronClient } from 'spectron';
import commonSetup from './common-setup';
describe('angular-electron App', function () {
commonSetup.apply(this);
let browser: any;
let client: SpectronClient;
beforeEach(function () {
client = this.app.client;
browser = client as any;
});
beforeEach(async function() {
await this.app.start();
it('should display message saying App works !', async function () {
const text = await browser.getText('app-home h1');
expect(text).to.equal('App works !');
client = this.app.client;
});
it('creates initial windows', async function () {
@@ -24,4 +20,10 @@ describe('angular-electron App', function () {
expect(count).to.equal(1);
});
it('should display message saying App works !', async function () {
const elem = await client.$('app-home h1');
const text = await elem.getText();
expect(text).to.equal('App works !');
});
});

View File

@@ -4,10 +4,11 @@
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"types": [
"mocha"
"mocha",
"node"
]
},
"include": [
"e2e/**/*.ts"
"e2e/*.ts"
]
}