AWS Code Build
Running cypress tests in parallel on AWS Code Build and Currents dashboard
Those workers will use Currents as an orchestration service - each worker will run a subset of spec files and report the results to the cloud dashboard for convenient reporting and troubleshooting.
In order to enable parallel runs, please make sure:
- you have privileged access to your AWS Account
- you have an AWS CodeBuild project created with the batched configuration enabled
The first step is to create a
buildspec.ymlfile in the root directory of your application's source code repository. This file defines the build and test steps for your application.
buildspec.ymlfile, you need to create multiple workers that will run your Cypress tests in parallel by setting the desired number of workers. See an example with 3 workers below:
# Set COMMIT_INFO variables to send Git details to Currents
- export COMMIT_INFO_BRANCH="$(git rev-parse HEAD | xargs git name-rev |
cut -d' ' -f2 | sed 's/remotes\/origin\///g')"
- export COMMIT_INFO_MESSAGE="$(git log -1 --pretty=%B)"
- export COMMIT_INFO_EMAIL="$(git log -1 --pretty=%ae)"
- export COMMIT_INFO_AUTHOR="$(git log -1 --pretty=%an)"
- export COMMIT_INFO_SHA="$(git log -1 --pretty=%H)"
- export COMMIT_INFO_REMOTE="$(git config --get remote.origin.url)"
- npm ci
- npx cypress-cloud run --record --parallel --ci-build-id $CODEBUILD_INITIATOR
You must also include the necessary commands to install Cypress, configure parallel execution, and run your tests.
By distributing tests to each worker, Currents enables faster execution of Cypress tests on AWS CodeBuild. This parallel execution ensures quicker feedback from your browser test suite while leveraging intelligent optimizations to minimize the overall runtime.
Additionally, Currents captures screenshots and videos during the test execution, facilitating troubleshooting efforts.
- use CLI arguments to customize your cypress-cloud runs, e.g.:
npx cypress-cloud run --parallel --record --key <your currents.dev key> --group groupA
Here's an example of the demo run in Currents dashboard. Note that 3 runners were used as part of this run:
Running cypress tests in parallel on AWS Code Build