This project is for writing and running automated tests using Pytest & Playwright (TBD)
- Install Python (version 3.13+)
- Install PDM for dependency management
- Create and activate a virtual environment:
python3 -m venv .venv && source .venv/bin/activate
- Install project dependencies:
pdm lock && pdm sync
- Set up pre-commit hooks (auto-code check before commit):
pre-commit install -f
- Create a
.env
file to store and retrieve environment variables:touch .env
- Basic Run:
pytest -sv tests/path_to_file_or_directory
- Run with Browser UI / Headed:
pytest -sv --headed tests/path_to_file_or_directory
- Run with Slow Interactions / Debug:
pytest -sv --headed --slowmo 500 tests/path_to_file_or_directory
- Generate Allure Reports:
pytest -sv --alluredir=allure-results tests/path_to_file_or_directory
- Go to GitHub Actions page
- Find the desired workflow (e.g., UI Tests)
- Click the Run workflow button
- Select the branch you want to run
- Click Run workflow again to trigger the execution
- Install Allure Report
- Generate a report based on the latest test run:
allure generate allure-results --clean -o allure-report
- Open the report locally:
allure open allure-report
Code Linting and Formatting with ruff
- Check Code Quality:
ruff check path_to_file_or_folder
- Autofix Errors:
ruff check path_to_file_or_folder --fix
- Format Code:
ruff format path_to_file_or_folder --fix
Tips:
- Usage of
conftest.py
: At each level of the tests folder, you can place aconftest.py
with fixtures or hooks specific to that level of testing - Simulating Debug Runs:
Use
--headed
and--slowmo
options to visually debug tests with browser UI and control interaction speeds