diff --git a/README.md b/README.md index 0c80aa4c..d1333133 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ download-configuration downloads environment variables from app from Heroku to make adding them to the next-config-vars service easier provision [app] provisions a new instance of an application server verify internally calls origami-build-tools verify with some Next specific configuration (use only for APPLICATIONS. Front End components should continue to use origami-build-tools verify) + nightwatch [options] runs nightwatch with some sensible defaults destroy [app] deletes the app from heroku * diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index 3ab3443e..fd4b87d5 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -11,6 +11,7 @@ var configure = require('../tasks/configure'); var provision = require('../tasks/provision'); var verify = require('../tasks/verify'); var destroy = require('../tasks/destroy'); +var nightwatch = require('../tasks/nightwatch'); var downloadConfiguration = require('../tasks/download-configuration'); function list(val) { @@ -75,6 +76,21 @@ program verify().catch(exit); }); + program + .command('nightwatch [test]') + .option('-c, --config ', 'The location of the nightwatch.json, defaults to Next Build Tools nightwatch.json') + .option('-e, --env ', 'The location of the nightwatch.json, defaults to Next Build Tools defined environments') + .description('runs nightwatch with some sensible defaults') + .action(function(test, options) { + nightwatch({ + test: test, + env: options.env, + config: options.config + + }) + .catch(exit); + }); + program .command('destroy [app]') .description('deletes the app from heroku') diff --git a/config/nightwatch.json b/config/nightwatch.json new file mode 100644 index 00000000..ed4213c4 --- /dev/null +++ b/config/nightwatch.json @@ -0,0 +1,107 @@ +{ + "src_folders": ["tests"], + "output_folder": "./tests/browser/reports", + "selenium": { + "start_process": false, + "server_path": "", + "log_path": "" + }, + "test_settings": { + "default": { + "launch_url": "${TEST_URL}", + "selenium_port": 80, + "selenium_host": "ondemand.saucelabs.com", + "silent": true, + "screenshots": { + "enabled": true, + "path": "./screenshots" + }, + "username": "${SAUCE_USER}", + "access_key": "${SAUCE_KEY}", + "desiredCapabilities": { + "browserName": "chrome", + "version": "37", + "platform": "WINDOWS" + } + }, + "chrome41": { + "desiredCapabilities": { + "browserName": "chrome", + "version": "41.0", + "platform": "Windows 7" + } + }, + "chrome40": { + "desiredCapabilities": { + "browserName": "chrome", + "version": "40.0", + "platform": "Windows 7" + } + }, + "firefox36": { + "desiredCapabilities": { + "browserName": "firefox", + "version": "36.0", + "platform": "Windows 7" + } + }, + "firefox35": { + "desiredCapabilities": { + "browserName": "firefox", + "version": "35.0", + "platform": "Windows 7" + } + }, + "ie11": { + "desiredCapabilities": { + "browserName": "internet explorer", + "version": "11.0", + "platform": "Windows 7" + } + }, + "ie10": { + "desiredCapabilities": { + "browserName": "internet explorer", + "version": "10.0", + "platform": "Windows 7" + } + }, + "ie9": { + "desiredCapabilities": { + "browserName": "internet explorer", + "version": "9.0", + "platform": "Windows 7" + } + }, + "safari8": { + "desiredCapabilities": { + "browserName": "safari", + "version": "8.0", + "platform": "OS X 10.10" + } + }, + "safari7": { + "desiredCapabilities": { + "browserName": "safari", + "version": "7.0", + "platform": "OS X 10.9" + } + }, + "iphone8_1": { + "desiredCapabilities": { + "platform": "OS X 10.10", + "version": "8.1", + "deviceName": "iPhone Simulator", + "device-orientation": "portrait" + } + }, + "ipad8_0": { + "desiredCapabilities": { + "platform": "OS X 10.10", + "version": "8.0", + "deviceName": "iPad Simulator", + "device-orientation": "portrait" + } + } + } +} diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js new file mode 100644 index 00000000..a0297b99 --- /dev/null +++ b/tasks/nightwatch.js @@ -0,0 +1,19 @@ +'use strict'; + +var denodeify = require('denodeify'); +var exec = denodeify(require('child_process').exec, function(err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + return [err]; +}); +var path = require('path'); + +module.exports = function(opts) { + var test = opts.test; + var env = opts.env || 'ie10,firefox36,chrome41'; + var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); + return exec('nightwatch' + + ' --env ' + env + + ' --test ' + test + + ' --config ' + config); +};