Spec files are where your tests live. Naming conventions, folder layout, and file organization determine whether a Playwright suite stays maintainable as it grows from ten tests to ten thousand.
Spec File Conventions
By default Playwright looks for *.spec.ts (or .spec.js) under tests/. You can change testDir and testMatch in config to fit monorepos or feature-based folders.
Name files after features or user journeys: login.spec.ts, checkout.spec.ts. Avoid generic names like test1.spec.ts that do not signal intent in CI logs.
Use a setup project that runs auth.setup.ts once, saves storageState, and declare dependencies: ['setup'] on test projects so login runs once per worker, not per test.
Common Mistakes
One mega spec file with dozens of unrelated tests.
Not excluding setup/helper files from testMatch.
Duplicating login flows in every spec instead of setup projects.
File names that do not appear in --list output meaningfully.
Key Takeaways
Use *.spec.ts under a clear folder hierarchy.
Configure testDir, testMatch, and testIgnore for your repo layout.
Tags in titles enable smoke vs full regression CI jobs.