Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create standalone tests #13

Merged
merged 1 commit into from
Nov 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 14 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,18 @@

CI and adhoc testing for cross browser API support using nightwatch, selenium and saucelabs

## Travis CI
## Cross-browser testing using Buildkite CI

Runs simple UI test over core libraries and plugins across all configured environments
After each push Buildkite runs cross-browser UI tests over core libraries and plugins

## Running Ad hoc tests remotely using sauce labs
## Running Ad hoc chrome and firefox tests locally

In Chrome
`npm run test-chrome`
In Firefox
`npm run test-firefox`

## Running Ad hoc cross-browser tests remotely

1. Start the app server\
`npm run dev`
Expand All @@ -17,17 +24,7 @@ Runs simple UI test over core libraries and plugins across all configured enviro
1. Run the tests remotely passing environment\
`npm run test-remote -- --env ie-11`

## Running Ad hoc tests over local environment

1. brew install selenium and chromedriver
1. Update nighwatch.js to point to selenium / chromedriver jars
1. start selenium `selenium-server -p 4444`
1. Start the app server\
`npm run dev`
1. Run the tests\
`npm run test-local`

## Tests
## The Tests

### Basic UI Test
Runs simple UI over core fusion libraries and plugins. In theory should be sufficient to verify necessary API/polyfill support, though we should add more UI interactions to improve confidence level.
Expand All @@ -36,10 +33,10 @@ Runs simple UI over core fusion libraries and plugins. In theory should be suffi
Off by default. Tests for a selection of ES2015+ utils which are not transpiled by Babel at buildtime. Tested utils are somewhat arbitary as not all are necessarily required by fusion, so only uncomment if you want to test for specific API/polyfill support.


## Configuration
* Travis: `nightwatch-ci.js`
* Ad Hoc (remote): `nightwatch-remote.js`
## Nightwatch Configuration files
* Buildkite: `nightwatch-ci.js`
* Ad Hoc (local): `nightwatch.js`
* Ad Hoc (remote): `nightwatch-remote.js`

**Test folder / file**\
`src_folders: ['src/test/browser/index.js'],`
Expand Down
44 changes: 42 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ services:
timeout: 10s
retries: 5

chrome-standalone:
image: selenium/standalone-chrome:latest
network_mode: "host"
restart: always
ports:
- "4444:4444"

firefox-standalone:
image: selenium/standalone-firefox:latest
network_mode: "host"
restart: always
ports:
- "4444:4444"

sauce-tunnel:
image: henrrich/docker-sauce-connect:latest
restart: always
Expand All @@ -34,12 +48,18 @@ services:
retries: 10

# docker-compose run does not wait on healthchecks, so proxy using this service.
services-are-healthy:
sauce-tunnel-healthy:
build: .
network_mode: "host"
depends_on:
sauce-tunnel:
condition: service_healthy

# wait for running server.
fusion-server-healthy:
build: .
network_mode: "host"
depends_on:
fusion-server:
condition: service_healthy

Expand All @@ -48,7 +68,8 @@ services:
build: .
network_mode: "host"
depends_on:
- services-are-healthy
- sauce-tunnel-healthy
- fusion-server-healthy
environment:
- SAUCE_USERNAME
- SAUCE_ACCESS_KEY
Expand All @@ -61,3 +82,22 @@ services:
- SAUCE_USERNAME
- SAUCE_ACCESS_KEY
- BUILDKITE_BUILD_NUMBER

# For running integration tests locally in chrome
browser-test-chrome:
build: .
network_mode: "host"
depends_on:
- chrome-standalone
- fusion-server-healthy
command: ./test-standalone.sh

# For running integration tests locally in firefox
browser-test-firefox:
build: .
network_mode: "host"
depends_on:
- firefox-standalone
- fusion-server-healthy
command: ./test-standalone.sh

27 changes: 2 additions & 25 deletions nightwatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,20 @@ module.exports = {
globals_path: '',

selenium: {
start_process: true,
server_path:
'~/Library/Caches/Homebrew/selenium-server-standalone-3.7.0.jar',
start_process: false,
log_path: '',
port: 4444,
cli_args: {
'webdriver.chrome.driver': '/usr/local/bin/chromedriver',
},
},

test_settings: {
default: {
launch_url: 'http://localhost',
selenium_port: 4444,
selenium_host: 'localhost',
silent: false,
username: '${SAUCE_USERNAME}',
access_key: '${SAUCE_ACCESS_KEY}',
screenshots: {
enabled: false,
path: '',
},
silent: true,
desiredCapabilities: {
browserName: 'chrome',
},
},

safari: {
desiredCapabilities: {
browserName: 'safari',
},
},

edge: {
desiredCapabilities: {
browserName: 'MicrosoftEdge',
},
},
},
};
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
"start": "fusion start",
"build-test": "fusion build --test",
"download-selenium": "node download-selenium.js",
"test-local": "nightwatch --config nightwatch.js",
"test-remote": "nightwatch --config nightwatch-remote.js --env samsung-G4",
"test-chrome": "docker-compose run browser-test-chrome",
"test-firefox": "docker-compose run browser-test-firefox",
"test-remote": "./test-remotely.sh",
"cover": "fusion test --cover",
"source-map-explorer": "fusion source-map-explorer",
"check": "fusion check"
Expand Down Expand Up @@ -66,7 +67,6 @@
"selenium-download": "^2.0.10",
"tape": "^4.8.0"
},
"TODO": "Can we either always add this or figure out some way to know when to add it?",
"clientHotLoaderEntry": "react-hot-loader/patch",
"engines": {
"node": ">= 8.9.0"
Expand Down
3 changes: 3 additions & 0 deletions test-standalone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

nightwatch --config nightwatch.js