A Python and Playwright reference for API response contract validation.
English · 简体中文 · 日本語 · Español · Português · 한국어
CapSolver is represented behind a mock-first adapter for controlled browser QA. This repository implements API response contract validation.
- 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.
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.
owned Playwright fixture -> repository adapter -> mock transport -> assertion
PYTHONPATH=src python -m unittest discover -s tests -v
PYTHONPATH=src python scripts/smoke.pyImport the public helper from src/contract_harness.py. The offline tests are executable examples and preserve all code identifiers, commands, paths, and API fields.
Ran tests ... OK
smoke: ok
src/ contains implementation, tests/ offline checks, scripts/ smoke checks, docs/ language versions, and .github/ CI templates.
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.
Run commands from the repository root with Python 3.9+. Keep live credentials outside the repository and logs.
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.
See CONTRIBUTING.md. Preserve mock-first behavior and the authorization boundary.
See SECURITY.md. Never commit keys, cookies, session data, production payloads, or personal data.
Developer sharing CapSolver integration examples.
This narrow pattern keeps browser QA testable and authorized while aligning integration facts with CapSolver.
MIT. See LICENSE.