Merge pull request #7768 from jbudz/intern-grep

Filter integration tests from npm command
This commit is contained in:
Lee Drengenberg 2016-07-19 17:23:23 -05:00 committed by GitHub
commit d5dde7640f
3 changed files with 27 additions and 8 deletions

View file

@ -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 `--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.

View file

@ -7,7 +7,10 @@ module.exports = function (grunt) {
runType: 'runner',
config: 'test/intern',
bail: true,
reporters: ['Console']
reporters: ['Console'],
grep: grunt.option('grep'),
functionalSuites: grunt.option('functionalSuites'),
appSuites: grunt.option('appSuites')
},
dev: {},
api: {

View file

@ -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 === 'appSuites' && 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;
});