Skip to content

Commit

Permalink
Merge pull request #115 from pouchdb-community/upgrade-selenium
Browse files Browse the repository at this point in the history
Use the latest selenium and update to pouchdb 7.0.0
  • Loading branch information
broerse authored Apr 29, 2019
2 parents 905d90b + fed30c2 commit 0ad01aa
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 26 deletions.
16 changes: 7 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
language: node_js
dist: xenial
services:
- couchdb
sudo: false
- xvfb
sudo: true
node_js:
- "5"
- "8"

script: npm run $COMMAND
before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- "npm install add-cors-to-couchdb"
- "./node_modules/.bin/add-cors-to-couchdb"

env:
matrix:
- COMMAND=test
- CLIENT=selenium:phantomjs COMMAND=test
- CLIENT=selenium:firefox COMMAND=test
- COMMAND=coverage
branches:
only:
Expand Down
18 changes: 18 additions & 0 deletions bin/run-couchdb-on-travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

COUCH_PORT=5984
if [ "$SERVER" = "couchdb-master" ]; then
# Install CouchDB 2.X (clustered)
docker run -d -p 5984:5984 apache/couchdb:latest --with-haproxy --with-admin-party-please -n 1
else
# Install CouchDB 1.X
docker run -d -p 5984:5984 apache/couchdb:1
fi

# wait for couchdb to start, add cors
npm install add-cors-to-couchdb
while [ '200' != $(curl -s -o /dev/null -w %{http_code} http://127.0.0.1:${COUCH_PORT}) ]; do
echo waiting for couch to load... ;
sleep 1;
done
./node_modules/.bin/add-cors-to-couchdb http://127.0.0.1:${COUCH_PORT}
19 changes: 19 additions & 0 deletions bin/run-test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/bin/bash

export COUCH_HOST='http://127.0.0.1:5984'

if [ ! -z $TRAVIS ]; then
source ./bin/run-couchdb-on-travis.sh
fi

printf 'Waiting for host to start .'
WAITING=0
until $(curl --output /dev/null --silent --head --fail --max-time 2 $COUCH_HOST); do
if [ $WAITING -eq 4 ]; then
printf '\nHost failed to start\n'
exit 1
fi
let WAITING=WAITING+1
printf '.'
sleep 5
done
printf '\nHost started :)'

: ${CLIENT:="node"}

if [ "$CLIENT" == "node" ]; then
Expand Down
13 changes: 7 additions & 6 deletions bin/test-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ var testTimeout = 30 * 60 * 1000;

var username = process.env.SAUCE_USERNAME;
var accessKey = process.env.SAUCE_ACCESS_KEY;
var SELENIUM_VERSION = process.env.SELENIUM_VERSION || '3.141.0';

// process.env.CLIENT is a colon seperated list of
// (saucelabs|selenium):browserName:browserVerion:platform
Expand Down Expand Up @@ -46,9 +47,9 @@ testUrl += '?';
testUrl += querystring.stringify(qs);

if (process.env.TRAVIS &&
client.browser !== 'firefox' &&
client.browser !== 'phantomjs' &&
process.env.TRAVIS_SECURE_ENV_VARS === 'false') {
client.browser !== 'firefox' &&
client.browser !== 'phantomjs' &&
process.env.TRAVIS_SECURE_ENV_VARS === 'false') {
console.error('Not running test, cannot connect to saucelabs');
process.exit(1);
return;
Expand Down Expand Up @@ -81,13 +82,13 @@ function testComplete(result) {

function startSelenium(callback) {
// Start selenium
var opts = {version: '2.42.0'};
selenium.install(opts, function(err) {
var opts = { version: SELENIUM_VERSION };
selenium.install(opts, function (err) {
if (err) {
console.error('Failed to install selenium');
process.exit(1);
}
selenium.start(opts, function(err, server) {
selenium.start(opts, function (err, server) {
sauceClient = wd.promiseChainRemote();
callback();
});
Expand Down
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,33 @@
"argsarray": "0.0.1",
"es3ify": "^0.2.2",
"inherits": "~2.0.3",
"lie": "^3.1.1",
"lie": "^3.3.0",
"pouchdb-extend": "^0.1.2",
"pouchdb-promise": "^6.4.2",
"pouchdb-promise": "^6.4.3",
"uniq": "^1.0.1"
},
"peerDependencies": {
"pouchdb-find": "^6.4.2"
"pouchdb-find": "^7.0.0"
},
"devDependencies": {
"blob-util": "^1.3.0",
"bluebird": "^3.5.1",
"browserify": "^15.0.0",
"bluebird": "^3.5.4",
"browserify": "^15.2.0",
"chai": "~3.5.0",
"chai-as-promised": "~5.3.0",
"http-server": "~0.10.0",
"istanbul": "^0.4.5",
"jshint": "2.9.5",
"mocha": "~4.1.0",
"phantomjs-prebuilt": "^2.1.16",
"pouchdb-find": "^6.4.2",
"pouchdb-find": "^7.0.0",
"pouchdb-memory": "^6.0.0",
"request": "^2.83.0",
"sauce-connect-launcher": "^1.2.3",
"selenium-standalone": "6.12.0",
"uglify-js": "^3.3.5",
"request": "^2.88.0",
"sauce-connect-launcher": "1.2.6",
"selenium-standalone": "6.16.0",
"uglify-js": "^3.5.6",
"watchify": "~3.9.0",
"wd": "^1.5.0",
"wd": "1.11.2",
"mkdirp": "^0.5.1"
},
"files": [
Expand Down

0 comments on commit 0ad01aa

Please sign in to comment.