A pytest plugin for playwright python
Project description
pytest-playwright-enhanced
[!CAUTION]
pytest-playwright-enhanced
is in the alpha stage.
pytest-playwright-enhanced
is a batteries included pytest
plugin for the playwright
python bindings that
offers extended functionality with a focus on removing boilerplate code for projects that wish to test modern
web applications and APIs. pytest-playwright-enhanced
plans to offer the following:
- Automatic, browser management and installation if required (TBD)
- Improved, human readable APIs that build on top of playwrights API.
- Improved artifacting and debugability.
Asynchronous
support.- Custom
hooks
to allow you to plugin and modify behaviour at runtime. - Much More...
pytest-playwright-enhanced
is currently implementing core plugin functionality, the main enhancements
will follow shortly.
pytest-playwright-enhanced
right now treats browsers
, contexts
and pages
at a function
level. This allows
easily per test overrides at the small cost of slightly less performance creating browsers, for now it is worth it
as it offers much more flexibility and user defined configurations.
Quick Start
Quickly get running by doing the following:
pip install pytest-playwright-enhanced
pytest <posargs> --acquire-binaries=with-deps
Fixtures
pw_playwright
- At present this returns the syncPlaywright
instance.pw_multi_browser
- Automatically run a test onchromium
,firefox
andwebkit
.pw_headed
- Returns if the browser is running headlessly or not.pw_slow_mo
- Returns the currently throttle in milliseconds, defaults to0
.pw_is_chromium
- Returns if the current browser is chromium.pw_is_webkit
- Returns if the current browser is webkit.pw_is_firefox
- Returns if the current browser is firefox.pw_root_url
- Returns the base url auto loaded byPage
objects.pw_browser
- Returns the currentBrowser
instance.pw_browser_engine
- A string representing the type of browser for this test.pw_context_kwargs
- An overridable fixture to control arguments to playwrightContext
instances.pw_page
- Returns a newPage
instance.pw_is_debugging
- Returns if playwright will be usingPW_DEBUG
mode.pw_browser_kwargs
- An overridable fixture to control arguments to playwright `Browser nstances.
Hooks
pytest_playwright_acquire_binaries
: Hook in and customise binary acquisition at runtime.
pytest_playwright_is_debugging
: User defined behaviour for detecting if an IDE is debugging.
Markers
@pytest.mark.only_on_browsers
- Only run on a subset of browsers when using thepw_multi_browser
fixture.@pytest.mark.context_kwargs
- Per test level overrides to thecontext
object.@pytest.mark.browser_kwargs
- Per test level overrides to thebrowser
object.
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
File details
Details for the file pytest_playwright_enhanced-0.1.3.tar.gz
.
File metadata
- Download URL: pytest_playwright_enhanced-0.1.3.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/6.5.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8869e0036ae65c29b4dc8768aba1a7d575210bfc790b8edbd0c92713bbd45a9c |
|
MD5 | eb69809bb62e2d6efbcbe3a982e6edcf |
|
BLAKE2b-256 | 069ed87acbb02f68dfb329bd782bde4d070504843cb8a18da395ce30dd6a8162 |
File details
Details for the file pytest_playwright_enhanced-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: pytest_playwright_enhanced-0.1.3-py3-none-any.whl
- Upload date:
- Size: 15.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.2 Linux/6.5.0-1015-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d00b7f43477998eb2a0e09c95a04449916725f39e6a50e6271b3f7a2e0125526 |
|
MD5 | 2d780c59a3106024245fd91ba2669821 |
|
BLAKE2b-256 | cb29e4cacef698bcb11544cabb5dee9f1855e228553212d5bd2f997edb138870 |