Skip to main content

vedro-pw

Codecov PyPI PyPI - Downloads Python Version

The vedro-pw plugin allows you to use Playwright within your Vedro scenarios for end-to-end testing of web applications.

Installation

Quick

For a quick installation, you can use a plugin manager as follows:

$ vedro plugin install vedro-pw

Manual

To install manually, follow these steps:

  1. Install the package using pip:
$ pip install vedro-pw
  1. Next, activate the plugin in your vedro.cfg.py configuration file:
# ./vedro.cfg.py
import vedro
import vedro_pw


class Config(vedro.Config):
    class Plugins(vedro.Config.Plugins):
        class Playwright(vedro_pw.Playwright):
            enabled = True

Usage

Use the provided context functions in your scenarios to interact with Playwright:

  • launched_browser: Launches a local or remote browser based on the configuration.
  • created_browser_context: Creates a new browser context.
  • opened_browser_page: Opens a new page in the browser context.

Basic Example

Here's a simple Vedro scenario that opens the Playwright homepage and verifies the page title.

import vedro
from vedro_pw import opened_browser_page, expect

class Scenario(vedro.Scenario):
    subject = "Open Playwright homepage"

    async def given(self):
        self.page = await opened_browser_page()

    async def when(self):
        await self.page.goto("https://playwright.dev/")

    async def then(self):
        assert await expect(self.page).to_have_title("Playwright")

Command-Line Options

The plugin adds several command-line arguments for flexibility:

Option Description Default
--pw-browser Browser to use (chromium, firefox, webkit) chromium
--pw-headed Run browser in headed mode False
--pw-headless Run browser in headless mode True
--pw-slowmo Delay operations by specified milliseconds 0
--pw-remote Connect to a remote browser instance False
--pw-remote-endpoint WebSocket endpoint for remote browser ws://localhost:3000
--pw-screenshots Screenshot capturing (always, on-failure, on-reschedule, never) never
--pw-video Video recording (always, on-failure, on-reschedule, never) never
--pw-trace Trace recording (always, on-failure, on-reschedule, never) never
--pw-device Emulate a specific device None
--pw-debug Enable Playwright debug mode by setting PWDEBUG=1 False
--pw-open-last-trace Open the last captured Playwright trace after the test run False

Example Usage

$ vedro run --pw-browser=firefox --pw-headed --pw-screenshots=on-failure

Capture Modes

CaptureMode determines when to capture artifacts:

  • never: Do not capture.
  • on-failure: Capture only when a scenario fails.
  • on-reschedule: Capture when a scenario is rescheduled.
  • always: Always capture.

Artifacts like screenshots, videos, and traces are attached to the scenario results and can be used in reports.

Metadata

Release files for vedro-pw 0.5.0

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

Source distribution (sdist)

Source distribution for vedro-pw 0.5.0
File Size Uploaded Provenance Actions
vedro_pw-0.5.0.tar.gz 23.4 kB Without provenance Details for vedro_pw-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vedro-pw 0.5.0
File Interpreter ABI Platform Actions
vedro_pw-0.5.0-py3-none-any.whl Python 3 none any Details for vedro_pw-0.5.0-py3-none-any.whl

Total release size: 48.9 kB

Release files / vedro_pw-0.5.0.tar.gz

Download URL vedro_pw-0.5.0.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
36fab9740152b0553932ea0b29fd4d5b91d9a9e239e16c4cca986f583b4ab71f
BLAKE2b-256 checksum
How to use checksums
76ad1a9fb9c8171b379b75e9d99b452ac0aaffd4b970ec9c1ae930dd541afd44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / vedro_pw-0.5.0-py3-none-any.whl

Download URL vedro_pw-0.5.0-py3-none-any.whl
Size 25.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
777db0aacb99212111e0961f2b274041b8186015251c5941ac2d73f020f48cb2
BLAKE2b-256 checksum
How to use checksums
1790ca0ab767db7088740c12b9551656a52a8bb75a8cc2beb396e62465e6b120
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for vedro-pw 0.5.0

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