Skip to main content

Generate pytest-playwright configuration files (pytest.ini, pyproject.toml, conftest.py) via CLI

Project description

pytest-pw-config-gen

Generate pytest-playwright configuration files (pytest.ini, pyproject.toml, conftest.py) via CLI.

Installation

pip install pytest-pw-config-gen

Quick Mode

Generate a configuration file immediately with sensible defaults — no prompts required.

pytest-pw-config-gen --quick --output pytest.ini
pytest-pw-config-gen --quick --output pyproject.toml
pytest-pw-config-gen --quick --output conftest.py

Pass --force to overwrite an existing file without confirmation:

pytest-pw-config-gen --quick --output pytest.ini --force

Interactive Mode

The full-screen terminal wizard is the default when no flags are provided. Pass --interactive explicitly if needed:

pytest-pw-config-gen
# or
pytest-pw-config-gen --interactive

It opens a keyboard-driven form:

Key Action
/ Move between options
Space / Enter Toggle a boolean / open a selection menu / edit a value
Ctrl+G Confirm and proceed to save
q / Esc Cancel

After pressing Ctrl+G you are prompted for an output path (defaulting to the current directory). If the file already exists you are asked to confirm the overwrite before anything is written.

In CI environments without a TTY the tool prints a clear error message and exits non-zero rather than hanging.

Supported Options

pytest.ini / pyproject.toml options

Option Description Default
browsers One or more browsers: chromium, firefox, webkit (multi-select) chromium
headed Run browser in headed mode (visible window) false
browser channel Chromium channel: chrome, chrome-beta, chrome-dev, msedge (none)
device preset Emulate a named device (e.g. iPhone 13) (none)
tracing Playwright tracing mode: off, on, retain-on-failure off
video Video capture mode: off, on, retain-on-failure off
screenshot Screenshot capture mode: off, on, only-on-failure off
artifact output dir Directory where traces, videos, and screenshots are saved (none)
base-url Base URL for page.goto() relative URLs (none)
slow-motion Delay between Playwright actions in milliseconds 0
workers Parallel worker count via -n flag (requires pytest-xdist) (none)
retries Number of test reruns on failure (requires pytest-rerunfailures) 0
reporter Test report format: html, junit, json (none)
timeout Per-test timeout in seconds (requires pytest-timeout) 30
testpaths Directories pytest searches for tests tests
markers Custom pytest marker definitions (none)

conftest.py options

Option Description Default
viewport Browser window size as width × height 1280 × 720
action timeout Per-action timeout in milliseconds (none)
locale Browser locale (e.g. en-US, fr-FR) (none)
timezone_id IANA timezone for the browser context (e.g. America/New_York) (none)
geolocation Latitude and longitude for the browser context (none)
storage_state Path to a previously saved browser storage state file (none)
color_scheme Preferred color scheme: light, dark, or no-preference (none)
accept_downloads Automatically accept file downloads false
permissions Browser permissions to grant (e.g. geolocation, notifications) (none)
http_credentials Username and password for HTTP Basic/Digest authentication (none)
extra_http_headers Additional HTTP headers sent with every request (none)
user_agent Custom User-Agent string (none)
ignore_https_errors Ignore HTTPS certificate errors false

Output Files

All generated files include a comment header identifying them as auto-generated and inline comments explaining non-obvious options so you know what to adjust after generation.

pytest.ini

Sets [pytest] addopts flags (browser, tracing, video, etc.) and common ini options (testpaths, timeout, markers).

pyproject.toml

Sets [tool.pytest.ini_options] with the same options — suitable when you prefer a single pyproject.toml for all project tooling.

conftest.py

Creates a browser_context_args fixture with Playwright context options (viewport, locale, geolocation, storage state, etc.). Drop this file in your test root alongside the chosen pytest.ini or pyproject.toml.

Requirements

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_pw_config_gen-0.1.0.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_pw_config_gen-0.1.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file pytest_pw_config_gen-0.1.0.tar.gz.

File metadata

  • Download URL: pytest_pw_config_gen-0.1.0.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pytest_pw_config_gen-0.1.0.tar.gz
Algorithm Hash digest
SHA256 602c6dc29aa38cac8d3fb351841c3c3aac4ef016739ec1a63576cc414eec9283
MD5 9f0d9dc7b7c93f3b5cbfdc865d44cdae
BLAKE2b-256 7037f108992c594dcc48c57e23104803c50308860a4a4638e9081bf7317202a8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pw_config_gen-0.1.0.tar.gz:

Publisher: release.yml on vincenzo-gasparo/pytest-pw-config-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pytest_pw_config_gen-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_pw_config_gen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41891eada6df03dd8640420c35a5730f6b7d7c429b284907da97e12a6c8c3058
MD5 df08b6e0f1ed3b5b46fbd4563bc2d901
BLAKE2b-256 30f3d082ddc72f65d578e26df5ce31097faa79e0fe52e4c864252174ce7f55c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for pytest_pw_config_gen-0.1.0-py3-none-any.whl:

Publisher: release.yml on vincenzo-gasparo/pytest-pw-config-gen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page