From 4af3d5d6aa336b7a161bf7fa13322aedf369acfd Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:05:07 +0000 Subject: [PATCH 01/11] Start adding nightwatch --- config/nightwatch.json | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 config/nightwatch.json diff --git a/config/nightwatch.json b/config/nightwatch.json new file mode 100644 index 00000000..84b14fd2 --- /dev/null +++ b/config/nightwatch.json @@ -0,0 +1,61 @@ +{ + "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" + } + }, + + "chrome" : { + "desiredCapabilities": { + "browserName": "chrome", + "version": "37", + "platform": "Windows 7" + } + }, + + "firefox" : { + "desiredCapabilities": { + "browserName": "firefox", + "version": "32", + "platform": "Windows 7" + } + }, + + "ie10" : { + "desiredCapabilities": { + "browserName": "internet explorer", + "version": "10.0", + "platform": "Windows 7" + } + }, + "safari7" : { + "desiredCapabilities": { + "browserName": "safari", + "version": "7.0", + "platform": "OS X 10.9" + } + } + } +} From d77e39bcf58928aa00796463e4ae45e26598ab55 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:06:41 +0000 Subject: [PATCH 02/11] Update nightwatch json to grumman version --- config/nightwatch.json | 96 +++++++++++++++++++++++++++++++----------- 1 file changed, 71 insertions(+), 25 deletions(-) diff --git a/config/nightwatch.json b/config/nightwatch.json index 84b14fd2..ed4213c4 100644 --- a/config/nightwatch.json +++ b/config/nightwatch.json @@ -1,22 +1,20 @@ { - "src_folders" : ["tests"], - "output_folder" : "./tests/browser/reports", - - "selenium" : { - "start_process" : false, - "server_path" : "", - "log_path" : "" + "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", + "test_settings": { + "default": { + "launch_url": "${TEST_URL}", + "selenium_port": 80, + "selenium_host": "ondemand.saucelabs.com", "silent": true, - "screenshots" : { - "enabled" : true, - "path" : "./screenshots" + "screenshots": { + "enabled": true, + "path": "./screenshots" }, "username": "${SAUCE_USER}", "access_key": "${SAUCE_KEY}", @@ -26,36 +24,84 @@ "platform": "WINDOWS" } }, - - "chrome" : { + "chrome41": { "desiredCapabilities": { "browserName": "chrome", - "version": "37", + "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" } }, - - "firefox" : { + "firefox35": { "desiredCapabilities": { "browserName": "firefox", - "version": "32", + "version": "35.0", + "platform": "Windows 7" + } + }, + "ie11": { + "desiredCapabilities": { + "browserName": "internet explorer", + "version": "11.0", "platform": "Windows 7" } }, - - "ie10" : { + "ie10": { "desiredCapabilities": { "browserName": "internet explorer", "version": "10.0", "platform": "Windows 7" } }, - "safari7" : { + "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" + } } } } From 53cfa698b04399dda0fc595282662d9acb2eff68 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:48:03 +0000 Subject: [PATCH 03/11] Add nightwatch task --- README.md | 1 + bin/next-build-tools.js | 12 ++++++++++++ tasks/nightwatch.js | 22 ++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 tasks/nightwatch.js 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..7e4563d4 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -75,6 +75,18 @@ program verify().catch(exit); }); + program + .command('nightwatch') + .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') + .option('-t, --test', 'Location of tests to run, defaults to Next Build Tools defined location') + .description('runs nightwatch with some sensible defaults') + .action(function() { + nightwatch({ + + }); + }); + program .command('destroy [app]') .description('deletes the app from heroku') diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js new file mode 100644 index 00000000..1ea1b924 --- /dev/null +++ b/tasks/nightwatch.js @@ -0,0 +1,22 @@ +'use strict'; + +var denodeify = require('denodeify'); +var exec = denodeify(require('child_process').exec, function(err, stdout, stderr) { + if (err) { + console.log(stdout); + console.log(stderr); + } + return [err]; +}); +var path = require('path'); + +module.exports = function(opts) { + var test = opts.test; + var environment = opts.environment || 'ie10,firefox36,chrome41'; + var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); + return exec('nightwatch' + + ' --env ' + environment + + ' --test ' + test + + ' --config ' + config); +}; + From 59a7c97832be7f426d46193489d91480ca74eba8 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:53:01 +0000 Subject: [PATCH 04/11] Missing require --- bin/next-build-tools.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index 7e4563d4..00e723b7 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) { From 43a8cec912d01c407af765c7eade8a314fef464f Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:54:04 +0000 Subject: [PATCH 05/11] test location --- tasks/nightwatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index 1ea1b924..abbb4aa4 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -11,7 +11,7 @@ var exec = denodeify(require('child_process').exec, function(err, stdout, stderr var path = require('path'); module.exports = function(opts) { - var test = opts.test; + var test = opts.test || 'tests/browser/tests/jssuccesstest.js'; var environment = opts.environment || 'ie10,firefox36,chrome41'; var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); return exec('nightwatch' From a238e0b0b0f665dd072424cdb47cf908e74b5bc0 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:58:13 +0000 Subject: [PATCH 06/11] Try having wildcard for test directory --- tasks/nightwatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index abbb4aa4..cf023fc8 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -11,7 +11,7 @@ var exec = denodeify(require('child_process').exec, function(err, stdout, stderr var path = require('path'); module.exports = function(opts) { - var test = opts.test || 'tests/browser/tests/jssuccesstest.js'; + var test = opts.test || path.join('tests', 'browser', 'tests', '*'); var environment = opts.environment || 'ie10,firefox36,chrome41'; var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); return exec('nightwatch' From 4a4ecda5fcde10db826dd2763133a7924dc4dc6e Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 12:58:43 +0000 Subject: [PATCH 07/11] Linting errors --- tasks/nightwatch.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index cf023fc8..ad4106ab 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -19,4 +19,3 @@ module.exports = function(opts) { + ' --test ' + test + ' --config ' + config); }; - From 1a25aceebabf080f88a24ecd806a49327c2f0c5d Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 13:05:29 +0000 Subject: [PATCH 08/11] Add missing stuff into nightwatch task --- bin/next-build-tools.js | 15 +++++++++------ tasks/nightwatch.js | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index 00e723b7..bcf074dc 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -77,15 +77,18 @@ program }); program - .command('nightwatch') - .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') - .option('-t, --test', 'Location of tests to run, defaults to Next Build Tools defined location') + .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() { + .action(function(test, options) { nightwatch({ + test: test, + env: opts.env, + config: opts.config - }); + }) + .catch(exit); }); program diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index ad4106ab..6f842089 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -12,10 +12,10 @@ var path = require('path'); module.exports = function(opts) { var test = opts.test || path.join('tests', 'browser', 'tests', '*'); - var environment = opts.environment || 'ie10,firefox36,chrome41'; + var env = opts.env || 'ie10,firefox36,chrome41'; var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); return exec('nightwatch' - + ' --env ' + environment + + ' --env ' + env + ' --test ' + test + ' --config ' + config); }; From 9a6eedbbecf0a55bf5a47498ff853b372097cf75 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 13:07:31 +0000 Subject: [PATCH 09/11] don't default to test --- tasks/nightwatch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index 6f842089..58f6dbb0 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -11,7 +11,7 @@ var exec = denodeify(require('child_process').exec, function(err, stdout, stderr var path = require('path'); module.exports = function(opts) { - var test = opts.test || path.join('tests', 'browser', 'tests', '*'); + var test = opts.test; var env = opts.env || 'ie10,firefox36,chrome41'; var config = opts.config || path.join(__dirname, '..', 'config', 'nightwatch.json'); return exec('nightwatch' From fe36831f89ff608fbf2880ea0cde28ab3ca281ad Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 14:49:52 +0000 Subject: [PATCH 10/11] Consistently name the options variable --- bin/next-build-tools.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/next-build-tools.js b/bin/next-build-tools.js index bcf074dc..fd4b87d5 100755 --- a/bin/next-build-tools.js +++ b/bin/next-build-tools.js @@ -84,8 +84,8 @@ program .action(function(test, options) { nightwatch({ test: test, - env: opts.env, - config: opts.config + env: options.env, + config: options.config }) .catch(exit); From d1b92f590f67d2aa10158bac588ae3d36340b3c6 Mon Sep 17 00:00:00 2001 From: Matthew Andrews Date: Wed, 18 Mar 2015 14:55:42 +0000 Subject: [PATCH 11/11] Always log stdout & stderr --- tasks/nightwatch.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tasks/nightwatch.js b/tasks/nightwatch.js index 58f6dbb0..a0297b99 100644 --- a/tasks/nightwatch.js +++ b/tasks/nightwatch.js @@ -2,10 +2,8 @@ var denodeify = require('denodeify'); var exec = denodeify(require('child_process').exec, function(err, stdout, stderr) { - if (err) { - console.log(stdout); - console.log(stderr); - } + console.log(stdout); + console.log(stderr); return [err]; }); var path = require('path');