Skip to content

Commit

Permalink
spring-cloudgh-742 SCDF - Add E2E Infrastructure
Browse files Browse the repository at this point in the history
* Add protractor-docker-plugin
* Configure all E2E tests to use protractor-docker-plugin
* Add documentation
  • Loading branch information
ghillert authored and oodamien committed Jun 28, 2018
1 parent 6b94094 commit 9d7d604
Show file tree
Hide file tree
Showing 20 changed files with 477 additions and 14 deletions.
24 changes: 22 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
sudo: required
services:
- docker
cache:
directories:
- $HOME/.m2
dist: trusty
language: java
before_install:
- nvm install 9.5.0
addons:
chrome: stable
hosts:
- dataflow.local
jdk:
- oraclejdk8
install: true
script:
- '[ "${TRAVIS_PULL_REQUEST}" != "false" ] || ./mvnw package'
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] || ./mvnw package'

after_success:
- bash <(curl -s https://codecov.io/bash)
deploy:
Expand All @@ -21,4 +26,19 @@ deploy:
skip_cleanup: true
github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
on:
branch: master
branch: master
jobs:
include:
- stage: Maven
script: ./run-maven-build.sh
- stage: Unit Tests SauceLabs + BrowserStack
script: ./run-npm-test-saucelabs.sh
if: type != pull_request
- script: ./run-npm-test-browserstack.sh
if: type != pull_request
- stage: E2E Local + SauceLabs + BrowserStack
script: ./run-npm-e2e-local.sh
- script: ./run-npm-e2e-saucelabs.sh
if: type != pull_request
- script: ./run-npm-e2e-browserstack.sh
if: type != pull_request
3 changes: 3 additions & 0 deletions run-maven-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash
set -ev
mvn clean package
6 changes: 6 additions & 0 deletions run-npm-e2e-browserstack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ev
cd ui
npm install
npm run e2e-browserstack-local
cd ..
6 changes: 6 additions & 0 deletions run-npm-e2e-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ev
cd ui
npm install
npm run e2e
cd ..
6 changes: 6 additions & 0 deletions run-npm-e2e-saucelabs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ev
cd ui
npm install
npm run e2e-saucelabs-local
cd ..
6 changes: 6 additions & 0 deletions run-npm-test-browserstack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -ev
cd ui
npm install
npm run test-browserstack-local
cd ..
7 changes: 7 additions & 0 deletions run-npm-test-saucelabs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -ev

cd ui
npm install
npm run test-saucelabs-local
cd ..
4 changes: 2 additions & 2 deletions ui/e2e/apps/apps.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AppsPage } from './apps.po';
import { browser, by, element } from 'protractor';
import { AppDetailsPage } from './app-details.po';
import { Pagination } from '../utils/pagination.po';
import { AppsRegisterPage } from './appS-register.po';
import { AppsRegisterPage } from './apps-register.po';
import { AppsBulkImportUriPage } from './apps-bulk-import-uri.po';
import { AppVersionsModal } from './app-versions.po';
import { Navigation } from '../utils/navigation.po';
Expand All @@ -21,7 +21,7 @@ import { Navigation } from '../utils/navigation.po';
* @author Glenn Renfro
* @author Damien Vitrac
*/
describe('E2E spec for apps page', () => {
xdescribe('E2E spec for apps page', () => {

let pageApps: AppsPage;

Expand Down
13 changes: 7 additions & 6 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
"start": "ng serve --proxy-config proxy.conf.json",
"build": "ng build",
"test": "ng test",
"test-saucelabs-local": "ng test --config karma-saucelabs.conf.js",
"test-browserstack-local": "ng test --config karma-browserstack.conf.js",
"test-saucelabs-local": "node ./node_modules/@angular/cli/bin/ng test --config karma-saucelabs.conf.js",
"test-browserstack-local": "node ./node_modules/@angular/cli/bin/ng test --config karma-browserstack.conf.js",
"lint": "ng lint",
"e2e": "ng e2e --proxy-config proxy.conf.json",
"e2e-saucelabs-local": "ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-saucelabs.conf.js -prod",
"e2e-browserstack-local": "ng e2e --proxy-config proxy.conf.json --host dataflow.local --config protractor-browserstack.conf.js -prod",
"e2e": "node ./node_modules/@angular/cli/bin/ng e2e --proxy-config proxy.conf.json",
"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",
"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",
"install": "napa pivotal-cf/pivotal-ui:pivotal-ui-git-clone",
"doc": "./node_modules/.bin/compodoc -p tsconfig.json -n \"Spring Cloud Data Flow Dashboard Documentation\"",
"mavenbuild-tests": "node ./node_modules/@angular/cli/bin/ng test --code-coverage true --watch false --browsers ChromeHeadless",
Expand Down Expand Up @@ -77,7 +77,8 @@
"@types/d3-dsv": "1.0.31",
"browserstack-local": "1.3.0",
"napa": "3.0.0",
"webpack-bundle-analyzer": "2.9.0"
"webpack-bundle-analyzer": "2.9.0",
"protractor-docker-plugin": "./protractor-docker-plugin"
},
"napa-config": {
"cache": false
Expand Down
9 changes: 8 additions & 1 deletion ui/protractor-browserstack.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ exports.config = {
'browserstack.local': true,
'browserstack.debug': true
},
plugins: [
{
path: 'protractor-docker-plugin/index.js',
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
useCachedoDockerComposeFile: true
}
],
multiCapabilities: [
{
os: 'Windows',
Expand All @@ -31,7 +38,7 @@ exports.config = {
browser_version: '16.0'
}
],

maxSessions: 1,
allScriptsTimeout: 160000,
specs: [
'./e2e/**/*.e2e-spec.ts'
Expand Down
44 changes: 44 additions & 0 deletions ui/protractor-docker-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db

package-lock.json
49 changes: 49 additions & 0 deletions ui/protractor-docker-plugin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Protractor Docker Plugin

This [Protractor][] plugin will startup and shutdown a [Docker][] container using [Docker Compose][].

# Requirements for using the Plugin

- [Docker][]
- [Docker Compose][] command is available in the path

# Requirements for building the Plugin

- [TypeScript][] (`tsc` command should be available on your path)

# Building

Simply execute:

```bash
$ tsc
```

This will generate the `index.js` file.

# Using the Plugin

Add the plugin to your `protractor.conf.js` file:

```javascript
exports.config = {
plugins: [
{
path: 'protractor-docker-plugin/index.js',
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
useCachedoDockerComposeFile: true
}
],
```
## Config properties:
* **path** *Mandatory*, specifies the plugin itself. Point to the generated JavaScript file
* **dockerComposeUri** *Mandatory*, specifies the URL of the [Docker Compose][] YAML file
* **useCachedoDockerComposeFile** *Optional*, specifies whether the downloaded [Docker Compose][] YAML file shall be reused or not
[Docker]: https://www.docker.com/
[Docker Compose]: https://docs.docker.com/compose/
[TypeScript]: https://www.typescriptlang.org/
[Protractor]: https://github.com/angular/protractor
1 change: 1 addition & 0 deletions ui/protractor-docker-plugin/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {};
119 changes: 119 additions & 0 deletions ui/protractor-docker-plugin/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ui/protractor-docker-plugin/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9d7d604

Please sign in to comment.