From 9c51f3247be9e899d14716b8d38afa415191417d Mon Sep 17 00:00:00 2001 From: Maxime GRIS Date: Sun, 16 Jul 2017 19:43:04 +0200 Subject: [PATCH] fix/ e2e test with jasmine2 --- e2e/app.e2e-spec.ts | 4 ++-- e2e/app.po.ts | 9 +++------ protractor.conf.js | 14 ++++++++------ src/tsconfig.app.json | 5 ++++- src/tsconfig.spec.json | 5 +++++ 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/e2e/app.e2e-spec.ts b/e2e/app.e2e-spec.ts index c20aeb0..2daec1c 100644 --- a/e2e/app.e2e-spec.ts +++ b/e2e/app.e2e-spec.ts @@ -1,4 +1,5 @@ import { AngularElectronPage } from './app.po'; +import { browser, element, by } from 'protractor'; describe('angular-electron App', () => { let page: AngularElectronPage; @@ -8,7 +9,6 @@ describe('angular-electron App', () => { }); it('should display message saying App works !', () => { - page.navigateTo(); - expect(page.getParagraphText()).toEqual('App works !'); + expect(element(by.css('app-home h1')).getText()).toMatch('App works !'); }); }); diff --git a/e2e/app.po.ts b/e2e/app.po.ts index 5593077..2dedeae 100644 --- a/e2e/app.po.ts +++ b/e2e/app.po.ts @@ -1,11 +1,8 @@ import { browser, element, by } from 'protractor'; +/* tslint:disable */ export class AngularElectronPage { - navigateTo() { - return browser.get('/'); - } - - getParagraphText() { - return element(by.css('app-home h1')).getText(); + navigateTo(route: string) { + return browser.get(route); } } diff --git a/protractor.conf.js b/protractor.conf.js index d112509..5264283 100644 --- a/protractor.conf.js +++ b/protractor.conf.js @@ -4,26 +4,28 @@ const { SpecReporter } = require('jasmine-spec-reporter'); exports.config = { - allScriptsTimeout: 11000, + allScriptsTimeout: 25000, + getPageTimeout: 15000, + delayBrowserTimeInSeconds: 0, specs: [ './e2e/**/*.e2e-spec.ts' ], capabilities: { 'browserName': 'chrome', chromeOptions: { - binary: './node_modules/electron/dist/electron.exe', - args: ['--test-type=webdriver', 'app=dist/main.js'] + binary: './node_modules/electron/dist/electron.exe', + args: ['--test-type=webdriver', 'app=dist/main.js'] } }, directConnect: true, baseUrl: 'http://localhost:4200/', - framework: 'jasmine', + framework: 'jasmine2', jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 30000, - print: function() {} + print: function () { } }, - beforeLaunch: function() { + beforeLaunch: function () { require('ts-node').register({ project: 'e2e/tsconfig.e2e.json' }); diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json index 5e2507d..d826715 100644 --- a/src/tsconfig.app.json +++ b/src/tsconfig.app.json @@ -8,6 +8,9 @@ }, "exclude": [ "test.ts", - "**/*.spec.ts" + "**/*.spec.ts", + "dist", + "app-builds", + "node_modules" ] } diff --git a/src/tsconfig.spec.json b/src/tsconfig.spec.json index 510e3f1..1860d4c 100644 --- a/src/tsconfig.spec.json +++ b/src/tsconfig.spec.json @@ -16,5 +16,10 @@ "include": [ "**/*.spec.ts", "**/*.d.ts" + ], + "exclude": [ + "dist", + "app-builds", + "node_modules" ] }