Skip to content

Commit

Permalink
Merge pull request #7768 from jbudz/intern-grep
Browse files Browse the repository at this point in the history
Filter integration tests from npm command
  • Loading branch information
Lee Drengenberg authored Jul 19, 2016
2 parents 5954090 + b053aad commit d5dde76
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion tasks/config/intern.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
28 changes: 22 additions & 6 deletions test/functional/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down

0 comments on commit d5dde76

Please sign in to comment.