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

View File

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

View File

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