From 397d39d24611dbb9f97b6520eda8f39196a855b4 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 19 Jul 2016 09:44:24 -0500 Subject: [PATCH 1/5] [tests] Pass grep option to grunt intern --- tasks/config/intern.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/config/intern.js b/tasks/config/intern.js index 7fc86fbdef2cce..10ce44af55c1ce 100644 --- a/tasks/config/intern.js +++ b/tasks/config/intern.js @@ -7,7 +7,8 @@ module.exports = function (grunt) { runType: 'runner', config: 'test/intern', bail: true, - reporters: ['Console'] + reporters: ['Console'], + grep: grunt.option('grep') }, dev: {}, api: { From e4b584256dc2fc92b9068fc211a5e181479cf47d Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 19 Jul 2016 15:23:49 -0500 Subject: [PATCH 2/5] [tests] Add ui test application filtering --- tasks/config/intern.js | 3 ++- test/functional/index.js | 28 ++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/tasks/config/intern.js b/tasks/config/intern.js index 10ce44af55c1ce..19666384eef060 100644 --- a/tasks/config/intern.js +++ b/tasks/config/intern.js @@ -8,7 +8,8 @@ module.exports = function (grunt) { config: 'test/intern', bail: true, reporters: ['Console'], - grep: grunt.option('grep') + grep: grunt.option('grep') || '.*', + apps: grunt.option('apps') }, dev: {}, api: { diff --git a/test/functional/index.js b/test/functional/index.js index 9aa610fd99672c..5b5a212cd70e65 100644 --- a/test/functional/index.js +++ b/test/functional/index.js @@ -16,17 +16,33 @@ define(function (require) { PageObjects.init(this.remote); support.init(this.remote); }); - - require([ + const supportPages = [ 'intern/dojo/node!../support/page_objects', - 'intern/dojo/node!../support', + 'intern/dojo/node!../support' + ]; + + const requestedApps = process.argv.reduce((previous, arg) => { + const option = arg.split('='); + const key = option[0]; + const value = option[1]; + if (key === 'apps' && value) return value.split(','); + }); + + const apps = [ 'intern/dojo/node!./apps/discover', - 'intern/dojo/node!./status_page', 'intern/dojo/node!./apps/management', 'intern/dojo/node!./apps/visualize', 'intern/dojo/node!./apps/console', - 'intern/dojo/node!./apps/dashboard' - ], (loadedPageObjects, loadedSupport) => { + 'intern/dojo/node!./apps/dashboard', + 'intern/dojo/node!./status_page' + ].filter((suite) => { + if (!requestedApps) return true; + return requestedApps.reduce((previous, app) => { + return previous || ~suite.indexOf(app); + }, false); + }); + + require(supportPages.concat(apps), (loadedPageObjects, loadedSupport) => { PageObjects = loadedPageObjects; support = loadedSupport; }); From 5ef2a9715caf678bb1270ba802e4c4391a8f56e3 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 19 Jul 2016 15:35:07 -0500 Subject: [PATCH 3/5] [tests] Add intern functional suites option --- tasks/config/intern.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/config/intern.js b/tasks/config/intern.js index 19666384eef060..7205b8cd17e4d2 100644 --- a/tasks/config/intern.js +++ b/tasks/config/intern.js @@ -8,7 +8,8 @@ module.exports = function (grunt) { config: 'test/intern', bail: true, reporters: ['Console'], - grep: grunt.option('grep') || '.*', + grep: grunt.option('grep'), + functionalSuites: grunt.option('functionalSuites'), apps: grunt.option('apps') }, dev: {}, From bcfc69c3d9d33cdc4bd70b39ea7f2ed8d63a7d91 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 19 Jul 2016 16:43:57 -0500 Subject: [PATCH 4/5] [tests] Add docs about filtering options --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b16b2be48dc8c..31ec0d1e12ea49 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,7 +149,7 @@ Run the tests for just your particular plugin. Assuming you plugin lives outside The following will start Kibana, Elasticsearch and the chromedriver for you. To run the functional UI tests use the following commands `npm run test:ui` -Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. +Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. This supports options `--grep=foo` for only running tests that match a regular expression, and `--apps=management` for running tests for a specific application. `npm run test:ui:server` Start the server required for the `test:ui:runner` tasks. Once the server is started `test:ui:runner` can be run multiple times without waiting for the server to start. From b053aad5dfd6aa0f8d2ab471817b9f5743457198 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Tue, 19 Jul 2016 17:06:13 -0500 Subject: [PATCH 5/5] [tests] Rename apps option to appSuites so we don't override the intern.apps object --- CONTRIBUTING.md | 2 +- tasks/config/intern.js | 2 +- test/functional/index.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 31ec0d1e12ea49..c670db8a47b526 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,7 +149,7 @@ Run the tests for just your particular plugin. Assuming you plugin lives outside The following will start Kibana, Elasticsearch and the chromedriver for you. To run the functional UI tests use the following commands `npm run test:ui` -Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. This supports options `--grep=foo` for only running tests that match a regular expression, and `--apps=management` for running tests for a specific application. +Run the functional UI tests one time and exit. This is used by the CI systems and is great for quickly checking that things pass. It is essentially a combination of the next two tasks. This supports options `--grep=foo` for only running tests that match a regular expression, and `--appSuites=management` for running tests for a specific application. `npm run test:ui:server` Start the server required for the `test:ui:runner` tasks. Once the server is started `test:ui:runner` can be run multiple times without waiting for the server to start. diff --git a/tasks/config/intern.js b/tasks/config/intern.js index 7205b8cd17e4d2..75d9567b364c1c 100644 --- a/tasks/config/intern.js +++ b/tasks/config/intern.js @@ -10,7 +10,7 @@ module.exports = function (grunt) { reporters: ['Console'], grep: grunt.option('grep'), functionalSuites: grunt.option('functionalSuites'), - apps: grunt.option('apps') + appSuites: grunt.option('appSuites') }, dev: {}, api: { diff --git a/test/functional/index.js b/test/functional/index.js index 5b5a212cd70e65..985ac56dae834b 100644 --- a/test/functional/index.js +++ b/test/functional/index.js @@ -25,7 +25,7 @@ define(function (require) { const option = arg.split('='); const key = option[0]; const value = option[1]; - if (key === 'apps' && value) return value.split(','); + if (key === 'appSuites' && value) return value.split(','); }); const apps = [