diff --git a/.travis.yml b/.travis.yml index 37a01b154749161a37938205ac9495466003b5b7..eef27e1d5ed13de69a40a3c81dfdb43a98166f46 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,7 +30,8 @@ env: # All tests after another - TEST_SUITE=AllTests MYSQL_ADAPTER=PDO_MYSQL - TEST_SUITE=AllTests MYSQL_ADAPTER=MYSQLI - - TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL + - TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL UITEST_EXTRA_OPTIONS="--run-first-half-only" + - TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL UITEST_EXTRA_OPTIONS="--run-second-half-only" global: - PIWIK_ROOT_DIR=$TRAVIS_BUILD_DIR - SKIP_INSTALL_MYSQL_56=1 @@ -60,7 +61,9 @@ matrix: env: TEST_SUITE=UnitTests MYSQL_ADAPTER=PDO_MYSQL # run UI tests on PHP 5.3.3 only - php: 5.6 - env: TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL + env: TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL UITEST_EXTRA_OPTIONS="--run-first-half-only" + - php: 5.6 + env: TEST_SUITE=UITests MYSQL_ADAPTER=PDO_MYSQL UITEST_EXTRA_OPTIONS="--run-second-half-only" # run all tests not on PHP 5.6 and run MySQLI tests only on 5.6 - php: 5.6 env: TEST_SUITE=AllTests MYSQL_ADAPTER=PDO_MYSQL diff --git a/tests/lib/screenshot-testing/support/app.js b/tests/lib/screenshot-testing/support/app.js index 92256cae6cf9995084cf893ff409503177df00e2..6f120f18d87b82ef890018055cf9f86009905a95 100644 --- a/tests/lib/screenshot-testing/support/app.js +++ b/tests/lib/screenshot-testing/support/app.js @@ -66,6 +66,10 @@ Application.prototype.printHelpAndExit = function () { console.log(" --screenshot-repo: Specifies the github repository that contains the expected screenshots"); console.log(" to link to in the diffviewer. For use with travis build."); console.log(" --core: Only execute UI tests that are for Piwik core or Piwik core plugins."); + console.log(" --first-half: Only execute first half of all the test suites. Will be only applied if no") + console.log(" specific plugin or test-files requested"); + console.log(" --second-half: Only execute second half of all the test suites. Will be only applied if no") + console.log(" specific plugin or test-files requested"); phantom.exit(0); }; @@ -131,6 +135,24 @@ Application.prototype.loadTestModules = function () { }); } + var specificTestsRequested = options.plugin || options.tests.length; + + if ((options['run-first-half-only'] || options['run-second-half-only']) && !specificTestsRequested) { + // run only first 50% of the test suites or only run last 50% of the test suites. + // we apply this option only if not a specific plugin or test suite was requested. Only there for travis to + // split tests into multiple jobs. + var numTestsFirstHalf = Math.round(mocha.suite.suites.length / 2); + numTestsFirstHalf += 5; // run a few more test suits in first half as UiIntegrationTests contain many tests + mocha.suite.suites = mocha.suite.suites.filter(function (suite, index) { + if (options['run-first-half-only'] && index < numTestsFirstHalf) { + return true; + } else if (options['run-second-half-only'] && index >= numTestsFirstHalf) { + return true; + } + return false; + }); + } + if (!mocha.suite.suites.length) { console.log("No tests are executing... are you running tests for a plugin? Make sure to use the" + " --plugin=MyPlugin option."); diff --git a/tests/travis b/tests/travis index f62fc4fe97a88aa11e495abda384f142b38fd580..b7a9cd1a1755b9f500ac111713ce07bb983c12e7 160000 --- a/tests/travis +++ b/tests/travis @@ -1 +1 @@ -Subproject commit f62fc4fe97a88aa11e495abda384f142b38fd580 +Subproject commit b7a9cd1a1755b9f500ac111713ce07bb983c12e7