This project contains automated tests for the DemoQA website (https://demoqa.com) using Python, Playwright, and pytest.
├── lib/
│ ├── pages/ # Page Object Models
│ ├── helpers/ # Helper functions and utilities
│ ├── models/ # Pydantic models for API payloads
│ └── constants/ # Constants and configuration
├── tests/
│ ├── ui/ # UI test cases
│ └── api/ # API test cases
├── conftest.py # Global pytest fixtures
├── requirements.txt # Project dependencies
└── .env # Environment variables
- Python 3.8 or higher
- pip (Python package manager)
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Install Playwright browsers:
playwright install
- Create a
.env
file in the project root and add necessary environment variables:
BASE_URL=https://demoqa.com
API_BASE_URL=https://demoqa.com/api
pytest
pytest tests/ui/
pytest tests/api/
pytest --html=report.html
After test execution, you can find the HTML report in the project root directory as report.html
.
- Create a new branch for your feature
- Write tests for new functionality
- Ensure all tests pass
- Submit a pull request
- Follow the Page Object Model pattern for UI tests
- Use Pydantic models for API request/response validation
- Keep test data separate from test logic
- Use meaningful test names and descriptions
- Add appropriate assertions and error handling