Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Playwright Python example project with pytest and Allure report

License

NotificationsYou must be signed in to change notification settings

nirtal85/Playwright-Python-Example

twitterYouTube Channeldev runnightlyuvRuff

Automation College - Playwright Python Course

📃 Articles written about this project

🛠️ Tech Stack

ToolDescription
allure-pytestAllure reporting with your Pytest tests for better reporting
axe-playwright-pythonPython library for running accessibility checks with Playwright
playwrightPython library to automate the Chromium, WebKit, and Firefox browsers through a single API.
pytestPopular testing framework for Python
pytest-base-urlPytest plugin for setting a base URL for your tests
pytest-playwrightPytest plugin for Playwright integration for browser automation testing
pytest-splitPytest plugin which splits the test suite to equally sized sub suites based on test execution time.
requestsVersatile library for making HTTP requests in Python

🌐 Browser Testing

This project is tested withBrowserStack, enabling cross-browser and mobile testing on real devices in the cloud.

⚙️ Setup Instructions

Clone the project

git clone https://github.com/nirtal85/Playwright-Python-Examplecd playwright-python

Create and activate a virtual environment then Install project dependencies

PowerShell installation in windows:

python -m uv venv.venv\Scripts\Activate.ps1python -m ensurepip --upgradepython -m pip install uvuv sync --all-extras --dev

For Mac:

python3 -m pip install uvuv venvsource .venv/bin/activateuv sync --all-extras --dev

Install playwright

playwright install

🏃‍♂️ Running Tests

pytest

When no browser was selected then chrome will be used.

  • Run according to tags:
pytest -m<tag_name>

📊 Viewing Test Results

Install Allure Commandline To View Test results

For Windows:

Follow the instructionshere to install Scoop.
Run the following command to install Allure using Scoop:

scoop install allure

For Mac:

brew install allure

View Results Locally:

allure serve allure-results

View Results Online:

View allure results via Github pages

View trace results:

  1. Navigate to thePlaywright Trace Viewer
  2. Locate the trace file stored under the test-results folder. This file is generated after running your tests. Click on the 'Upload' button in the Playwright Trace Viewer and select your trace file.
  3. After uploading, the trace viewer will display a detailed timeline of events that occurred during your test. This includes network requests, JavaScript execution, and browser interactions. You can click on individual events for more details.

ℹ️ View Help And Other CLI Options

pytest --help

Pre Commit

Run Pre Commit Checks Automatically

pre-commit installpre-commit install --hook-type commit-msg

Bump Pre Commit Hooks Version

pre-commit autoupdate

Run Pre Commit Checks Manually On The Entire Project

pre-commit run --all-files

☕ Support

If you find this project helpful, you can support my work by buying me a coffee:

Buy Me A Coffee



About

Playwright Python example project with pytest and Allure report

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

    Packages

    No packages published

    Contributors4

    •  
    •  
    •  
    •  

    Languages


    [8]ページ先頭

    ©2009-2025 Movatter.jp