From a3381290fa95d39774bab8bbe003f2e19b18702d 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 Former-commit-id: 397d39d24611dbb9f97b6520eda8f39196a855b4 --- 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 7fc86fbdef2cc..10ce44af55c1c 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 c6d5c15713c0c72c8b9fb98d1332f1bc4f472a2c 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 Former-commit-id: e4b584256dc2fc92b9068fc211a5e181479cf47d --- 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 10ce44af55c1c..19666384eef06 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 9aa610fd99672..5b5a212cd70e6 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 7661e95f002d4cc595252ba149c3e60cbf82fdc0 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 Former-commit-id: 5ef2a9715caf678bb1270ba802e4c4391a8f56e3 --- 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 19666384eef06..7205b8cd17e4d 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 30ce3e5913fa5d5da05efcb137fb8f5b545f2e55 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 Former-commit-id: bcfc69c3d9d33cdc4bd70b39ea7f2ed8d63a7d91 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b16b2be48dc8..31ec0d1e12ea4 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 d05e94a3e5f1bae52c2b467305a587e9a14400fe 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 Former-commit-id: b053aad5dfd6aa0f8d2ab471817b9f5743457198 --- 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 31ec0d1e12ea4..c670db8a47b52 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 7205b8cd17e4d..75d9567b364c1 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 5b5a212cd70e6..985ac56dae834 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 = [