Skip to content

Commit 9d7d604

Browse files
ghillertoodamien
authored andcommitted
gh-742 SCDF - Add E2E Infrastructure
* Add protractor-docker-plugin * Configure all E2E tests to use protractor-docker-plugin * Add documentation
1 parent 6b94094 commit 9d7d604

20 files changed

+477
-14
lines changed

.travis.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
sudo: required
2+
services:
3+
- docker
24
cache:
35
directories:
46
- $HOME/.m2
57
dist: trusty
68
language: java
9+
before_install:
10+
- nvm install 9.5.0
711
addons:
812
chrome: stable
13+
hosts:
14+
- dataflow.local
915
jdk:
1016
- oraclejdk8
1117
install: true
1218
script:
1319
- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw package'
1420
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw package'
15-
1621
after_success:
1722
- bash <(curl -s https://codecov.io/bash)
1823
deploy:
@@ -21,4 +26,19 @@ deploy:
2126
skip_cleanup: true
2227
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
2328
on:
24-
branch: master
29+
branch: master
30+
jobs:
31+
include:
32+
- stage: Maven
33+
script: ./run-maven-build.sh
34+
- stage: Unit Tests SauceLabs + BrowserStack
35+
script: ./run-npm-test-saucelabs.sh
36+
if: type != pull_request
37+
- script: ./run-npm-test-browserstack.sh
38+
if: type != pull_request
39+
- stage: E2E Local + SauceLabs + BrowserStack
40+
script: ./run-npm-e2e-local.sh
41+
- script: ./run-npm-e2e-saucelabs.sh
42+
if: type != pull_request
43+
- script: ./run-npm-e2e-browserstack.sh
44+
if: type != pull_request

run-maven-build.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
set -ev
3+
mvn clean package

run-npm-e2e-browserstack.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ev
3+
cd ui
4+
npm install
5+
npm run e2e-browserstack-local
6+
cd ..

run-npm-e2e-local.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ev
3+
cd ui
4+
npm install
5+
npm run e2e
6+
cd ..

run-npm-e2e-saucelabs.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ev
3+
cd ui
4+
npm install
5+
npm run e2e-saucelabs-local
6+
cd ..

run-npm-test-browserstack.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -ev
3+
cd ui
4+
npm install
5+
npm run test-browserstack-local
6+
cd ..

run-npm-test-saucelabs.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -ev
3+
4+
cd ui
5+
npm install
6+
npm run test-saucelabs-local
7+
cd ..

ui/e2e/apps/apps.e2e-spec.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { AppsPage } from './apps.po';
22
import { browser, by, element } from 'protractor';
33
import { AppDetailsPage } from './app-details.po';
44
import { Pagination } from '../utils/pagination.po';
5-
import { AppsRegisterPage } from './appS-register.po';
5+
import { AppsRegisterPage } from './apps-register.po';
66
import { AppsBulkImportUriPage } from './apps-bulk-import-uri.po';
77
import { AppVersionsModal } from './app-versions.po';
88
import { Navigation } from '../utils/navigation.po';
@@ -21,7 +21,7 @@ import { Navigation } from '../utils/navigation.po';
2121
* @author Glenn Renfro
2222
* @author Damien Vitrac
2323
*/
24-
describe('E2E spec for apps page', () => {
24+
xdescribe('E2E spec for apps page', () => {
2525

2626
let pageApps: AppsPage;
2727

ui/package.json

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
"start": "ng serve --proxy-config proxy.conf.json",
88
"build": "ng build",
99
"test": "ng test",
10-
"test-saucelabs-local": "ng test --config karma-saucelabs.conf.js",
11-
"test-browserstack-local": "ng test --config karma-browserstack.conf.js",
10+
"test-saucelabs-local": "node ./node_modules/@angular/cli/bin/ng test --config karma-saucelabs.conf.js",
11+
"test-browserstack-local": "node ./node_modules/@angular/cli/bin/ng test --config karma-browserstack.conf.js",
1212
"lint": "ng lint",
13-
"e2e": "ng e2e --proxy-config proxy.conf.json",
14-
"e2e-saucelabs-local": "ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-saucelabs.conf.js -prod",
15-
"e2e-browserstack-local": "ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-browserstack.conf.js -prod",
13+
"e2e": "node ./node_modules/@angular/cli/bin/ng e2e --proxy-config proxy.conf.json",
14+
"e2e-saucelabs-local": "node ./node_modules/@angular/cli/bin/ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-saucelabs.conf.js -prod",
15+
"e2e-browserstack-local": "node ./node_modules/@angular/cli/bin/ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-browserstack.conf.js -prod",
1616
"install": "napa pivotal-cf/pivotal-ui:pivotal-ui-git-clone",
1717
"doc": "./node_modules/.bin/compodoc -p tsconfig.json -n \"Spring Cloud Data Flow Dashboard Documentation\"",
1818
"mavenbuild-tests": "node ./node_modules/@angular/cli/bin/ng test --code-coverage true --watch false --browsers ChromeHeadless",
@@ -77,7 +77,8 @@
7777
"@types/d3-dsv": "1.0.31",
7878
"browserstack-local": "1.3.0",
7979
"napa": "3.0.0",
80-
"webpack-bundle-analyzer": "2.9.0"
80+
"webpack-bundle-analyzer": "2.9.0",
81+
"protractor-docker-plugin": "./protractor-docker-plugin"
8182
},
8283
"napa-config": {
8384
"cache": false

ui/protractor-browserstack.conf.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ exports.config = {
1616
'browserstack.local': true,
1717
'browserstack.debug': true
1818
},
19+
plugins: [
20+
{
21+
path: 'protractor-docker-plugin/index.js',
22+
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
23+
useCachedoDockerComposeFile: true
24+
}
25+
],
1926
multiCapabilities: [
2027
{
2128
os: 'Windows',
@@ -31,7 +38,7 @@ exports.config = {
3138
browser_version: '16.0'
3239
}
3340
],
34-
41+
maxSessions: 1,
3542
allScriptsTimeout: 160000,
3643
specs: [
3744
'./e2e/**/*.e2e-spec.ts'
+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# See http://help.github.com/ignore-files/ for more about ignoring files.
2+
3+
# compiled output
4+
/dist
5+
/tmp
6+
/out-tsc
7+
8+
# dependencies
9+
/node_modules
10+
11+
# IDEs and editors
12+
/.idea
13+
.project
14+
.classpath
15+
.c9/
16+
*.launch
17+
.settings/
18+
*.sublime-workspace
19+
20+
# IDE - VSCode
21+
.vscode/*
22+
!.vscode/settings.json
23+
!.vscode/tasks.json
24+
!.vscode/launch.json
25+
!.vscode/extensions.json
26+
27+
# misc
28+
/.sass-cache
29+
/connect.lock
30+
/coverage
31+
/libpeerconnection.log
32+
npm-debug.log
33+
testem.log
34+
/typings
35+
36+
# e2e
37+
/e2e/*.js
38+
/e2e/*.map
39+
40+
# System Files
41+
.DS_Store
42+
Thumbs.db
43+
44+
package-lock.json

ui/protractor-docker-plugin/README.md

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Protractor Docker Plugin
2+
3+
This [Protractor][] plugin will startup and shutdown a [Docker][] container using [Docker Compose][].
4+
5+
# Requirements for using the Plugin
6+
7+
- [Docker][]
8+
- [Docker Compose][] command is available in the path
9+
10+
# Requirements for building the Plugin
11+
12+
- [TypeScript][] (`tsc` command should be available on your path)
13+
14+
# Building
15+
16+
Simply execute:
17+
18+
```bash
19+
$ tsc
20+
```
21+
22+
This will generate the `index.js` file.
23+
24+
# Using the Plugin
25+
26+
Add the plugin to your `protractor.conf.js` file:
27+
28+
```javascript
29+
exports.config = {
30+
plugins: [
31+
{
32+
path: 'protractor-docker-plugin/index.js',
33+
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
34+
useCachedoDockerComposeFile: true
35+
}
36+
],
37+
```
38+
39+
## Config properties:
40+
41+
* **path** *Mandatory*, specifies the plugin itself. Point to the generated JavaScript file
42+
* **dockerComposeUri** *Mandatory*, specifies the URL of the [Docker Compose][] YAML file
43+
* **useCachedoDockerComposeFile** *Optional*, specifies whether the downloaded [Docker Compose][] YAML file shall be reused or not
44+
45+
[Docker]: https://www.docker.com/
46+
[Docker Compose]: https://docs.docker.com/compose/
47+
[TypeScript]: https://www.typescriptlang.org/
48+
[Protractor]: https://github.com/angular/protractor
49+
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export {};

ui/protractor-docker-plugin/index.js

+119
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ui/protractor-docker-plugin/index.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)