How akhil-jha/console-playwrite-test works
Project type and purpose
• This is an automated test framework built in Python, using pytest, Playwright and Dynaconf.
• Its goal is to define, configure, and execute end‐to‐end browser tests against a target application (specified via DYNACONF_BASE_URL).
File structure
• Top‐level:
• .github/workflows/actions.yaml – CI workflow definition (GitHub Actions)
• conf/settings.yaml – Dynaconf configuration template
• conftest.py – pytest fixtures and hooks
• fixtures/ – customized test fixtures (e.g., login flow)
• playwright/ – module for page objects or helper routines wrapping Playwright APIs
• tests/ – actual pytest test cases
• pyproject.toml – project metadata and dependencies
• Patterns & tools:
• pytest for test discovery & execution
• Playwright as browser automation engine
• Dynaconf for environment‐driven configuration
• GitHub Actions for CI
Key insights from README
• Tests are invoked via pytest -sv --headed (or headless)
• External dependencies (browser binaries) must be installed via playwright install
• Environment variables drive URL, credentials
Main components
a. Developer workstation (local dev)
b. Version control (GitHub repository)
c. CI/CD pipeline (GitHub Actions runner)
d. Configuration management (Dynaconf, .env, conf/settings.yaml)
e. Test framework layers:
• pytest core (test runner & reporting)
• conftest.py & fixtures (dependency injection)
• playwright module (page objects / helpers)
f. Playwright engine (chromium/firefox/webkit)
g. System under test (SUT) – the web application at DYNACONF_BASE_URL
h. Test artifacts (reports, logs)
Relationships & interactions
• Developer → commits → GitHub
• GitHub Actions → checks out code → installs dependencies → loads Dynaconf settings → invokes pytest
• pytest uses conftest.py & fixtures to bootstrap Playwright browser sessions
• Playwright engine launches browser → navigates to SUT base URL → executes steps defined in playwright/ and tests/
• Test results → pytest reporter → persisted as CI artifacts or logs
Architectural patterns & design principles
• Layered test‐automation architecture:
1. Configuration layer (Dynaconf)
2. Fixture layer (pytest fixtures for reusable setup/teardown)
3. Page‐object layer (playwright/ module abstracts page interactions)
4. Test case layer (tests/ defines scenarios)
• CI integration: “test as code” in GitHub Actions
• Separation of concerns: config, fixtures, page objects, tests
Minimum elements
• Labels for each component (e.g., “pytest runner,” “Playwright engine,” “Dynaconf settings”)
• Annotation of CI workflow step names (install, test, report)
Putting it all together
• Sketch a left‐to‐right flow: Developer → GitHub → GitHub Actions → Dependency install → Test runner (pytest) → Fixture layer → Page‐object layer → Browser (Playwright) → SUT → Test report
• Code artifacts (conftest.py, fixtures, playwright/, tests/) under “Test suite” container
• External “.env file” feeding into “Dynaconf” and external “Target web app” receiving browser requests