diff --git a/plugins/CoreConsole/Commands/RunUITests.php b/plugins/CoreConsole/Commands/RunUITests.php index 005a1bf44042cd5c84c2029b57b31eb84cf28f5c..23ac45fe8ccffd4c406685d58f2f8e92a5b1b2a1 100644 --- a/plugins/CoreConsole/Commands/RunUITests.php +++ b/plugins/CoreConsole/Commands/RunUITests.php @@ -24,6 +24,7 @@ class RunUITests extends ConsoleCommand $this->addOption('keep-symlinks', null, InputOption::VALUE_NONE, "Keep recursive directory symlinks so test pages can be viewed in a browser."); $this->addOption('print-logs', null, InputOption::VALUE_NONE, "Print webpage logs even if tests succeed."); $this->addOption('drop', null, InputOption::VALUE_NONE, "Drop the existing database and re-setup a persisted fixture."); + $this->addOption('plugin', null, InputOption::VALUE_REQUIRED, "Execute all tests for a plugin."); } protected function execute(InputInterface $input, OutputInterface $output) @@ -33,6 +34,7 @@ class RunUITests extends ConsoleCommand $keepSymlinks = $input->getOption('keep-symlinks'); $printLogs = $input->getOption('print-logs'); $drop = $input->getOption('drop'); + $plugin = $input->getOption('plugin'); $options = array(); if ($persistFixtureData) { @@ -50,6 +52,10 @@ class RunUITests extends ConsoleCommand if ($drop) { $options[] = "--drop"; } + + if ($plugin) { + $options[] = "--plugin=" . $plugin; + } $options = implode(" ", $options); $specs = implode(" ", $specs); diff --git a/tests/PHPUnit/travis.sh b/tests/PHPUnit/travis.sh index b71061c48323751f437aba991e765d3de5cea54f..f28bdf12393dae5347d250c6a7f03fcf674de0b6 100755 --- a/tests/PHPUnit/travis.sh +++ b/tests/PHPUnit/travis.sh @@ -33,7 +33,7 @@ then if [ -n "$PLUGIN_NAME" ] then - phantomjs ../lib/screenshot-testing/run-tests.js --assume-artifacts --persist-fixture-data --screenshot-repo=$TRAVIS_REPO_SLUG $PLUGIN_NAME + phantomjs ../lib/screenshot-testing/run-tests.js --assume-artifacts --persist-fixture-data --screenshot-repo=$TRAVIS_REPO_SLUG --plugin=$PLUGIN_NAME else phantomjs ../lib/screenshot-testing/run-tests.js --store-in-ui-tests-repo --persist-fixture-data --assume-artifacts fi diff --git a/tests/lib/screenshot-testing/support/app.js b/tests/lib/screenshot-testing/support/app.js index fbbcd20722dbdcb169bf2642c9a3327df0f36b38..71f1c73ff2cddd49598e5812c3b1c89b0ccad881 100644 --- a/tests/lib/screenshot-testing/support/app.js +++ b/tests/lib/screenshot-testing/support/app.js @@ -46,6 +46,7 @@ Application.prototype.printHelpAndExit = function () { console.log(" --persist-fixture-data: Persists test data in a database and does not execute tear down."); console.log(" After the first run, the database setup will not be called, which"); console.log(" Makes running tests faster."); + console.log(" --plugin=name: Runs all tests for a plugin."); console.log(" --keep-symlinks: If supplied, the recursive symlinks created in tests/PHPUnit/proxy"); console.log(" aren't deleted after tests are run. Specify this option if you'd like"); console.log(" to view pages phantomjs captures in a browser."); @@ -103,6 +104,12 @@ Application.prototype.loadTestModules = function () { }); } + if (options.plugin) { + mocha.suite.suites = mocha.suite.suites.filter(function (suite) { + return suite.baseDirectory.match(new RegExp("\/plugins\/" + options.plugin + "\/")); + }); + } + // configure suites (auto-add fixture setup/teardown) mocha.suite.suites.forEach(function (suite) { var fixture = typeof suite.fixture === 'undefined' ? 'UITestFixture' : suite.fixture;