This project is for writing and running automated tests using Pytest & Playwright (TBD)
- Install Python (version 3.12 or later)
- 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
- Run the test:
pytest -s -v tests/path_to_file_or_directory
- Add the following to the command to generate a report (json files):
--alluredir=allure-results
- Check in the interpreter settings that the
.venv
virtual environment of the project is selected - Run tests using the "run" button or play icon, depending on your IDE
- Access the GitHub Actions page
- Click the Run workflow button on the relevant workflow
- Click Run workflow again
- Install Allure Report
- Generate a report based on the latest test run:
allure generate allure-results --clean -o allure-report
- Open the report in a browser:
allure open allure-report
Code Linting and Formatting with ruff
- Run the linter to check code for errors:
ruff check path_to_file_or_folder
(with autofix: add--fix
, for the entire project: add.
at the end) - Run the formatter to standardize code style:
ruff format path_to_file_or_folder
(with autofix: add--fix
, for the entire project: add.
)
Tip:
At each level of the tests
folder, you can have a conftest.py
with fixtures or hooks specific to that level of tests.