Restructure the Playwright automation framework to achieve a clean, multi-app supportive architecture as proposed.
project-root
├ src
│ ├ core
│ │ ├ BasePage.ts
│ │ ├ fixtures
│ │ │ └ auth.fixture.ts
│ │ └ utils
│ │ ├ waitUtils.ts
│ │ └ randomUtils.ts
│ ├ config
│ │ ├ env.config.ts
│ │ ├ saucedemo.config.ts
│ │ └ cura.config.ts
│ └ apps
│ ├ saucedemo
│ │ ├ pages
│ │ │ ├ LoginPage.ts
│ │ │ ├ InventoryPage.ts
│ │ │ └ CartPage.ts
│ │ └ test-data
│ │ └ users.ts
│ └ cura
│ ├ pages
│ │ ├ LoginPage.ts
│ │ ├ AppointmentPage.ts
│ │ └ ConfirmationPage.ts
│ └ test-data
│ └ users.ts
├ tests
│ ├ saucedemo
│ │ ├ smoke/
│ │ └ regression/
│ └ cura
│ ├ smoke/
│ └ regression/
├ test-results/
├ docker/
└ playwright.config.ts
- Location:
src/config/ - Files Created:
env.config.ts- Environment configuration managementsaucedemo.config.ts- SauceDemo app-specific configurationcura.config.ts- CURA app-specific configurationapp.config.ts- Already existed
- Old Location:
src/core/fixture.ts(empty) andsrc/fixture/ - Canonical Location:
src/core/fixtures/auth.fixture.ts - Status: Fixture moved, duplicate legacy path removed, and docs consolidated under
src/core/fixtures/ - Updated Imports: Tests now use the canonical core fixture path
- Location:
src/core/utils/ - Files Created:
waitUtils.ts- Wait strategies (network idle, element stability, etc.)randomUtils.ts- Random data generation (email, phones, dates, etc.)
-
SauceDemo App:
src/apps/saucedemo/- Pages: LoginPage.ts, InventoryPage.ts, CartPage.ts
- Test Data: users.ts with standard_user and locked_out_user
-
CURA App:
src/apps/cura/- Pages: LoginPage.ts, AppointmentPage.ts, ConfirmationPage.ts
- Test Data: users.ts with John Doe credentials
-
SauceDemo Tests:
tests/saucedemo/smoke/andtests/saucedemo/regression/- login.spec.ts
- add-to-cart.spec.ts
-
CURA Tests:
tests/cura/smoke/andtests/cura/regression/- login.spec.ts
- book-appointment.spec.ts
test-results/andplaywright-report/- For reports, screenshots, traces, and artifactsdocker/- For Docker-related files
- Removed obsolete fixture files from
src/core/ - Removed the duplicate legacy fixture path now that tests use the canonical core fixture location
src/
├── apps/
│ ├── saucedemo/
│ │ ├── pages/
│ │ │ ├── LoginPage.ts
│ │ │ ├── InventoryPage.ts
│ │ │ └── CartPage.ts
│ │ └── test-data/
│ │ └── users.ts
│ └── cura/
│ ├── pages/
│ │ ├── LoginPage.ts
│ │ ├── AppointmentPage.ts
│ │ └── ConfirmationPage.ts
│ └── test-data/
│ └── users.ts
├── config/
│ ├── app.config.ts
│ ├── env.config.ts
│ ├── saucedemo.config.ts
│ └── cura.config.ts
├── core/
│ ├── BasePage.ts
│ ├── fixtures/
│ │ └── auth.fixture.ts
│ └── utils/
│ ├── waitUtils.ts
│ └── randomUtils.ts
├── interface/
├── pages/
└── utils/
tests/
├── saucedemo/
│ ├── smoke/
│ └── regression/
└── cura/
├── smoke/
└── regression/
test-results/
docker/
✅ npm run typecheck - PASSED
No TypeScript errors detected
✅ npm run test:saucedemo -- --grep "user can login successfully"
Running 3 tests using 3 workers
✅ 3 passed (9.9s)
The project structure has been successfully refactored to match the proposed multi-app supportive framework architecture. All configuration files are properly organized, fixtures have been consolidated, utilities are centralized in src/core/, and each application has its own dedicated folder structure with pages and test data.
The framework now supports:
- ✅ Multiple application testing (SauceDemo, CURA)
- ✅ Centralized configuration management
- ✅ Reusable core utilities
- ✅ Modular test organization (smoke/regression)
- ✅ Clean separation of concerns
- ✅ Full TypeScript compilation support