From 6e3fa974ba361e1bf32620d5b7dcb109d1f86c85 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Tue, 6 Aug 2019 16:32:46 +0100 Subject: [PATCH] Remove all ui test dependencies from package.json Given chromedriver was already an extra dependency that needed to be manually installed, I have now moved all of the webdriver.io dependencies out as well. A new script has been added to install all of the ui test dependencies. The Grunt file has been updated on how it checks for the missing deps. --- Gruntfile.js | 20 ++++++++++++++------ package.json | 5 ----- scripts/install-ui-test-dependencies.sh | 7 +++++++ 3 files changed, 21 insertions(+), 11 deletions(-) create mode 100755 scripts/install-ui-test-dependencies.sh 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