Skip to main content
What you’ll learn
  • How to upload Playwright results from CircleCI using the tdpw CLI
  • How to configure sharded test runs with merged reporting
Upload Playwright test results to TestDino using the tdpw CLI directly in your CircleCI config.

Prerequisites

Before setting up, ensure you have:
playwright.config.js
// ...existing config

reporter: [
  ['html', { outputDir: './playwright-report' }],  // Optional
  ['json', { outputFile: './playwright-report/report.json' }],  // ✅ Required
]

Set Up Your API Key

  1. Open your project in CircleCI
  2. Go to Project Settings → Environment Variables
  3. Click Add Environment Variable
  4. Set the name to TESTDINO_TOKEN
  5. Paste your TestDino API key as the value
  6. Save the variable
WarningNever commit your API key directly in config files. Always use environment variables.

Basic Config

.circleci/config.yml
version: 2.1

jobs:
  test:
    docker:
      - image: mcr.microsoft.com/playwright:v1.59.1-noble
    working_directory: ~/project
    environment:
      CI: "true"
    steps:
      - checkout
      - run:
          name: Install dependencies
          command: npm ci
      - run:
          name: Run Playwright tests
          command: npx playwright test
      - run:
          name: Upload results to TestDino
          command: npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"
          when: always

workflows:
  test-and-upload:
    jobs:
      - test
TipThe when: always flag ensures the upload runs even if tests fail.

Upload Options

FlagDescriptionDefault
--environment <value>Target environment tag (staging, production, qa)unknown
--tag <values>Comma-separated run tags for categorization (max 5)None
--upload-imagesUpload image attachmentsfalse
--upload-videosUpload video attachmentsfalse
--upload-htmlUpload HTML reportsfalse
--upload-tracesUpload trace filesfalse
--upload-filesUpload file attachments (.md, .pdf, .txt, .log)false
--upload-full-jsonUpload all attachmentsfalse
--jsonOutput results as JSON to stdout (for CI/CD)false
-v, --verboseEnable verbose loggingfalse

Sharded Test Runs

For larger test suites, CircleCI parallelism splits tests across multiple containers. Each shard produces a blob report that needs to be merged before uploading.

How it works

  1. CircleCI runs Playwright across 4 shards using parallelism: 4
  2. Each shard saves its blob report to a workspace directory
  3. A separate merge-and-upload job collects all blob reports, merges them, and uploads to TestDino
  4. The merge job runs even if some shards fail

Full sharded config

.circleci/config.yml
version: 2.1

jobs:
  test:
    docker:
      - image: mcr.microsoft.com/playwright:v1.59.1-noble
    working_directory: ~/project
    parallelism: 4
    environment:
      CI: "true"
    steps:
      - checkout

      - run:
          name: Run Playwright shard
          command: |
            mkdir -p workspace/blob/$CIRCLE_NODE_INDEX
            npm ci

            set +e
            npx playwright test --shard=$((CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTAL
            TEST_EXIT_CODE=$?

            if [ -d blob-report ]; then
              cp -R blob-report/. workspace/blob/$CIRCLE_NODE_INDEX/
            fi

            echo $TEST_EXIT_CODE > /tmp/test-exit-code
            exit 0

      - persist_to_workspace:
          root: workspace
          paths:
            - blob

      - store_artifacts:
          path: test-results
          destination: test-results

      - store_test_results:
          path: test-results

      - run:
          name: Mark shard failed if tests failed
          when: always
          command: |
            exit $(cat /tmp/test-exit-code)

  merge-and-upload:
    docker:
      - image: mcr.microsoft.com/playwright:v1.59.1-noble
    working_directory: ~/project
    environment:
      CI: "true"
    steps:
      - checkout

      - attach_workspace:
          at: workspace

      - run:
          name: Install dependencies
          command: npm ci

      - run:
          name: Merge reports
          command: |
            mkdir -p merged-blob-reports playwright-report
            find workspace/blob -type f -name "*.zip" -exec cp {} merged-blob-reports/ \;
            npx playwright merge-reports --reporter=json merged-blob-reports > playwright-report/report.json

      - run:
          name: Upload to TestDino
          command: npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"

      - store_artifacts:
          path: playwright-report
          destination: playwright-report

workflows:
  test:
    jobs:
      - test
      - merge-and-upload:
          requires:
            - test:
                - success
                - failed
                - canceled

Key details

Config BlockWhat It Does
parallelism: 4Runs 4 shard containers in parallel
--shard=$((CIRCLE_NODE_INDEX + 1))/$CIRCLE_NODE_TOTALCircleCI uses 0-based indexing, Playwright uses 1-based
set +e / exit 0Prevents shard failure from stopping blob report collection
persist_to_workspace / attach_workspacePasses blob reports from shards to the merge job
requires: success, failed, canceledMerge job runs regardless of shard outcomes

Run Locally

npm ci
npx playwright install --with-deps
npx playwright test
npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"

Troubleshooting

Add when: always to the upload step. For sharded runs, the merge-and-upload job must require the test job with success, failed, and canceled statuses.
Verify your playwright.config.js outputs to playwright-report/. For sharded runs, ensure persist_to_workspace includes blob and the merge step writes to playwright-report/.
Confirm the environment variable is set in CircleCI → Project Settings → Environment Variables. Variable names are case-sensitive.
Ensure all shards copy blob reports to workspace/blob/$CIRCLE_NODE_INDEX/. Verify blob reports are .zip files.

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