Add protractor test setup

pull/1/head
Florian Hartwich 2017-05-21 02:16:09 +02:00
parent c250cd2edd
commit 19f82656f1
5 changed files with 55 additions and 18 deletions

View File

@ -0,0 +1,29 @@
import {browser, element, by} from 'protractor';
describe('Access Projectmanager Homepage', function () {
beforeEach(() => {
browser.get('/')
});
it('should start at Dashboard page and brand link should redirect there again', () => {
const startingPage = 'Dashboard';
function validatePage() {
const dashboardNavEntryCssClass = element(by.linkText(startingPage)).element(by.xpath('..')).getAttribute('class');
expect(dashboardNavEntryCssClass).toContain('active');
const heading = element(by.css('h1'));
const headingText = heading.getText();
expect(headingText).toBe(startingPage);
}
validatePage();
const navBarBrand = element(by.className('navbar-brand'));
expect(navBarBrand.getAttribute('href')).toBe(browser.baseUrl + '/#');
navBarBrand.click();
validatePage();
});
});

View File

@ -0,0 +1,12 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es6",
"types": [
"jasmine",
"node"
]
}
}

View File

@ -7,7 +7,9 @@
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
"test": "ng test" "test": "ng test",
"pree2e": "webdriver-manager update --standalone false --gecko false",
"e2e": "ng e2e"
}, },
"dependencies": { "dependencies": {
"@angular/common": "^4.1.1", "@angular/common": "^4.1.1",
@ -32,21 +34,18 @@
"zone.js": "^0.8.5" "zone.js": "^0.8.5"
}, },
"devDependencies": { "devDependencies": {
"@angular/cli": "1.0.2", "@types/jasmine": "^2.5.47",
"@angular/compiler-cli": "^2.4.3", "@types/node": "^7.0.21",
"@types/jasmine": "2.5.38", "@types/socket.io-client": "^1.4.29",
"@types/node": "^6.0.42",
"@types/socket.io-client": "^1.4.26",
"codelyzer": "~2.0.0-beta.1", "codelyzer": "~2.0.0-beta.1",
"concurrently": "^2.0.0",
"jasmine-core": "2.5.2", "jasmine-core": "2.5.2",
"jasmine-spec-reporter": "2.5.0", "jasmine-spec-reporter": "^4.1.0",
"karma": "1.2.0", "karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0", "karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1", "karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2", "karma-jasmine": "^1.0.2",
"karma-remap-istanbul": "^0.2.1", "karma-remap-istanbul": "^0.2.1",
"karma-spec-reporter": "0.0.26", "karma-spec-reporter": "0.0.31",
"protractor": "~4.0.13", "protractor": "~4.0.13",
"protractor-jasmine2-screenshot-reporter": "^0.3.2", "protractor-jasmine2-screenshot-reporter": "^0.3.2",
"ts-node": "1.2.1", "ts-node": "1.2.1",

View File

@ -1,10 +1,9 @@
// Protractor configuration file, see link for more information // Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts // https://github.com/angular/protractor/blob/master/lib/config.ts
/*global jasmine */ const { SpecReporter } = require('jasmine-spec-reporter');
var SpecReporter = require('jasmine-spec-reporter');
exports.config = { exports.config= {
allScriptsTimeout: 11000, allScriptsTimeout: 11000,
specs: [ specs: [
'./e2e/**/*.e2e-spec.ts' './e2e/**/*.e2e-spec.ts'
@ -13,20 +12,19 @@ exports.config = {
'browserName': 'chrome' 'browserName': 'chrome'
}, },
directConnect: true, directConnect: true,
baseUrl: 'http://localhost:8091/', baseUrl: 'http://localhost:8091',
framework: 'jasmine', framework: 'jasmine',
jasmineNodeOpts: { jasmineNodeOpts: {
showColors: true, showColors: true,
defaultTimeoutInterval: 30000, defaultTimeoutInterval: 30000,
print: function() {} print: function() {}
}, },
useAllAngular2AppRoots: true,
beforeLaunch: function() { beforeLaunch: function() {
require('ts-node').register({ require('ts-node').register({
project: 'e2e' project: 'e2e/tsconfig.e2e.json'
}); });
}, },
onPrepare: function() { onPrepare() {
jasmine.getEnv().addReporter(new SpecReporter()); jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
} }
}; };

View File

@ -1,4 +1,3 @@
import {Headers} from "@angular/http";
export class AppConfig { export class AppConfig {