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