Skip to main content
What you’ll learn
  • How to upload Playwright results from Bitbucket Pipelines to TestDino
  • How to configure sharded test runs with merged reporting
  • How to store the TESTDINO_TOKEN as a secured repository variable
Bitbucket Pipelines runs your CI from a bitbucket-pipelines.yml file in the root of your repository. This guide covers a basic single-step upload and a parallel sharded setup with merged reporting.

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

Store your TestDino API key as a secured repository variable so it is available to your pipeline without exposing it in bitbucket-pipelines.yml.
  1. Open your repository in Bitbucket
  2. Go to Repository settings
  3. Under Pipelines, click Repository variables
  4. Click Add variable
  5. Set Name to TESTDINO_TOKEN
  6. Paste your TestDino API key into Value
  7. Tick Secured so the value is masked in logs
  8. Click Add
TipUse Repository variables for a project-specific token, or Workspace variables when you want the same token available across every repository in your workspace.

Basic Pipeline Config

For a simple setup without sharding, add the upload step after your Playwright tests.
bitbucket-pipelines.yml
image: mcr.microsoft.com/playwright:v1.59.1-noble

definitions:
  caches:
    npm: ~/.npm

pipelines:
  default:
    - step:
        name: Playwright tests
        caches:
          - npm
        script:
          - npm ci
          - npx playwright test || true
          - npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"
        artifacts:
          - playwright-report/**
          - test-results/**
TipThe || true after npx playwright test keeps the upload step running even when tests fail. TestDino records the failures in the run, so you still see them on the dashboard.

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 large test suites, run shards in parallel and merge the results before uploading to TestDino.

How it works

  1. Each shard runs npx playwright test --shard=<n>/<total> in its own Bitbucket step
  2. Each shard publishes its blob-report/ directory as a Pipelines artifact
  3. A final step pulls every shard’s artifacts into one folder
  4. npx playwright merge-reports produces a single JSON report, which is uploaded to TestDino

Full sharded config

bitbucket-pipelines.yml
image: mcr.microsoft.com/playwright:v1.59.1-noble

definitions:
  caches:
    npm: ~/.npm

pipelines:
  default:
    - parallel:
        - step:
            name: Shard 1
            caches:
              - npm
            script:
              - npm ci
              - npx playwright test --shard=1/4 || true
            artifacts:
              - blob-report/**
        - step:
            name: Shard 2
            caches:
              - npm
            script:
              - npm ci
              - npx playwright test --shard=2/4 || true
            artifacts:
              - blob-report/**
        - step:
            name: Shard 3
            caches:
              - npm
            script:
              - npm ci
              - npx playwright test --shard=3/4 || true
            artifacts:
              - blob-report/**
        - step:
            name: Shard 4
            caches:
              - npm
            script:
              - npm ci
              - npx playwright test --shard=4/4 || true
            artifacts:
              - blob-report/**

    - step:
        name: Merge and upload
        caches:
          - npm
        script:
          - npm ci
          - mkdir -p all-blob-reports playwright-report
          - cp -r blob-report/* all-blob-reports/ 2>/dev/null || true
          - npx playwright merge-reports --reporter=json ./all-blob-reports > playwright-report/report.json
          - npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"
        artifacts:
          - playwright-report/**
Sharding needs a blob reporter in your Playwright config:
playwright.config.js
export default {
  reporter: process.env.CI ? [['blob'], ['json', { outputFile: 'report.json' }]] : 'list',
};

Key details

DetailNotes
parallel:Bitbucket runs every step under this block at the same time, on separate runners.
artifacts:Files matching these globs are saved and downloaded into every later step in the same pipeline.
blob-report/**Playwright’s blob reporter writes one file per shard. Configure it in playwright.config.js.
Auto-downloadThe merge step receives all shard artifacts in blob-report/ with no explicit download call.
|| trueKeeps the shard green even on test failures so the merge and upload step always runs.
merge-reportsPlaywright’s built-in tool that combines blob reports into a single JSON, HTML, or JUnit report.
playwright-report/**Final artifact you can download from Bitbucket’s build page for a copy outside TestDino.
TESTDINO_TOKENRead from the Secured repository variable you added earlier. Masked in logs.

Pipeline execution

After the pipeline runs, Bitbucket shows each shard step and the merge-and-upload step in the pipeline view. Bitbucket Pipelines build view showing the merge-and-upload step log with TestDino CLI configuration output and discovered report files

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 Bitbucket Pipelines with pass/fail counts and AI Insights

Rerun Failed Tests

Cache test metadata after a run, then rerun only the previously failed tests on the next pipeline:
bitbucket-pipelines.yml
script:
  - npx tdpw cache --token="$TESTDINO_TOKEN"
  - npx tdpw upload ./playwright-report --token="$TESTDINO_TOKEN"
Rerun only failed tests on the next pipeline:
bitbucket-pipelines.yml
script:
  - npx playwright test $(npx tdpw last-failed --token="$TESTDINO_TOKEN")
For advanced rerun strategies, caching patterns, and CI optimization techniques, see CI Optimization.

Troubleshooting

Bitbucket stops a step on the first non-zero exit code. Add || true after npx playwright test so the upload step still runs when tests fail. TestDino records the failures in the run.
Confirm playwright.config.js enables both the HTML and JSON reporters, or blob and json for sharded runs. For sharded pipelines, check that every shard step lists blob-report/** under artifacts: so the merge step has them all.
Open Repository settings → Pipelines → Repository variables and confirm a variable named exactly TESTDINO_TOKEN exists and is marked Secured. Variable names are case-sensitive.
Bitbucket only auto-downloads artifacts from steps that completed in the same pipeline. Check that every shard step finished, even if tests failed, and that its artifacts: glob matches the blob-report/ directory. Use a wildcard like blob-report/** rather than a single filename.

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