Manuals / Playwright with Python / Chapter 39
Part 6 · Pro-Level Practices · pro · ~60 min · Chapter 39 of 61
29. Building a Scalable Framework from Scratch
Folder architecture for enterprise-grade projects Past a certain size, a flat tests/ + pages/ structure (Chapter 14) stops being enough. An enterprise-grade layout separates concerns clearly so new contributors can navigate it without a guided tour: project/ ├── tests/ │ ├── smoke/ │ ├── regression/ │ └── modules/ │ ├── test_leave.py │ ├── test_attendance.py │ └── test_payroll.py ├── pages/ │ ├──
Step 1 of 6
Folder architecture for enterprise-grade projects
Past a certain size, a flat tests/ + pages/ structure (Chapter 14) stops being enough. An enterprise-grade layout separates concerns clearly so new contributors can navigate it without a guided tour: project/ ├── tests/ │ ├── smoke/ │ ├── regression/ │ └── modules/ │ ├── test_leave.py │ ├── test_attendance.py │ └── test_payroll.py ├── pages/ │ ├── base_page.py │ └── modules/ │ ├── leave_page.py │ └── attendance_page.py ├── utils/ │ ├── api_helpers.py │ ├── data_generators.py │ └── wait_helpers.py ├── config/ │ ├── environments.py │ └── settings.py ├── test_data/ │ └── users.json ├── conftest.py ├── pytest.ini └── requirements.txt Pointers: The organizing principle is "a new engineer should be able to guess where something lives before searching for it." Grouping page objects and tests by feature module (mirroring your actual application's modules — e.g., matching Bizlevate's Leave/Attendance/Payroll structure) rather than by arbitrary file order keeps the mapping between app and test suite obvious.
Chapter learning outcomes
- Folder architecture for enterprise-grade projects
- Utilities/helpers layer
- Utility function pattern (utils/*.py — convention, not a Playwright API)
- Config-driven test execution
- BASE_URL = {
Clear these before you leave
Side quest
29. Building a Scalable Framework from Scratch deliverable
Apply one idea from “Folder architecture for enterprise-grade projects” in a small script or note.