This framework uses Playwright with Pytest for end-to-end testing and Allure for advanced reporting.
Before running tests, ensure you have the following installed:
- Python 3.8+
- pytest
- pytest-playwright
- allure-pytest
- Allure command-line (for report generation)
- Playwright browsers (install via:
playwright install)
Create Virtual Environment python -m venv .venv Activate Virtual Environment Windows: .venv\Scripts\activate Install Dependencies pip install -r requirements.txt Install Playwright Browsers playwright install
You can run tests with different browsers and modes (headed/headless) using command-line options.
pytest -s -v Testcases/test_base.py --mybrowser=firefox --alluredir=reports/allure-results
pytest -s -v Testcases/test_base.py --mybrowser=chromium --headless --alluredir=reports/allure-results
pytest -s -v Testcases/test_login.py --mybrowser=chromium --headless --alluredir=reports/allure-results --tracing on
pytest -n 3 -s -v Testcases/test_base.py --mybrowser=chromium --headless --alluredir=reports/allure-results
pytest -n auto -s -v --mybrowser=chromium --headless --alluredir=reports/allure-results --tracing on
pytest -s -v -n auto --mybrowser=chromium --headless --html=report.html --tracing on
playwright show-trace trace/trace.zip playwright show-trace traces/test_search_iphone.zip
Generate and Open Allure Report allure serve reports/allure-results
##🔧 Configuration Browser Options
ini[pytest] addopts = -v -s --alluredir=reports/allure-results testpaths = Testcases
playwright_framework/
│
├── .venv/
├── base/
│ ├── __init__.py
│ ├── base_page.py
│ └── playwright_factory.py
├── logs/
│ └── test_log.log
├── page_objects/
│ └── __init__.py
├── reports/
│ ├── allure-results/
│ └── allure-report/
├── screenshots/
├── tests/
│ ├── __init__.py
│ ├── test_base.py
│ └── test_search_thar.py
├── utilities/
│ ├── __init__.py
│ ├── logger.py
│ └── screenshot.py
│
├── conftest.py
├── pytest.ini
├── README.md
└── requirements.txt