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/conftest.py
import asyncio

import nest_asyncio
import pytest


@pytest.fixture(scope='session', autouse=True)
def event_loop():  # https://pytest-asyncio.readthedocs.io/en/latest/reference/fixtures.html#fixtures
    policy = asyncio.get_event_loop_policy()
    loop = policy.new_event_loop()
    nest_asyncio._patch_loop(loop)  # *
    yield loop
    loop.close()


@pytest.fixture(scope='session', autouse=True)
def anyio_backend():
    return 'asyncio'
# tests/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.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

pytest_playwright_async-1.0.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_playwright_async-1.0.0.tar.gz
  • Upload date:
  • Size: 6.8 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.0.0.tar.gz
Algorithm Hash digest
SHA256 63d173223844e48a20a57561f04156795a3c64cc59b92e306ce56c368809b7dd
MD5 ea927b6d03ba61d0192d94c319ac0d5c
BLAKE2b-256 97eaef24941e4b69be5e1914eddea3c4b931cec63914a1156a743881c5d502fc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_playwright_async-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26a958661204f9e7a70448429c8ef76868944bd272ec78f1b514f1b678d0f7c9
MD5 bb0ea19e342affaae0adca3fe2aa5543
BLAKE2b-256 42f37a711459c4b2a5eb4bddb662a613500afbce94a8c954dd8e805c582e4580

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