Skip to main content
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
Set up an AWS CodeBuild project to upload Playwright test results to TestDino and view aggregated analytics, failure analysis, and flaky test detection on your dashboard. This guide covers a basic buildspec, sharded buildspec for parallel test execution across multiple shard passes, and merged reporting.

Prerequisites

Before setting up, ensure you have:
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.
  1. Open your AWS CodeBuild project
  2. Choose Edit
  3. Open the Environment section
  4. Add an environment variable named TESTDINO_TOKEN
  5. Paste your TestDino API key as the value
  6. Save the project
WarningNever commit your API key directly in buildspec files. Always use CodeBuild environment variables. For additional security, store the key in AWS Systems Manager Parameter Store or AWS Secrets Manager and reference it in your environment configuration.

Basic Buildspec Config

For a simple setup without sharding, add the upload step after your Playwright tests.
buildspec.yml
TipThe post_build phase runs even if the build phase fails, ensuring test results are uploaded regardless of test outcomes. The artifacts block saves reports for review in S3.

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

  1. CodeBuild runs 4 Playwright shard passes sequentially in a single build
  2. Each shard’s blob report is copied to a dedicated directory
  3. All blob reports are flattened and merged into a single report.json
  4. The merged report is uploaded to TestDino
  5. The build fails only if both tests and the merge/upload fail

Full sharded config

buildspec.yml

Key details

Pipeline execution

After the pipeline runs, CodeBuild logs show the TestDino CLI output in CloudWatch under /aws/codebuild/<project-name>. AWS CloudWatch log events showing TestDino CLI upload output with configuration validation, file discovery, and Playwright report parsing steps

Results in TestDino

Once uploaded, the test run appears in your TestDino dashboard with full failure details, flaky detection, and trend data. TestDino Test Runs dashboard showing uploaded results from AWS CodeBuild with pass/fail counts and AI Insights

Rerun Failed Tests

Cache test metadata to enable selective reruns:
buildspec.yml
Rerun only failed tests on the next build:
buildspec.yml
For advanced rerun strategies, caching patterns, and CI optimization techniques, see CI Optimization.

Troubleshooting

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.
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/.
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.
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