Skip to content

Commit

Permalink
downloads selenium server on postinstall #116
Browse files Browse the repository at this point in the history
  • Loading branch information
Danwhy committed Jun 29, 2016
1 parent af7e1d4 commit 6db9d0b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Binary file removed lib/chromedriver
Binary file not shown.
Binary file removed lib/selenium-server-standalone-2.53.0.jar
Binary file not shown.
16 changes: 13 additions & 3 deletions nightwatch.conf.js
@@ -1,3 +1,5 @@
const fs = require('fs');
const binpath = './node_modules/nightwatch/bin/';
const TRAVIS_JOB_NUMBER = process.env.TRAVIS_JOB_NUMBER;

module.exports = {
Expand All @@ -10,13 +12,12 @@ module.exports = {

selenium: {
start_process: true,
server_path: './lib/selenium-server-standalone-2.53.0.jar',
server_path: binpath + 'selenium.jar',
log_path: '',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': './lib/chromedriver',
'webdriver.ie.driver': ''
'webdriver.chrome.driver': binpath + 'chromedriver'
}
},

Expand Down Expand Up @@ -72,3 +73,12 @@ module.exports = {
}
}
};

fs.stat(binpath + 'selenium.jar', function (err, stat) {
if (err || !stat || stat.size < 1) {
require('selenium-download').ensure(binpath, function (error) {
if (error) throw new Error(error);
console.log('✔ Selenium & Chromedriver downloaded to:', binpath);
});
}
});
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -44,7 +44,7 @@
"npm-run-all": "^2.1.2",
"postcss-cli": "^2.5.2",
"pre-commit": "^1.1.3",
"selenium-standalone": "^5.3.1",
"selenium-download": "^2.0.2",
"semistandard": "^8.0.0",
"sinon": "^1.17.4",
"svg-sprite": "^1.3.1",
Expand All @@ -53,7 +53,7 @@
"watchify": "^3.7.0"
},
"scripts": {
"postinstall": "run-s build minify",
"postinstall": "run-s build minify && node nightwatch.conf.js",
"start": "node bin/server.js",
"test": "run-s test:*",
"test:lint": "semistandard",
Expand Down

0 comments on commit 6db9d0b

Please sign in to comment.