How nikeshdevkota/cross-browser-testing-pytest works
Project type and purpose
• This is a Selenium-based cross-browser test automation framework written in Python, using Pytest and the Page Object Model (POM).
• Its sole purpose is to automate end-to-end user flows (login, add to cart, checkout) against the Swag Labs demo site and generate HTML reports.
File structure
• Top-level files:
• conftest.py – defines shared fixtures (e.g. WebDriver setup, .env loader)
• requirements.txt – Python dependencies (selenium, pytest, pytest-xdist, pytest-html, python-dotenv)
• test_buy_items_and_checkout.py – a Pytest test case leveraging page objects
• Directories:
• pages/ – Page Object classes (login_page.py, inventory_page.py, cart_page.py, checkout_page.py)
• locators/ – Centralized locator definitions for each page (login_locators.py, etc.)
README for additional insights
• Requires a .env file to supply credentials and environment settings via python-dotenv in conftest.py.
• Tests run in parallel using pytest-xdist (-n auto) and produce a self-contained HTML report via pytest-html.