vedro-pw


Namevedro-pw JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/vedro-universe/vedro-pw
SummaryIntegrates Playwright for automated browser testing with customizable configuration options
upload_time2024-12-18 18:39:00
maintainerNone
docs_urlNone
authorNikita Tsvetkov
requires_python>=3.8
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements vedro playwright
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # vedro-pw

[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-pw/main.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-pw)
[![PyPI](https://img.shields.io/pypi/v/vedro-pw.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-pw?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)
[![Python Version](https://img.shields.io/pypi/pyversions/vedro-pw.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)

The `vedro-pw` plugin allows you to use [Playwright](https://playwright.dev/) within your [Vedro](https://vedro.io/) scenarios for end-to-end testing of web applications.

## Installation

<details open>
<summary>Quick</summary>
<p>

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

```shell
$ vedro plugin install vedro-pw
```

</p>
</details>

<details>
<summary>Manual</summary>
<p>

To install manually, follow these steps:

1. Install the package using pip:

```shell
$ pip3 install vedro-pw
```

2. Next, activate the plugin in your `vedro.cfg.py` configuration file:

```python
# ./vedro.cfg.py
import vedro
import vedro_pw


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

</p>
</details>

## 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.

```python
import vedro
from vedro_pw import opened_browser_page

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 self.page.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

```shell
$ vedro run --pw-browser=firefox --pw-headed --pw-screenshots=on-failure --save-artifacts
```

### 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.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vedro-universe/vedro-pw",
    "name": "vedro-pw",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Nikita Tsvetkov",
    "author_email": "tsv1@fastmail.com",
    "download_url": "https://files.pythonhosted.org/packages/19/0d/01050fc32abe31c3266e0131ef78cce65b540e1f6c1e22b105cdfc0e1356/vedro_pw-0.2.1.tar.gz",
    "platform": null,
    "description": "# vedro-pw\n\n[![Codecov](https://img.shields.io/codecov/c/github/vedro-universe/vedro-pw/main.svg?style=flat-square)](https://codecov.io/gh/vedro-universe/vedro-pw)\n[![PyPI](https://img.shields.io/pypi/v/vedro-pw.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/vedro-pw?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)\n[![Python Version](https://img.shields.io/pypi/pyversions/vedro-pw.svg?style=flat-square)](https://pypi.python.org/pypi/vedro-pw/)\n\nThe `vedro-pw` plugin allows you to use [Playwright](https://playwright.dev/) within your [Vedro](https://vedro.io/) scenarios for end-to-end testing of web applications.\n\n## Installation\n\n<details open>\n<summary>Quick</summary>\n<p>\n\nFor a quick installation, you can use a plugin manager as follows:\n\n```shell\n$ vedro plugin install vedro-pw\n```\n\n</p>\n</details>\n\n<details>\n<summary>Manual</summary>\n<p>\n\nTo install manually, follow these steps:\n\n1. Install the package using pip:\n\n```shell\n$ pip3 install vedro-pw\n```\n\n2. Next, activate the plugin in your `vedro.cfg.py` configuration file:\n\n```python\n# ./vedro.cfg.py\nimport vedro\nimport vedro_pw\n\n\nclass Config(vedro.Config):\n    class Plugins(vedro.Config.Plugins):\n        class Playwright(vedro_pw.Playwright):\n            enabled = True\n```\n\n</p>\n</details>\n\n## Usage\n\nUse the provided context functions in your scenarios to interact with Playwright:\n\n- `launched_browser`: Launches a local or remote browser based on the configuration.\n- `created_browser_context`: Creates a new browser context.\n- `opened_browser_page`: Opens a new page in the browser context.\n\n### Basic Example\n\nHere's a simple Vedro scenario that opens the Playwright homepage and verifies the page title.\n\n```python\nimport vedro\nfrom vedro_pw import opened_browser_page\n\nclass Scenario(vedro.Scenario):\n    subject = \"Open Playwright homepage\"\n\n    async def given(self):\n        self.page = await opened_browser_page()\n\n    async def when(self):\n        await self.page.goto(\"https://playwright.dev/\")\n\n    async def then(self):\n        assert await self.page.title() == \"Playwright\"\n```\n\n## Command-Line Options\n\nThe plugin adds several command-line arguments for flexibility:\n\n| Option                 | Description                                                             | Default               |\n|------------------------|-------------------------------------------------------------------------|-----------------------|\n| `--pw-browser`         | Browser to use (`chromium`, `firefox`, `webkit`)                        | `chromium`            |\n| `--pw-headed`          | Run browser in headed mode                                              | `False`               |\n| `--pw-headless`        | Run browser in headless mode                                            | `True`                |\n| `--pw-slowmo`          | Delay operations by specified milliseconds                              | `0`                   |\n| `--pw-remote`          | Connect to a remote browser instance                                    | `False`               |\n| `--pw-remote-endpoint` | WebSocket endpoint for remote browser                                   | `ws://localhost:3000` |\n| `--pw-screenshots`     | Screenshot capturing (`always`, `on-failure`, `on-reschedule`, `never`) | `never`               |\n| `--pw-video`           | Video recording (`always`, `on-failure`, `on-reschedule`, `never`)      | `never`               |\n| `--pw-trace`           | Trace recording (`always`, `on-failure`, `on-reschedule`, `never`)      | `never`               |\n| `--pw-device`          | Emulate a specific device                                               | `None`                |\n| `--pw-debug`           | Enable Playwright debug mode by setting `PWDEBUG=1`                     | `False`               |\n| `--pw-open-last-trace` | Open the last captured Playwright trace after the test run              | `False`               |\n\n### Example Usage\n\n```shell\n$ vedro run --pw-browser=firefox --pw-headed --pw-screenshots=on-failure --save-artifacts\n```\n\n### Capture Modes\n\n`CaptureMode` determines when to capture artifacts:\n\n- `never`: Do not capture.\n- `on-failure`: Capture only when a scenario fails.\n- `on-reschedule`: Capture when a scenario is rescheduled.\n- `always`: Always capture.\n\nArtifacts like screenshots, videos, and traces are attached to the scenario results and can be used in reports.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Integrates Playwright for automated browser testing  with customizable configuration options",
    "version": "0.2.1",
    "project_urls": {
        "Docs": "https://github.com/vedro-universe/vedro-pw",
        "GitHub": "https://github.com/vedro-universe/vedro-pw",
        "Homepage": "https://github.com/vedro-universe/vedro-pw"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1cf56515a56637bb9e5f8dd3c651e856f71af3c1511627be528d9d3170b5ad13",
                "md5": "fa9126b4cb30bdcd4ee33a946817af9f",
                "sha256": "ca0c0cd08a47fabc76d75acea93a06da64792b144e98cccc811162932e027712"
            },
            "downloads": -1,
            "filename": "vedro_pw-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fa9126b4cb30bdcd4ee33a946817af9f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 23918,
            "upload_time": "2024-12-18T18:38:59",
            "upload_time_iso_8601": "2024-12-18T18:38:59.906373Z",
            "url": "https://files.pythonhosted.org/packages/1c/f5/6515a56637bb9e5f8dd3c651e856f71af3c1511627be528d9d3170b5ad13/vedro_pw-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "190d01050fc32abe31c3266e0131ef78cce65b540e1f6c1e22b105cdfc0e1356",
                "md5": "93768106c05769e23d8c6464fbca6ef8",
                "sha256": "05e4388dad631d6e73b7d45dc2d4022572ba704fc3421e3b2d6a78335e1def78"
            },
            "downloads": -1,
            "filename": "vedro_pw-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "93768106c05769e23d8c6464fbca6ef8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 22141,
            "upload_time": "2024-12-18T18:39:00",
            "upload_time_iso_8601": "2024-12-18T18:39:00.960036Z",
            "url": "https://files.pythonhosted.org/packages/19/0d/01050fc32abe31c3266e0131ef78cce65b540e1f6c1e22b105cdfc0e1356/vedro_pw-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-18 18:39:00",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vedro-universe",
    "github_project": "vedro-pw",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "vedro",
            "specs": [
                [
                    ">=",
                    "1.7"
                ],
                [
                    "<",
                    "2.0"
                ]
            ]
        },
        {
            "name": "playwright",
            "specs": [
                [
                    "<",
                    "2.0"
                ],
                [
                    ">=",
                    "1.38"
                ]
            ]
        }
    ],
    "lcname": "vedro-pw"
}
        
Elapsed time: 0.45358s