Skip to content

Commit

Permalink
gh-981 Fix E2E tests for Apps UI tab
Browse files Browse the repository at this point in the history
- Fine-tune timeouts
- Refactor E2E Shell-scripts for Travis
  - Set up Docker images using `--no-start` flag
  - Helps minimize timeout issues with Protractor
  - Helps to identify any Docker issues as early as possible
- Refactor a basic set of Protractor E2E tests
  - Eliminate calls to `Browser.sleep()`
  - Use async/await
- Add new Helper methods
  - Especially `ElementHelper.clickElement()`
  - Problem:
    * Spinners/Loading indicators may block clickable elements
    * A previous action may be so fast that the subsequent element to be clicked does not appear, yet
  - Solution:
    * Wait for element to appear but don't use `Browser.sleep()`
    * Instead poll periodically for the element and try to click it
    * Allow for eventual timeout and test-failure in case the expected element never appears
- Add support to skip execution of Protractor Docker Plugin
  • Loading branch information
ghillert authored and oodamien committed Jun 5, 2019
1 parent dacfab0 commit ec2c06d
Show file tree
Hide file tree
Showing 19 changed files with 517 additions and 238 deletions.
26 changes: 17 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
sudo: required
services:
- docker
env:
- DOCKER_COMPOSE_VERSION=1.23.2
cache:
directories:
- $HOME/.m2
dist: trusty
language: java
before_install:
- nvm install 9.5.0
- sudo rm /usr/local/bin/docker-compose
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
- chmod +x docker-compose
- sudo mv docker-compose /usr/local/bin

addons:
chrome: stable
hosts:
Expand All @@ -34,12 +41,13 @@ jobs:
- script: ./run-npm-test-browserstack.sh
if: type != pull_request
after_success: skip
# - stage: E2E Local + SauceLabs + BrowserStack
# script: ./run-npm-e2e-local.sh
# after_success: skip
# - script: ./run-npm-e2e-saucelabs.sh
# if: type != pull_request
# after_success: skip
# - script: ./run-npm-e2e-browserstack.sh
# if: type != pull_request
# after_success: skip
- stage: E2E Local + SauceLabs + BrowserStack
script: ./run-npm-e2e-local.sh
after_success: skip
- script: ./run-npm-e2e-saucelabs.sh
if: type != pull_request
after_success: skip
- script: ./run-npm-e2e-browserstack.sh
if: type != pull_request
after_success: skip

