diff --git a/Gruntfile.js b/Gruntfile.js index 8b7b85a25..66ebf4f38 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -496,7 +496,9 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-chmod'); grunt.loadNpmTasks('grunt-jsonlint'); grunt.loadNpmTasks('grunt-mocha-istanbul'); - grunt.loadNpmTasks('grunt-webdriver'); + if (fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.loadNpmTasks('grunt-webdriver'); + } grunt.loadNpmTasks('grunt-jsdoc'); grunt.loadNpmTasks('grunt-jsdoc-to-markdown'); grunt.loadNpmTasks('grunt-npm-command'); @@ -555,8 +557,8 @@ module.exports = function(grunt) { }); grunt.registerTask('verifyUiTestDependencies', function() { - if (!fs.existsSync(path.join("node_modules", "chromedriver"))) { - grunt.fail.fatal('You need to run "npm install chromedriver@2" before running UI test.'); + if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.fail.fatal('You need to install the UI test dependencies first.\nUse the script in "scripts/install-ui-test-dependencies.sh"'); return false; } }); @@ -579,9 +581,15 @@ module.exports = function(grunt) { 'Runs code style check on editor code', ['jshint:editor']); - grunt.registerTask('test-ui', - 'Builds editor content then runs unit tests on editor ui', - ['verifyUiTestDependencies','build','jshint:editor','webdriver:all']); + if (!fs.existsSync(path.join("node_modules", "grunt-webdriver"))) { + grunt.registerTask('test-ui', + 'Builds editor content then runs unit tests on editor ui', + ['verifyUiTestDependencies']); + } else { + grunt.registerTask('test-ui', + 'Builds editor content then runs unit tests on editor ui', + ['verifyUiTestDependencies','build','jshint:editor','webdriver:all']); + } grunt.registerTask('test-nodes', 'Runs unit tests on core nodes', diff --git a/package.json b/package.json index 92bc8020d..e0997ce16 100644 --- a/package.json +++ b/package.json @@ -95,7 +95,6 @@ "grunt-npm-command": "~0.1.2", "grunt-sass": "~2.0.0", "grunt-simple-mocha": "~0.4.1", - "grunt-webdriver": "^2.0.3", "http-proxy": "^1.16.2", "istanbul": "0.4.5", "minami": "1.2.3", @@ -105,10 +104,6 @@ "sinon": "1.17.7", "stoppable": "^1.1.0", "supertest": "3.4.2", - "wdio-chromedriver-service": "^0.1.5", - "wdio-mocha-framework": "^0.6.4", - "wdio-spec-reporter": "^0.1.5", - "webdriverio": "^4.14.1", "node-red-node-test-helper": "^0.2.3", "jsdoc-nr-template": "node-red/jsdoc-nr-template" }, diff --git a/scripts/install-ui-test-dependencies.sh b/scripts/install-ui-test-dependencies.sh new file mode 100755 index 000000000..0148633be --- /dev/null +++ b/scripts/install-ui-test-dependencies.sh @@ -0,0 +1,7 @@ +npm install --no-save \ + grunt-webdriver@^2.0.3 \ + wdio-chromedriver-service@^0.1.5 \ + wdio-mocha-framework@^0.6.4 \ + wdio-spec-reporter@^0.1.5 \ + webdriverio@^4.14.1 \ + chromedriver@2