What you’ll learn
- How to upload Playwright results from Amazon CodeBuild to TestDino
- How to configure sharded test runs with merged reporting
- How to set up the TESTDINO_TOKEN as a CodeBuild environment variable
Prerequisites
Before setting up, ensure you have:- A TestDino account with a project created
- A TestDino API key (Generate API Keys)
- An AWS account with CodeBuild access
- A Playwright test project (or clone the TestDino Example Repository to get started)
- Playwright configured with JSON and HTML reporters in
playwright.config.js:
playwright.config.js
Set Up Your API Key
Store your TestDino API key as a CodeBuild environment variable so it is available to your build without exposing it in buildspec files.- Open your AWS CodeBuild project
- Choose Edit
- Open the Environment section
- Add an environment variable named
TESTDINO_TOKEN - Paste your TestDino API key as the value
- Save the project
Basic Buildspec Config
For a simple setup without sharding, add the upload step after your Playwright tests.buildspec.yml — Basic buildspec
buildspec.yml — Basic buildspec
buildspec.yml
Upload Options
Sharded Test Runs
For larger test suites, CodeBuild runs Playwright across multiple shard passes within a single build. Each shard produces a blob report that gets merged before uploading to TestDino.How it works
- CodeBuild runs 4 Playwright shard passes sequentially in a single build
- Each shard’s blob report is copied to a dedicated directory
- All blob reports are flattened and merged into a single
report.json - The merged report is uploaded to TestDino
- The build fails only if both tests and the merge/upload fail
Full sharded config
buildspec.yml — Sharded buildspec
buildspec.yml — Sharded buildspec
buildspec.yml
Key details
Pipeline execution
After the pipeline runs, CodeBuild logs show the TestDino CLI output in CloudWatch under/aws/codebuild/<project-name>.
Results in TestDino
Once uploaded, the test run appears in your TestDino dashboard with full failure details, flaky detection, and trend data.
Rerun Failed Tests
Cache test metadata to enable selective reruns:buildspec.yml
buildspec.yml
Troubleshooting
Upload step skipped after test failure
Upload step skipped after test failure
Move the upload command to the
post_build phase, which runs regardless of the build phase exit code. For the sharded buildspec, the script tracks exit codes independently so upload always runs.report.json not found
report.json not found
Verify your
playwright.config.js includes both HTML and JSON reporters with HTML listed first. For sharded runs, ensure each shard’s blob-report directory exists before copying. Check that the find command locates files in all-blob-reports-flat/.TESTDINO_TOKEN not available in build
TESTDINO_TOKEN not available in build
Confirm the environment variable is set in your CodeBuild project under Environment → Environment variables. If using Parameter Store or Secrets Manager, verify the IAM role has read access to the secret.
Blob reports not found during merge
Blob reports not found during merge
Ensure each shard pass produces a
blob-report directory. Check that your Playwright config includes ['blob'] in the reporter list or that the default blob output is not overridden. Verify the cp -R command copies files before rm -rf blob-report clears them.Next Steps
CI Optimization
Reduce CI time with smart reruns
Branch Mapping
Map branches to environments for organized test runs
Integrations
Connect Slack, Jira, Linear, Asana, and more
TestDino MCP
Access test results and fix issues with AI agents