From e96f07a7fb481d9f4bcbbb6cb1f5be77ad45811c Mon Sep 17 00:00:00 2001 From: Florian Hartwich Date: Sun, 21 May 2017 03:59:27 +0200 Subject: [PATCH] Reconfigure to run e2e tests without pipe --- api/package.json | 3 ++- package.json | 6 +++++- static/e2e/test.e2e-spec.ts | 23 +++++------------------ static/package.json | 22 ++++++++++------------ static/protractor.conf.js | 2 +- 5 files changed, 23 insertions(+), 33 deletions(-) diff --git a/api/package.json b/api/package.json index da9e228..f86c04f 100644 --- a/api/package.json +++ b/api/package.json @@ -9,7 +9,8 @@ "scripts": { "start": "NODE_ENV=production node server.js", "dev": "nodemon server.js", - "test": "mocha --require ./test/config/spec_helper.js" + "test": "mocha --require ./test/config/spec_helper.js", + "e2e": "NODE_ENV=test node server.js" }, "dependencies": { "async": "^2.4.0", diff --git a/package.json b/package.json index b29196f..7818f38 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,10 @@ "deploy-static-prod": "cd ./static && ng build --env=prod && ln -s ../api/resource/ ../public/resource", "postinstall": "npm install --prefix ./static && npm install --prefix ./api", "mongodb": "mongod --dbpath ./mongodb-data", - "test": "npm test --prefix ./api" + "test": "npm test --prefix ./api", + "e2e": "npm run deploy-static && concurrently \"npm run e2e --prefix ./api\" \"npm run e2e --prefix ./static\"" + }, + "devDependencies": { + "concurrently": "^3.4.0" } } diff --git a/static/e2e/test.e2e-spec.ts b/static/e2e/test.e2e-spec.ts index 352fd48..5ceddf2 100644 --- a/static/e2e/test.e2e-spec.ts +++ b/static/e2e/test.e2e-spec.ts @@ -1,29 +1,16 @@ import {browser, element, by} from 'protractor'; -describe('Access Projectmanager Homepage', function () { +describe('Main Page Access', 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(); + it('should open army overview initially', async() => { + let elem = element(by.css('h1')); + let text = elem.getText(); + expect(text).toBe("Übersicht über alle Spieler, Squads und Armeen"); }); }); diff --git a/static/package.json b/static/package.json index 3b90bcd..df46b5c 100644 --- a/static/package.json +++ b/static/package.json @@ -9,7 +9,7 @@ "start": "ng serve", "test": "ng test", "pree2e": "webdriver-manager update --standalone false --gecko false", - "e2e": "ng e2e" + "e2e": "ng e2e --serve=false" }, "dependencies": { "@angular/common": "^4.1.1", @@ -34,19 +34,17 @@ "zone.js": "^0.8.5" }, "devDependencies": { - "@types/jasmine": "^2.5.47", - "@types/node": "^7.0.21", - "@types/socket.io-client": "^1.4.29", + "@types/jasmine": "2.5.38", + "@types/node": "~6.0.60", + "@types/socket.io-client": "^1.4.26", "codelyzer": "~2.0.0-beta.1", - "jasmine-core": "2.5.2", - "jasmine-spec-reporter": "^4.1.0", - "karma": "1.2.0", + "jasmine-core": "^2.5.2", + "jasmine-spec-reporter": "^3.2.0", + "karma": "^1.5.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.31", - "protractor": "~4.0.13", + "karma-jasmine": "^1.1.0", + "karma-spec-reporter": "0.0.30", + "protractor": "~5.1.1", "protractor-jasmine2-screenshot-reporter": "^0.3.2", "ts-node": "1.2.1", "tslint": "^4.3.0", diff --git a/static/protractor.conf.js b/static/protractor.conf.js index 6613b13..954a56e 100644 --- a/static/protractor.conf.js +++ b/static/protractor.conf.js @@ -12,7 +12,7 @@ exports.config= { 'browserName': 'chrome' }, directConnect: true, - baseUrl: 'http://localhost:8091', + baseUrl: 'http://localhost:3001', framework: 'jasmine', jasmineNodeOpts: { showColors: true,