ASYNC Pytest plugin for Playwright
Project description
Playwright Async Pytest -- ASYNC Pytest plugin for Playwright
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 pytest_asyncio
@pytest_asyncio.fixture(scope='session')
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()
yield loop
loop.close()
# tests/test_for_readme.py
from playwright.async_api import Page
import pytest
@pytest.mark.asyncio
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for pytest_playwright_async-0.17.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 286c9addf0cf4cb1a1216517f2f5044857bddbf7f8509914ad1e3d247ba80661 |
|
MD5 | 5bc182893066151dec84cda66b4a8af5 |
|
BLAKE2b-256 | 38622c487cf2c7a8bb54e8bd9f83f4311b00f0acc73d2bf7a6745f940646da78 |
Close
Hashes for pytest_playwright_async-0.17.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a99d6ebfa3a9b9163cbc714e73724cf860442273b379d8a828b7e084c42302b |
|
MD5 | b82dbe4d8df390cc02166a079ed99c9b |
|
BLAKE2b-256 | e2ab316c5e0ae1fd1efee86ac04f8d1e4e3a5f727a67dd3c7a6a4aa1f289e730 |