Skip to main content
Archived

This project has been archived by its maintainers, and is no longer receiving any updates.

tdpw

PyPI version Python License: MIT

TestDino CLI - Cache test metadata and upload Playwright test reports to TestDino platform

Quick Start

⚠️ Important: The tdpw upload command requires a JSON report to be generated during test execution. Make sure to:

  1. Install required plugins: pip install pytest-playwright-json pytest-html
  2. Run your tests with --playwright-json flag: pytest --playwright-json=test-results/report.json
  3. Optionally generate HTML reports: pytest --html=test-results/index.html --self-contained-html

Cache Command

# Cache test execution metadata after Playwright runs
tdpw cache --token="your-api-token"

# With custom directory (recommended when test results are in a specific folder)
tdpw cache --working-dir test-results --token="your-api-token"

# With verbose logging
tdpw cache --working-dir test-results --verbose --token="your-api-token"

Last Failed Command

# Get last failed test cases for Playwright reruns
tdpw last-failed --token="your-api-token"

# Run only last failed tests
pytest $(tdpw last-failed --token="your-api-token")

Upload Command

# Upload test reports with attachments
tdpw upload ./test-results --token="your-api-token"

# Upload all attachments
tdpw upload ./test-results --token="your-api-token" --upload-full-json

Installation

pip

pip install tdpw
tdpw <command> --token="your-token"

Features

  • Test Metadata Caching - Store test execution metadata after Playwright runs
  • Last Failed Tests - Retrieve and rerun only failed tests for faster CI/CD pipelines
  • Zero Configuration - Auto-discovers Playwright reports and configuration
  • Smart Shard Detection - Automatically detects Playwright shard information
  • CI/CD Ready - Works seamlessly with GitHub Actions, GitLab CI, Jenkins, Azure DevOps
  • Secure Authentication - Token-based API authentication

Commands

Cache Command

Store test execution metadata after Playwright runs.

# Basic usage
tdpw cache --token="your-token"

# With custom working directory
tdpw cache --working-dir ./test-results --token="your-token"

# With verbose logging
tdpw cache --verbose --token="your-token"

Options:

Option Description Default
--working-dir <path> Directory to scan for test results Current directory
--cache-id <value> Custom cache ID override Auto-detected
-t, --token <value> TestDino API token Required
-v, --verbose Enable verbose logging false

Last Failed Command

Retrieve cached test failures for intelligent reruns.

# Basic usage
tdpw last-failed --token="your-token"

# Run only last failed tests
pytest $(tdpw last-failed --token="your-token")

# With custom branch and commit
tdpw last-failed --branch="main" --commit="abc123" --token="your-token"

Options:

Option Description Default
--cache-id <value> Custom cache ID override Auto-detected
--branch <value> Custom branch name override Auto-detected
--commit <value> Custom commit hash override Auto-detected
-t, --token <value> TestDino API token Required
-v, --verbose Enable verbose logging false

Upload Command

Upload test reports with attachments.

⚠️ Important: The tdpw upload command requires a JSON report to function. You must:

  1. Install required plugins: pip install pytest-playwright-json pytest-html
  2. Run your tests with the --playwright-json flag: pytest --playwright-json=test-results/report.json
  3. Optionally generate HTML reports: pytest --html=test-results/index.html --self-contained-html

Without the JSON report, the upload command will fail. See the CI/CD Integration section for complete examples.

# Basic upload
tdpw upload ./test-results --token="your-token"

# Upload with attachments
tdpw upload ./test-results --token="your-token" --upload-images --upload-videos

# Upload all attachments
tdpw upload ./test-results --token="your-token" --upload-full-json

Options:

Option Description
<report-directory> Directory containing Playwright reports (required)
-t, --token <value> TestDino API token (required)
--upload-images Upload image attachments
--upload-videos Upload video attachments
--upload-html Upload HTML reports
--upload-traces Upload trace files
--upload-files Upload file attachments (.md, .pdf, .txt, .log)
--upload-full-json Upload all attachments
-v, --verbose Enable verbose logging

Environment Variables

export TESTDINO_TOKEN="your-api-token"

CI/CD Integration

GitHub Actions

