Skip to content

Commit ec2c06d

Browse files
ghillertoodamien
authored andcommitted
gh-981 Fix E2E tests for Apps UI tab
- 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
1 parent dacfab0 commit ec2c06d

19 files changed

+517
-238
lines changed

.travis.yml

+17-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
sudo: required
22
services:
33
- docker
4+
env:
5+
- DOCKER_COMPOSE_VERSION=1.23.2
46
cache:
57
directories:
68
- $HOME/.m2
79
dist: trusty
810
language: java
911
before_install:
1012
- nvm install 9.5.0
13+
- sudo rm /usr/local/bin/docker-compose
14+
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
15+
- chmod +x docker-compose
16+
- sudo mv docker-compose /usr/local/bin
17+
1118
addons:
1219
chrome: stable
1320
hosts:
@@ -34,12 +41,13 @@ jobs:
3441
- script: ./run-npm-test-browserstack.sh
3542
if: type != pull_request
3643
after_success: skip
37-
# - stage: E2E Local + SauceLabs + BrowserStack
38-
# script: ./run-npm-e2e-local.sh
39-
# after_success: skip
40-
# - script: ./run-npm-e2e-saucelabs.sh
41-
# if: type != pull_request
42-
# after_success: skip
43-
# - script: ./run-npm-e2e-browserstack.sh
44-
# if: type != pull_request
45-
# after_success: skip
44+
- stage: E2E Local + SauceLabs + BrowserStack
45+
script: ./run-npm-e2e-local.sh
46+
after_success: skip
47+
- script: ./run-npm-e2e-saucelabs.sh
48+
if: type != pull_request
49+
after_success: skip
50+
- script: ./run-npm-e2e-browserstack.sh
51+
if: type != pull_request
52+
after_success: skip
53+

README_DEV.md

