After this course i will be a decent playwright and pytest developer
Project description
Playwright and Pytest
Install Pytest Plugin
pip install pytest-playwright
Install the required browsers
playwright install
test_example.py
Running the Example Test
pytest
Using Test Hooks
import pytest
from playwright.sync_api import Page, expect
@pytest.fixture(scope="function", autouse=True)
def before_each_after_each(page: Page):
print("before the test runs")
# Go to the starting url before each test.
page.goto("https://playwright.dev/")
yield
print("after the test runs")
def test_main_navigation(page: Page):
# Assertions use the expect API.
expect(page).to_have_url("https://playwright.dev/")
Running tests headed
pytest --headed
Running tests on different browsers and multiple browser
pytest --browser webkit
pytest --browser webkit --browser firefox
Running specific tests
pytest test_login.py
To run a set of test files pass in the names of the test files that you want to run.
pytest tests/test_todo_page.py tests/test_landing_page.py
To run a specific test pass in the function name of the test you want to run.
pytest -k test_add_a_todo_item
Run tests in Parallel
pytest --numprocesses 2
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 playwright_project-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d33da96b4d03f6635fd7aae0cad7d368f27192700433818046578896c6dfec6 |
|
MD5 | 55700b36bc1ff4f5f6743c74766c7173 |
|
BLAKE2b-256 | d9ec4265af2c33bc2e86c43930503dc54b29b6742907f5f78d4b15d7d2506cfe |