diff --git a/.circleci/ci/it-tests.js b/.circleci/ci/it-tests.js index dcb4a20199..6713b7dc69 100644 --- a/.circleci/ci/it-tests.js +++ b/.circleci/ci/it-tests.js @@ -15,6 +15,7 @@ 'use strict'; const ci = new (require('./ci.js'))(); +const process = require('process'); ci.context(); @@ -96,9 +97,12 @@ try { ci.sh(`mvn clean install -PautoInstallPackage`); }); + + const [node, script, ...params] = process.argv; + let testSuites = params.join(','); // start running the tests ci.dir('ui.tests', () => { - ci.sh(`mvn verify -U -B -Pcypress-ci -DENV_CI=true`); + ci.sh(`mvn verify -U -B -Pcypress-ci -DENV_CI=true -DspecFiles="${testSuites}"`); }); } @@ -139,5 +143,9 @@ try { ci.sh('curl -O -f http://localhost:3000/crx-quickstart/logs/stdout.log'); ci.sh('curl -O -f http://localhost:3000/crx-quickstart/logs/stderr.log'); ci.sh(`find . -name '*.log' -type f -size +32M -exec echo 'Truncating: ' {} \\; -execdir truncate --size 32M {} +`); -}); + }); + // test-results folder will store the test-timing data for parallelising test-suites + ci.sh('mkdir -p test-results/test/'); + ci.sh('cp ./ui.tests/test-module/target/reports/*.xml ./test-results/test/'); + } diff --git a/.circleci/config.yml b/.circleci/config.yml index b4c28d765c..d97e755969 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -14,6 +14,10 @@ common: cypress_test_steps: &cypress_test_steps steps: + - run: + name: Check out previous test metadata + command: | + cat "${CIRCLE_INTERNAL_TASK_DATA}/circle-test-results/test/results.json" | jq . - checkout - browser-tools/install-chrome - browser-tools/install-chromedriver @@ -28,9 +32,15 @@ common: at: /home/circleci/build - run: name: UI tests - command: node .circleci/ci/it-tests.js + command: | + cd ui.tests/test-module + shopt -s globstar + SPEC_PATH="specs/**/*.spec.js" + TEST=$(circleci tests glob ${SPEC_PATH} | circleci tests split --split-by=timings) + cd ../../ + node .circleci/ci/it-tests.js $TEST - store_test_results: - path: ui.tests/test-module/target/reports + path: test-results # Save test results as artifacts - store_artifacts: path: ui.tests/test-module/target @@ -123,6 +133,7 @@ jobs: PRERELEASE: 'true' resource_class: large working_directory: /home/circleci/build + parallelism: 8 <<: *cypress_test_steps cypress-chrome-cloudready-with-latest-addon: diff --git a/ui.tests/pom.xml b/ui.tests/pom.xml index 297ab70999..2364fd094b 100644 --- a/ui.tests/pom.xml +++ b/ui.tests/pom.xml @@ -319,6 +319,7 @@ ${project.basedir}/test-module/node_modules/.bin/cypress run + --spec=${specFiles} --browser chrome --headless