Automate your web testing using Playwright and Python. This project provides end-to-end testing capabilities with pytest and Playwright for modern web applications.
- β Fast & Reliable Browser Automation with Playwright
- β Headless Mode for running tests in the background
- β Cross-Browser Support (Chromium, Firefox, WebKit)
- β
Easy Configuration using
pytest
- β Parallel Test Execution
- β Allure Reports for Test Insights
Make sure you have the following installed:
- Python 3.7+
- Node.js (for Playwright CLI)
poetry
package manager
Clone the repository and install dependencies:
# Clone the repository
git clone https://github.com/hbkandhi12/playwright-python-tests.git
cd playwright-python-tests
# Install dependencies using Poetry
poetry install
# Install Playwright browsers
poetry run playwright install
Run Playwright tests using pytest
:
poetry run pytest --headed # Runs tests with a visible browser
poetry run pytest --headless # Runs tests in headless mode (faster)
Run tests in parallel:
poetry run pytest -n auto # Runs tests in parallel using multiple CPU cores
Generate an Allure Report:
poetry run pytest --alluredir=allure-results
poetry run allure generate allure-results -o allure-report --clean
You can view the latest test results in the [Allure Test Report]
## Build Status

## Allure Test Report
You can view the latest test results in the [Allure Test Report](https://hbkandhi12.github.io/playwright-python-tests).
playwright-python-tests/
βββ tests/
β βββ test_login.py # Login page test cases
β βββ test_checkout.py # Checkout workflow tests
β
βββ pages/
β βββ login_page.py # Page Object Model for login page
β βββ inventory_page.py # Page Object Model for inventory
β
βββ conftest.py # Pytest fixtures
βββ pyproject.toml # Poetry configuration file
βββ README.md # Project documentation
To automatically generate and deploy Allure Reports on GitHub Pages, add the following GitHub Actions workflow:
Create .github/workflows/allure-report.yml
and add:
name: Playwright Tests & Allure Report
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Poetry
run: pip install poetry
- name: Install dependencies
run: poetry install
- name: Install Playwright browsers
run: poetry run playwright install
- name: Run tests and generate Allure results
run: poetry run pytest --alluredir=allure-results
- name: Generate Allure Report
run: |
poetry run allure generate allure-results -o allure-report --clean
- name: Deploy Allure Report to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./allure-report
Make sure GitHub Pages is enabled in your repo settings under Settings > Pages and set it to deploy from gh-pages
branch.
Want to improve this project? Contributions are welcome! π
- Fork the repository
- Create a new branch (
feature-branch
) - Commit your changes (
git commit -m 'Add new feature'
) - Push to the branch (
git push origin feature-branch
) - Open a Pull Request
Have a question or feature request? Create an issue or start a GitHub discussion!
- π Issues: Submit here
- π¬ Discussions: Join here
This project is licensed under the MIT License.