Skip to main content

ASYNC Pytest plugin for Playwright

Project description

Playwright Async Pytest -- ASYNC Pytest plugin for Playwright

pypi

There an official playwright plugin for pytest: PyPI / playwright-pytest / intro. But if you need an async version, here is it!

Installation

pip install pytest-playwright-async

Example

Here you can find more examples.


# tests/async/conftest.py

import pytest


# install anyio
# install uvloop
@pytest.fixture(
    scope='session',
    params=[
        # https://anyio.readthedocs.io/en/stable/testing.html#specifying-the-backends-to-run-on
        pytest.param(('asyncio', {'use_uvloop': True}), id='asyncio+uvloop'),
        pytest.param(('asyncio', {'use_uvloop': False}), id='asyncio'),
        # pytest.param(('trio', {'restrict_keyboard_interrupt_to_checkpoints': True}), id='trio'),
    ],
    autouse=True,
)
def anyio_backend(request):
    return request.param
# tests/async/test_for_readme.py

from playwright.async_api import Page


async def test_page_async(page_async: Page):
    print(f'\n{page_async = }')
    await page_async.goto('https://playwright.dev/')
    assert 'Playwright' in await page_async.title()

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_playwright_async-1.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

pytest_playwright_async-1.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest_playwright_async-1.1.0.tar.gz.

File metadata

  • Download URL: pytest_playwright_async-1.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.19.1 CPython/3.10.12 Linux/6.8.0-1014-azure

File hashes

Hashes for pytest_playwright_async-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c8db300f4c56968d99e6fe61d9466dc11b7d39782bdd7793f70ab1fc53075159
MD5 ee732366536ae71b47f84ada7bd81b63
BLAKE2b-256 d0e99da3c3377f6418f7fcd9300062e06fca8082bad3acda6f623b4782a99998

See more details on using hashes here.

File details

Details for the file pytest_playwright_async-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_playwright_async-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d83d644f9c8fcd4713509bb7dc96def968c6055b1754286df98e6fba748daee3
MD5 e709901022af97f988be3b3cd178c2ab
BLAKE2b-256 777c22211919612cf5478a4a890f0681bfd673a57b67a0dcbd9f9b4ef0cb24aa

See more details on using hashes here.

Supported by

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