Skip to main content
Upload Playwright test results to TestDino after each GitHub Actions workflow run. Results appear in TestDino within seconds of upload.

Quick Reference

After your Playwright tests finish in GitHub Actions, upload results to TestDino with a single command. This table shows the upload options and flags you need to get started.
TaskCommand/Flag
Basic uploadnpx tdpw upload ./playwright-report --token="..."
With HTML report--upload-html
With all artifacts--upload-full-json
Set environment--environment="staging"
Always runif: always()

Basic Workflow

Add the upload step after your Playwright tests:
name: Playwright Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Install Playwright
        run: npx playwright install --with-deps

      - name: Run tests
        run: npx playwright test

      - name: Upload to TestDino
        if: always()
        run: npx tdpw upload ./playwright-report --token="${{ secrets.TESTDINO_TOKEN }}" --upload-html
The if: always() condition ensures results upload even when tests fail.

Store the API Key

  1. Go to your GitHub repository
  2. Open Settings → Secrets and variables → Actions
  3. Click New repository secret
  4. Name: TESTDINO_TOKEN
  5. Value: Your TestDino API key
  6. Click Add secret
Need an API key? See Generate API Keys for step-by-step instructions.

Configure Playwright

Update playwright.config.js to generate the required reports:
export default {
  reporter: [
    ['json', { outputFile: './playwright-report/report.json' }],
    ['html', { outputDir: './playwright-report' }]
  ]
}

Upload Options

FlagDescription
--upload-htmlInclude HTML report for interactive viewing
--upload-imagesInclude screenshots
--upload-videosInclude video recordings
--upload-tracesInclude Playwright traces
--upload-full-jsonInclude all artifacts
--environmentSet target environment tag

Environment Tagging

Tag uploads with an environment to organize results:
- name: Upload to TestDino
  if: always()
  run: |
    npx tdpw upload ./playwright-report \
      --token="${{ secrets.TESTDINO_TOKEN }}" \
      --upload-full-json \
      --environment="staging"
Environment tags appear in TestDino dashboards and can be used for filtering.

Full Artifacts Example

Upload all evidence for debugging:
- name: Upload to TestDino
  if: always()
  run: |
    npx tdpw upload ./playwright-report \
      --token="${{ secrets.TESTDINO_TOKEN }}" \
      --upload-full-json

Rerun Failed Tests

Cache test metadata to enable selective reruns:
- name: Run tests
  run: npx playwright test

- name: Cache metadata
  if: always()
  run: npx tdpw cache --token="${{ secrets.TESTDINO_TOKEN }}"
Create a separate workflow to rerun only failed tests:
- name: Get failed tests
  id: failed
  run: |
    npx tdpw last-failed --token="${{ secrets.TESTDINO_TOKEN }}" > failed.txt
    echo "tests=$(cat failed.txt)" >> $GITHUB_OUTPUT

- name: Rerun failed tests
  if: steps.failed.outputs.tests != ''
  run: npx playwright test ${{ steps.failed.outputs.tests }}

Sharded Tests with Smart Reruns

Run tests in parallel shards with automatic failed test detection:
name: Playwright Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shardIndex: [1, 2, 3, 4]
        shardTotal: [4]
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Install Playwright
        run: npx playwright install --with-deps

      - name: Run Playwright Tests
        shell: bash
        env:
          TESTDINO_TOKEN: ${{ secrets.TESTDINO_TOKEN }}
          SHARD_INDEX: ${{ matrix.shardIndex }}
          SHARD_TOTAL: ${{ matrix.shardTotal }}
        run: |
          echo "GitHub run attempt: ${{ github.run_attempt }}"
          # Case 1: Re-run failed jobs → run only failed tests
          if [[ "${{ github.run_attempt }}" -gt 1 ]]; then
            echo "Detected re-run. Executing only last failed tests via TestDino."
            
            npx tdpw last-failed --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} > last-failed-flags.txt
            EXTRA_PW_FLAGS="$(cat last-failed-flags.txt)"
            
            if [[ -z "$EXTRA_PW_FLAGS" ]]; then
              echo "No failed tests found. Exiting."
              exit 0
            fi
            
            echo "Running failed tests without sharding:"
            echo "$EXTRA_PW_FLAGS"
            
            # IMPORTANT: preserve quotes
            eval "npx playwright test $EXTRA_PW_FLAGS"
            exit 0
          fi
          
          # Case 2: Normal execution (first run)
          echo "Running all Playwright tests"
          npx playwright test \
            --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}

      - name: Cache rerun metadata
        if: always()
        run: npx tdpw cache --token="${{ secrets.TESTDINO_TOKEN }}"

      - name: Upload test reports
        if: always()
        run: npx tdpw upload ./playwright-report --token="${{ secrets.TESTDINO_TOKEN }}" --upload-full-json
This workflow automatically detects GitHub Actions reruns and executes only the tests that failed in the previous attempt, significantly reducing CI time. Create API keys, configure status checks, and optimize CI.