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  # pip install nest-asyncio
import pytest


@pytest.fixture(scope='session', autouse=True)
def event_loop():
    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)
# pip install anyio
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.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest_playwright_async-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 a4fd8e1094f1ccfbf12e25e7d87428d82c57a4ebb4e4e2ad12deb59228567a27
MD5 a456a41b71c76f49d64d4fe39bbc5084
BLAKE2b-256 859a1e12193fd92b2afc2e9c6020c4c2689a5e485756ae8f374ec582a9554167

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pytest_playwright_async-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed667a519a34b8401ac194aadbec0d81695dded91832d60f8de83c5ad9fce99c
MD5 57088fe31684125d59e97485a1f5b4c0
BLAKE2b-256 72fba3486219ac2a21050a10048535e34fe6bd969f0a077ffab495b028a70458

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