How amirya412/pytest-playwright-automation works
This is a pytest/Playwright UI automation framework for SauceDemo. The principal workflow is a test run selecting an environment and browser, resolving page objects, then exercising login or inventory behavior against the site. Supporting layers provide environment-specific credentials, reusable UI components, cookie-based authentication, logging, and failure diagnostics. The README also describes screenshots, video, and HTML reports; source excerpts show trace-summary support and its pytest integration, but not the full artifact-generation path. Test modules and some fixture details were not sampled, so those links are limited to documented behavior.
Main entry points: pages.py Page factory · conftest.py Pytest fixtures · environment.py Environment config · inventory_page.py Inventory page
Components 17
Test execution
- Login tests
tests/test_login.py - Inventory tests
tests/test_inventory.py - Pytest fixtures
conftest.py - Page factory
factories/pages.py
Page interaction
- Login page
pages/login_page.py - Inventory page
pages/inventory_page.py - Base page
pages/base_page.py - Header component
components/header.py - Sidebar menu
components/sidebar_menu.py
Environment and auth
- Environment config
support/environment.py - User credentials
users/users.py - Cookie auth
utilities/auth_helper.py
Logs and reports
- Logger
logger.py - Trace summary
support/trace_report.py - Test artifacts
reports
Other components
- pytest runner
- SauceDemo
Connections 22
- pytest runner → Pytest fixtures: starts tests
README.md - Pytest fixtures → Page factory: creates pages
conftest.py - Pytest fixtures → Environment config: configures
conftest.py - Pytest fixtures → Logger: imports
conftest.py - Pytest fixtures → Trace summary: uses
conftest.py - Page factory → Cookie auth: creates
factories/pages.py - Page factory → Login page: creates
factories/pages.py - Page factory → Inventory page: creates
factories/pages.py - Page factory → Environment config: uses
factories/pages.py - Login page → Base page: extends
pages/login_page.py - Inventory page → Base page: extends
pages/inventory_page.py - Inventory page → Header component: creates
pages/inventory_page.py - Inventory page → Sidebar menu: creates
pages/inventory_page.py - Base page → Environment config: uses URL
pages/base_page.py - Environment config → User credentials: loads credentials
support/environment.py - Cookie auth → Environment config: reads settings
utilities/auth_helper.py - Login tests → Page factory: uses pages
- Inventory tests → Page factory: uses pages
- Login tests → SauceDemo: tests UI
- Inventory tests → SauceDemo: tests UI
- Trace summary → Test artifacts: summarizes traces
- pytest runner → Test artifacts: generates reports
README.md