Skip to main content
Set up an AWS CodeBuild project that streams Playwright test results to TestDino during the run and view aggregated analytics, failure analysis, and flaky test detection on your dashboard.

Prerequisites

playwright.config.ts

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, run your tests with TESTDINO_TOKEN set. Results stream to TestDino during the run, so no separate upload step is needed.
buildspec.yml
TipSet TESTDINO_TOKEN in the CodeBuild project environment so @testdino/playwright reads it during the run. Results stream live even when tests fail, so failures land on the dashboard without a post_build upload phase.

Sharded Test Runs

For larger test suites, CodeBuild runs Playwright across multiple shard passes within a single build. Each shard streams its own results, and TestDino groups them into one run when they share a ci-run-id.

How it works

  1. CodeBuild runs 4 Playwright shard passes sequentially in a single build
  2. Each shard streams its results to TestDino during the run
  3. Every shard passes the same --ci-run-id so TestDino merges them into a single run
  4. No merge or upload step runs after the shards finish

Full sharded config

buildspec.yml

Key details

Set the ciRunId reporter option in playwright.config to $CODEBUILD_BUILD_ID if you prefer running npx playwright test directly instead of npx tdpw test.

Pipeline execution

After the pipeline runs, CodeBuild logs show the TestDino output in CloudWatch under /aws/codebuild/<project-name>. Each shard streams its results, and TestDino merges them into one run. AWS CloudWatch log events showing TestDino output as Playwright results stream during the build

Results in TestDino

The test run appears in your TestDino dashboard with full failure details, flaky detection, and trend data as tests complete. TestDino Test Runs dashboard showing streamed results from AWS CodeBuild with pass/fail counts and AI Insights

Troubleshooting

Confirm @testdino/playwright is in your playwright.config reporter array and TESTDINO_TOKEN is set in the project environment. Results stream during the run, so no separate upload step is required.
Pass the same --ci-run-id "$CODEBUILD_BUILD_ID" (or ciRunId reporter option) to every shard pass. Different values create one run per shard.
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.

CI Optimization

Reduce CI time with smart reruns

Environment Mapping

Route test results to Dev, Staging, or Production by branch

Integrations

Connect Slack, Jira, Linear, Asana, and more

TestDino MCP

Access test results and fix issues with AI agents