+9
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ $ npm run test-browserstack-local
8282
$ npm run e2e-browserstack-local
8383
```
8484

85+
⚠️ **E2E Tests**
86+
87+
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).
88+
89+
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:
90+
91+
- `DATAFLOW_VERSION`
92+
- `SKIPPER_VERSION`
93+
8594
### Build fails after merging a branch or changing branches
8695

8796
In some cases the npm-modules or other dependencies may become inconsistent during branch changes.

run-maven-build.sh

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

run-npm-e2e-browserstack.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22
set -ev
33
cd ui
4+
mkdir .docker
5+
cd .docker
6+
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
7+
docker-compose up --no-start
8+
cd ..
49
npm install
510
npm run e2e-browserstack-local
6-
cd ..
11+
cd ..

run-npm-e2e-local.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
22
set -ev
33
cd ui
4+
mkdir .docker
5+
cd .docker
6+
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
7+
docker-compose up --no-start
8+
cd ..
49
npm install
5-
pwd
6-
ls -al
7-
ls -al e2e
810
npm run e2e
9-
cd ..
11+
cd ..

run-npm-e2e-saucelabs.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
#!/bin/bash
22
set -ev
33
cd ui
4+
mkdir .docker
5+
cd .docker
6+
curl -O https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/v$DATAFLOW_VERSION/spring-cloud-dataflow-server/docker-compose.yml
7+
docker-compose up --no-start
8+
cd ..
49
npm install
510
npm run e2e-saucelabs-local
6-
cd ..
11+
cd ..

run-npm-test-saucelabs.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/bin/bash
22
set -ev
3-
43
cd ui
54
npm install
65
npm run test-saucelabs-local

ui/e2e/protractor-browserstack.conf.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,46 @@ const browserstack = require('browserstack-local');
66

77
exports.config = {
88
jasmineNodeOpts: {
9-
defaultTimeoutInterval: 5000000
9+
defaultTimeoutInterval: 50000000
1010
},
1111
seleniumAddress: 'https://hub-cloud.browserstack.com/wd/hub',
1212
commonCapabilities: {
1313
name: 'Data Flow Dashboard E2E Tests',
1414
'browserstack.user': process.env.BROWSER_STACK_USERNAME,
1515
'browserstack.key': process.env.BROWSER_STACK_ACCESS_KEY,
1616
'browserstack.local': true,
17-
'browserstack.debug': true
17+
'browserstack.debug': true,
18+
'browserstack.idleTimeout': 512
1819
},
1920
plugins: [
2021
{
2122
path: '../protractor-docker-plugin/index.js',
2223
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
23-
useCachedoDockerComposeFile: true
24+
useCachedoDockerComposeFile: true,
25+
dockerComposeWaitTime: 512000
2426
}
2527
],
2628
multiCapabilities: [
2729
{
2830
os: 'Windows',
2931
os_version: '10',
3032
browserName: 'Chrome',
31-
browser_version: '62.0',
33+
browser_version: '73.0',
3234
resolution: '1024x768'
33-
},
34-
{
35-
os: 'Windows',
36-
os_version: '10',
37-
browserName: 'Edge',
38-
browser_version: '16.0'
3935
}
36+
// {
37+
// os: 'Windows',
38+
// os_version: '10',
39+
// browserName: 'Edge',
40+
// browser_version: '16.0'
41+
// }
4042
],
4143
maxSessions: 1,
4244
allScriptsTimeout: 160000,
4345
specs: [
4446
'./src/**/*.e2e-spec.ts'
4547
],
48+
SELENIUM_PROMISE_MANAGER: false,
4649
directConnect: false,
4750
baseUrl: 'http://localhost:4200/',
4851
framework: 'jasmine',

ui/e2e/protractor-saucelabs.conf.js

+20-9
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,45 @@ console.log('Use embedded Sauce Connect client?: ' + useEmbeddedSauceConnect);
99
exports.config = {
1010

1111
jasmineNodeOpts: {
12-
defaultTimeoutInterval: 5000000
12+
defaultTimeoutInterval: 500000
1313
},
1414
sauceUser: process.env.SAUCE_USERNAME,
1515
sauceKey: process.env.SAUCE_ACCESS_KEY,
1616
plugins: [
1717
{
1818
path: '../protractor-docker-plugin/index.js',
1919
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server-local/docker-compose.yml',
20-
useCachedoDockerComposeFile: true
20+
useCachedoDockerComposeFile: true,
21+
dockerComposeWaitTime: 512000
2122
}
2223
],
2324
multiCapabilities: [
2425
{
25-
name: 'E2E Safari/Mac',
26-
browserName: 'safari',
27-
platform: 'macOS 10.13'
26+
name: 'E2E Chrome/Mac',
27+
browserName: 'chrome',
28+
version: '73.0',
29+
platform: 'Windows 10',
30+
idleTimeout: 512
2831
},
2932
{
30-
name: 'E2E Edge/Win10',
31-
browserName: 'MicrosoftEdge',
32-
platform: 'Windows 10',
33+
name: 'E2E Safari/Mac',
34+
browserName: 'safari',
35+
platform: 'macOS 10.13',
36+
idleTimeout: 512
3337
}
38+
// {
39+
// name: 'E2E Edge/Win10',
40+
// browserName: 'MicrosoftEdge',
41+
// platform: 'Windows 10',
42+
// idleTimeout: 512
43+
// }
3444
],
3545
maxSessions: 1,
3646
allScriptsTimeout: 160000,
3747
specs: [
3848
'./src/**/*.e2e-spec.ts'
3949
],
50+
SELENIUM_PROMISE_MANAGER: false,
4051
directConnect: false,
4152
baseUrl: 'http://localhost:4200/',
4253
framework: 'jasmine',
@@ -48,7 +59,7 @@ exports.config = {
4859
},
4960
jasmineNodeOpts: {
5061
showColors: true,
51-
defaultTimeoutInterval: 30000,
62+
defaultTimeoutInterval: 300000,
5263
print: function() {}
5364
},
5465
onPrepare() {

ui/e2e/protractor.conf.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ exports.config = {
88
{
99
path: '../protractor-docker-plugin/index.js',
1010
dockerComposeUri: 'https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/master/spring-cloud-dataflow-server/docker-compose.yml',
11-
useCachedoDockerComposeFile: true
11+
useCachedoDockerComposeFile: true,
12+
dockerComposeWaitTime: 512000
1213
}
1314
],
1415
allScriptsTimeout: 110000,
1516
specs: [
1617
'./src/**/*.e2e-spec.ts'
1718
],
19+
SELENIUM_PROMISE_MANAGER: false,
1820
capabilities: {
1921
'browserName': 'chrome',
2022
chromeOptions: {

0 commit comments

Comments
 (0)