9 changes: 9 additions & 0 deletions README_DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,15 @@ $ npm run test-browserstack-local
$ npm run e2e-browserstack-local
```

⚠️ **E2E Tests**

When executing E2E tests you can either run a local Docker environment using the Spring Cloud Data Flow provided [Docker Compose yaml file](https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server/docker-compose.yml) or, alternatively, have Protractor bootstrap Docker for you (Docker needs to be running and the [Docker Compose](https://docs.docker.com/compose/) command needs to be available in the path).

When using Docker Compose manually, set the environment variable `DATAFLOW_SKIP_DOCKER_COMPOSE` to `true`. For both options you also need to specify the respective Docker version tags for [Spring Cloud Data Flow](https://hub.docker.com/r/springcloud/spring-cloud-dataflow-server/tags) and [Spring Cloud Skipper](https://hub.docker.com/r/springcloud/spring-cloud-skipper-server/tags) using the environment variables:

- `DATAFLOW_VERSION`
- `SKIPPER_VERSION`

### Build fails after merging a branch or changing branches

In some cases the npm-modules or other dependencies may become inconsistent during branch changes.
Expand Down
2 changes: 1 addition & 1 deletion run-maven-build.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
set -ev
mvn clean package
mvn clean package
7 changes: 6 additions & 1 deletion run-npm-e2e-browserstack.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
set -ev
cd ui
mkdir .docker
cd .docker
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
docker-compose up --no-start
cd ..
npm install
npm run e2e-browserstack-local
cd ..
cd ..
10 changes: 6 additions & 4 deletions run-npm-e2e-local.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
set -ev
cd ui
mkdir .docker
cd .docker
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
docker-compose up --no-start
cd ..
npm install
pwd
ls -al
ls -al e2e
npm run e2e
cd ..
cd ..
7 changes: 6 additions & 1 deletion run-npm-e2e-saucelabs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
set -ev
cd ui
mkdir .docker
cd .docker
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
docker-compose up --no-start
cd ..
npm install
npm run e2e-saucelabs-local
cd ..
cd ..
1 change: 0 additions & 1 deletion run-npm-test-saucelabs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
set -ev

cd ui
npm install
npm run test-saucelabs-local
Expand Down
23 changes: 13 additions & 10 deletions ui/e2e/protractor-browserstack.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,46 @@ const browserstack = require('browserstack-local');

exports.config = {
jasmineNodeOpts: {
defaultTimeoutInterval: 5000000
defaultTimeoutInterval: 50000000
},
seleniumAddress: 'https://hub-cloud.browserstack.com/wd/hub',
commonCapabilities: {
name: 'Data Flow Dashboard E2E Tests',
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
'browserstack.local': true,
'browserstack.debug': true
'browserstack.debug': true,
'browserstack.idleTimeout': 512
},
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
useCachedoDockerComposeFile: true,
dockerComposeWaitTime: 512000
}
],
multiCapabilities: [
{
os: 'Windows',
os_version: '10',
browserName: 'Chrome',
browser_version: '62.0',
browser_version: '73.0',
resolution: '1024x768'
},
{
os: 'Windows',
os_version: '10',
browserName: 'Edge',
browser_version: '16.0'
}
// {
// os: 'Windows',
// os_version: '10',
// browserName: 'Edge',
// browser_version: '16.0'
// }
],
maxSessions: 1,
allScriptsTimeout: 160000,
specs: [
'./src/**/*.e2e-spec.ts'
],
SELENIUM_PROMISE_MANAGER: false,
directConnect: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
Expand Down
29 changes: 20 additions & 9 deletions ui/e2e/protractor-saucelabs.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,45 @@ console.log('Use embedded Sauce Connect client?: ' + useEmbeddedSauceConnect);
exports.config = {

jasmineNodeOpts: {
defaultTimeoutInterval: 5000000
defaultTimeoutInterval: 500000
},
sauceUser: process.env.SAUCE_USERNAME,
sauceKey: process.env.SAUCE_ACCESS_KEY,
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
useCachedoDockerComposeFile: true,
dockerComposeWaitTime: 512000
}
],
multiCapabilities: [
{
name: 'E2E Safari/Mac',
browserName: 'safari',
platform: 'macOS 10.13'
name: 'E2E Chrome/Mac',
browserName: 'chrome',
version: '73.0',
platform: 'Windows 10',
idleTimeout: 512
},
{
name: 'E2E Edge/Win10',
browserName: 'MicrosoftEdge',
platform: 'Windows 10',
name: 'E2E Safari/Mac',
browserName: 'safari',
platform: 'macOS 10.13',
idleTimeout: 512
}
// {
// name: 'E2E Edge/Win10',
// browserName: 'MicrosoftEdge',
// platform: 'Windows 10',
// idleTimeout: 512
// }
],
maxSessions: 1,
allScriptsTimeout: 160000,
specs: [
'./src/**/*.e2e-spec.ts'
],
SELENIUM_PROMISE_MANAGER: false,
directConnect: false,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
Expand All @@ -48,7 +59,7 @@ exports.config = {
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
defaultTimeoutInterval: 300000,
print: function() {}
},
onPrepare() {
Expand Down
4 changes: 3 additions & 1 deletion ui/e2e/protractor.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ exports.config = {
{
path: '../protractor-docker-plugin/index.js',
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server/docker-compose.yml',
useCachedoDockerComposeFile: true
useCachedoDockerComposeFile: true,
dockerComposeWaitTime: 512000
}
],
allScriptsTimeout: 110000,
specs: [
'./src/**/*.e2e-spec.ts'
],
SELENIUM_PROMISE_MANAGER: false,
capabilities: {
'browserName': 'chrome',
chromeOptions: {
Expand Down
Loading

0 comments on commit ec2c06d

Please sign in to comment.