Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

Commit

Permalink
WIP - allow user to specify browser and use phantomjs v2
Browse files Browse the repository at this point in the history
  • Loading branch information
thabti committed Jul 14, 2016
1 parent 0e1851e commit 1bb9124
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
"scripts": {
"test": "./node_modules/karma/bin/karma start",
"test:ci:unit": "./node_modules/karma/bin/karma start --browsers PhantomJS --single-run; npm run test:ci:lint",
"test:ci:functional": "bash tests/functional/test.sh start-ci",
"test:ci:functional": "BROWSERNAME=phantomjs bash tests/functional/test.sh start-ci",
"posttest:ci:functional": "bash tests/functional/test.sh stop",
"test:ci:lint": "eslint ./src/**/*.js",
"test:dev:unit": "./node_modules/karma/bin/karma start",
"test:dev:functional": "bash tests/functional/test.sh start",
"test:dev:functional": "BROWSERNAME=chrome bash tests/functional/test.sh start",
"posttest:dev:functional": "bash tests/functional/test.sh stop",
"test:dev:lint": "eslint ./src/scripts/**/*.js",
"dev": "node webpack/dev-server.js & PORT=8000 node start.js",
Expand Down Expand Up @@ -71,7 +71,6 @@
"morgan": "^1.6.1",
"node-sass": "^3.2.0",
"normalizr": "^2.0.0",
"phantomjs": "^1.9.18",
"pretty-error": "^2.0.0",
"promise": "^7.0.4",
"proxy-middleware": "^0.14.0",
Expand Down Expand Up @@ -138,7 +137,7 @@
"mocha": "^2.2.5",
"nodemon": "^1.7.1",
"path": "^0.11.14",
"phantomjs": "^1.9.20",
"phantomjs": "^2.1.7",
"phantomjs-polyfill": "0.0.1",
"piping": "^0.3.0",
"react-addons-test-utils": "^0.14.7",
Expand Down
5 changes: 2 additions & 3 deletions tests/functional/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ if [ "$1" == 'stop' ]; then
kill $pid
elif [ "$1" == 'start' ]; then
echo "Starting selenium server..."
sleep 10
PATH="./node_modules/phantomjs/bin:$PATH" java -jar ./node_modules/selenium-server/lib/runner/selenium-server-standalone-2.53.0.jar &> /dev/null &
sleep 2
./node_modules/.bin/wdio ./tests/functional/wdio.conf.js
BROWSER=$BROWSERNAME ./node_modules/.bin/wdio ./tests/functional/wdio.conf.js
elif [ "$1" == 'start-ci' ]; then
echo "[CI] Starting selenium server..."
wget http://selenium.googlecode.com/files/selenium-server-standalone-2.31.0.jar
java -jar selenium-server-standalone-2.31.0.jar > /dev/null &
sleep 10
./node_modules/.bin/wdio ./tests/functional/wdio.conf.js
BROWSER=$BROWSERNAME ./node_modules/.bin/wdio ./tests/functional/wdio.conf.js
else
echo "Nothing to do!"
fi
18 changes: 9 additions & 9 deletions tests/functional/wdio.conf.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const browserENV = process.env.BROWSER || 'phantomjs';

exports.config = {

maxInstances: 4,
Expand All @@ -9,28 +11,26 @@ exports.config = {
],
exclude: [
],

capabilities: [
{
browserName: 'phantomjs'
browserName: browserENV,
chromeOptions: {
args: ['window-size=1280,800']
}
}
],

logLevel: 'error',
coloredLogs: true,
screenshotPath: './errorShots/',

waitforTimeout: 10000,
framework: 'mocha',
reporter: 'spec',
onPrepare: function() {
onPrepare: () => {
},
before: function() {

var chai = require('chai');
before: () => {
const chai = require('chai');
global.chai = chai;
global.expect = chai.expect;

process.on('unhandledRejection', function unhandledRejection(e) {
console.error(e);
if (e.stack) {
Expand Down

0 comments on commit 1bb9124

Please sign in to comment.