Playwright + JS · Lesson 9 of 35
Module 9: JavaScript Project Structure
Try it yourself
Implement isRecognizedFolder:
The editor has a worked example. Read it, tweak it, then press Mark as complete.
playwright-project/
├── playwright.config.js # Runner configuration and projects
├── package.json # Dependencies and npm scripts
│
├── tests/ # Test specifications (*.spec.js)
│ ├── auth/
│ │ └── login.spec.js
│ └── checkout/
│ └── checkout.spec.js
│
├── pages/ # Page Object Model classes
│ ├── BasePage.js
│ └── LoginPage.js
│
├── components/ # Reusable UI fragments (Navigation, Modals)
│ └── Header.js
│
├── fixtures/ # Custom test fixtures
│ └── testBase.js
│
├── utils/ # Reusable helper functions
│ └── stringHelpers.js
│
├── data/ # Test fixtures and static JSON
│ └── testUsers.json
│
└── config/ # Environment endpoints and timeouts
└── envConfig.jsBefore writing browser tests, professional QA engineers establish a clean folder hierarchy. In this module, we dissect the standard directory structure: tests, pages, components, fixtures, utils, data, and config. Let's inspect the blueprint!
Part of the Playwright + JS course (Playwright with JavaScript). Practice this concept live in the Playwright Online Compiler or explore our free automation practice form.
Components like headers and navigation bars appear across dozens of pages. Keeping them in components/ avoids duplicating locators in every Page Object.
Finished reading?
Review the worked example in the editor, then mark the lesson complete.