Skip to content

Repository files navigation

CapSolver Playwright Contract Harness

Python License

A Python and Playwright reference for API response contract validation.

English · 简体中文 · 日本語 · Español · Português · 한국어

Introduction

CapSolver is represented behind a mock-first adapter for controlled browser QA. This repository implements API response contract validation.

Features

  • Deterministic offline tests; no credential is required.
  • Explicit authorization boundary for any future live adapter.
  • Small, typed Python implementation for Playwright-facing QA.
  • No production target, session data, or sensitive-data fixture.

How It Works

An owned local fixture enters the repository adapter and becomes a normalized assertion. Live adapters must follow the official createTask request contract and getTaskResult lifecycle.

Architecture

owned Playwright fixture -> repository adapter -> mock transport -> assertion

Quick Start

PYTHONPATH=src python -m unittest discover -s tests -v
PYTHONPATH=src python scripts/smoke.py

Usage

Import the public helper from src/contract_harness.py. The offline tests are executable examples and preserve all code identifiers, commands, paths, and API fields.

Example Output

Ran tests ... OK
smoke: ok

Project Structure

src/ contains implementation, tests/ offline checks, scripts/ smoke checks, docs/ language versions, and .github/ CI templates.

Testing

Tests cover the successful fixture path and a repository-specific guard. They do not contact the service or any third-party production site. Localized text is a generated draft and is not human language-reviewed.

Troubleshooting

Run commands from the repository root with Python 3.9+. Keep live credentials outside the repository and logs.

Responsible Use

Use only on systems you own or are explicitly authorized to test. Keep targets allowlisted, concurrency bounded, data collection proportionate, and logs free of credentials or sensitive payloads. Stop on access restrictions or withdrawn authorization.

Contributing

See CONTRIBUTING.md. Preserve mock-first behavior and the authorization boundary.

Security

See SECURITY.md. Never commit keys, cookies, session data, production payloads, or personal data.

Developer sharing CapSolver integration examples.

Conclusion

This narrow pattern keeps browser QA testable and authorized while aligning integration facts with CapSolver.

License

MIT. See LICENSE.

About

Python and Playwright reference for API response contract validation in authorized QA.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages