112 / 139 · 13 Browser Automation with Playwright · Production Framework← prev⊞ allnext →☰ Read as one page
13.2Project Structure at Scale
e2e/
├── playwright.config.ts # Main configuration
├── global-setup.ts # One-time setup (DB seed, auth)
├── global-teardown.ts # One-time cleanup
├── fixtures/
│ ├── index.ts # Re-exports all custom fixtures
│ ├── auth.fixture.ts # Authentication fixtures
│ └── data.fixture.ts # Test data fixtures
├── pages/
│ ├── base.page.ts # Base page object with shared methods
│ ├── login.page.ts
│ ├── dashboard.page.ts
│ └── components/
│ ├── header.component.ts
│ └── modal.component.ts
├── tests/
│ ├── auth/
│ │ ├── login.spec.ts
│ │ └── registration.spec.ts
│ ├── checkout/
│ │ ├── cart.spec.ts
│ │ └── payment.spec.ts
│ └── admin/
│ └── user-management.spec.ts
├── test-data/
│ ├── users.json
│ └── products.json
└── utils/
├── api-client.ts # API helper for setup/teardown
└── test-helpers.ts # Shared utility functions
Key Conventions
- One spec file per feature area, not per page — tests are organized by what they verify
- Page objects in
pages/, fixtures infixtures/— clear separation - Shared test data in
test-data/— not hardcoded in tests - Utilities in
utils/— API clients, date helpers, generators