name: Playwright Tests
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: '3.11'

      - name: Install dependencies
        run: |
          pip install pytest pytest-playwright pytest-playwright-json pytest-html tdpw
          playwright install chromium --with-deps

      - name: Run tests
        run: |
          pytest \
            --playwright-json=test-results/report.json \
            --html=test-results/index.html \
            --self-contained-html

      - name: Cache rerun metadata
        if: always()
        run: tdpw cache --working-dir test-results --token="${{ secrets.TESTDINO_TOKEN }}" -v

      - name: Upload test reports
        if: always()
        run: tdpw upload ./test-results --token="${{ secrets.TESTDINO_TOKEN }}" --upload-full-json

GitLab CI

image: python:3.11

stages:
  - test

playwright-tests:
  stage: test
  script:
    - pip install pytest pytest-playwright pytest-playwright-json pytest-html tdpw
    - playwright install chromium --with-deps
    - pytest --playwright-json=test-results/report.json --html=test-results/index.html --self-contained-html
    - tdpw upload ./test-results --token="$TESTDINO_TOKEN" --upload-full-json
  when: always

Jenkins

pipeline {
    agent any

    environment {
        TESTDINO_TOKEN = credentials('testdino-token')
    }

    stages {
        stage('Test') {
            steps {
                sh 'pip install pytest pytest-playwright pytest-playwright-json pytest-html tdpw'
                sh 'playwright install chromium --with-deps'
                sh 'pytest --playwright-json=test-results/report.json --html=test-results/index.html --self-contained-html'
                sh 'tdpw upload ./test-results --token="$TESTDINO_TOKEN" --upload-full-json'
            }
        }
    }
}

Authentication

Getting Your Token

  1. Sign up at TestDino
  2. Navigate to Settings > API Tokens
  3. Generate a new token
  4. Store it securely in your CI/CD secrets

Token Format:

trx_{environment}_{64-character-hex-string}

Security Best Practices:

  • Never commit tokens to version control
  • Use environment variables or CI/CD secrets
  • Rotate tokens regularly

Examples

Basic Workflow

# Run tests with JSON and HTML reports
pytest \
  --playwright-json=test-results/report.json \
  --html=test-results/index.html \
  --self-contained-html

# Cache metadata (specify directory where test results are located)
tdpw cache --working-dir test-results --token="your-token"

Intelligent Test Reruns

# Run tests with JSON and HTML reports, then cache results
pytest \
  --playwright-json=test-results/report.json \
  --html=test-results/index.html \
  --self-contained-html
tdpw cache --working-dir test-results --token="your-token"

# On next run, execute only previously failed tests
pytest $(tdpw last-failed --token="your-token")

Complete CI/CD Workflow

# Run all tests with JSON and HTML reports
pytest \
  --playwright-json=test-results/report.json \
  --html=test-results/index.html \
  --self-contained-html

# Cache test metadata (specify directory where test results are located)
tdpw cache --working-dir test-results --token="$TESTDINO_TOKEN"

# Rerun only failed tests
if [ $? -ne 0 ]; then
  FAILED=$(tdpw last-failed --token="$TESTDINO_TOKEN")
  [ -n "$FAILED" ] && pytest $FAILED
fi

Support


Made with love by the TestDino team

Metadata

Release files for tdpw 1.0.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdpw 1.0.23
File Size Uploaded Provenance Actions
tdpw-1.0.23.tar.gz 63.4 kB Without provenance Details for tdpw-1.0.23.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tdpw 1.0.23
File Interpreter ABI Platform Actions
tdpw-1.0.23-py3-none-any.whl Python 3 none any Details for tdpw-1.0.23-py3-none-any.whl

Total release size: 140.5 kB

Release files / tdpw-1.0.23.tar.gz

Download URL tdpw-1.0.23.tar.gz
Size 63.4 kB
Tags Source
SHA-256 checksum
How to use checksums
27910d742e5689d4ba527bfe74f961e15eebd295a1ad30b84b878212afa87209
BLAKE2b-256 checksum
How to use checksums
e0cc5f154df6c67e13bec29409c75de2e21438d766f34338eb6e570b20fc1b26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / tdpw-1.0.23-py3-none-any.whl

Download URL tdpw-1.0.23-py3-none-any.whl
Size 77.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e8cd99723ffdf4d65bc18b60425599eee3396af889a6ba1f3e708290f46caabd
BLAKE2b-256 checksum
How to use checksums
326108a7f273390c44f1bbcd59575edbb2ad7737c1ee98181efbd5948a208caf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Security for tdpw 1.0.23

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page