Playwright Folder Structure
Overview of Playwright Folder Structure:

Root Folder: PRACTICE (This is projectβs workspace.)
π node_modules/
- Contains all the installed npm packages for your project.
- Important subfolders:
- .bin/ β executables for npm scripts.
- @playwright/ β Playwright-related libraries.
- playwright/ & playwright-core/ β The actual Playwright framework and core dependencies.
- @types/ β TypeScript type definitions.
- undici-types/ β Networking types used internally.
π playwright-report/
- Stores the HTML test reports generated after running Playwright tests.
- Example:
- index.html β The main report file (open this in a browser to view test run details).
π test-results/
- Stores test execution results such as:
- Trace files
- Screenshots
- Videos
- Debugging artifacts
π tests/
- Your test folder where Playwright looks for .spec.ts or .spec.js files.
- Example:
- example.spec.ts β A sample test created during Playwright project initialization.
π tests-examples/
- Additional example tests provided by Playwright when setting up the project.
- Example:
- demo-todo-app.spec.ts β A demo test showing how to automate a simple Todo app.
π .gitignore
- Lists files/folders to ignore in Git (e.g., node_modules, test results, reports).
π package.json
- Defines your Node.js project metadata and dependencies.
- Includes Playwright packages and test scripts (like npx playwright test).
π package-lock.json
- Auto-generated file that locks exact versions of dependencies.
- Ensures consistent installs across environments.
π playwright.config.ts
- The Playwright configuration file.
- Defines test settings such as:
- Browsers to run (chromium, firefox, webkit)
- Test directory (tests/)
- Timeouts, retries, workers
- Reporters (HTML, list, JSON, etc.)
β Summary:
- tests/ & tests-examples/ β Your test cases.
- playwright.config.ts β Configurations for test runs.
- playwright-report/ & test-results/ β Outputs (reports, traces, screenshots).
- node_modules/ β Dependencies.
- package.json β Project info & dependencies list.