playwright.config.ts.
Overview
Playwright provides many ways to select tests, and Stably supports them all. We recommend using Playwright projects since they let you customize configuration for a logical group of tests.You can also use projects to run the same tests in different configurations. For example, you can run the same tests in a logged-in and logged-out state.
Defining Projects
Projects are defined in yourplaywright.config.ts file. Each project represents a logical group of tests with its own configuration.
playwright.config.ts
Project Configuration Options
Each project can have its own configuration settings:Test Selection
Test Selection
testMatch: Pattern to match test filestestIgnore: Pattern to exclude test files
Browser Configuration
Browser Configuration
use: Browser-specific settings
Dependencies
Dependencies
dependencies: Run other projects before this one
Common Project Patterns
- By Test Type
- By Feature Area
- By Environment State
- By Platform
Organize tests by their purpose:
Running Specific Projects
Once you’ve defined your projects, you can run them selectively:Locally
On Stably Cloud
Advanced Project Setup
Setup and Teardown Projects
Setup and Teardown Projects
Use special projects for setup and teardown:
Conditional Project Execution
Conditional Project Execution
Use environment variables to conditionally run projects:
Tagging with Grep
Tagging with Grep
Combine projects with grep patterns for fine-grained control:Then run:
Best Practices
Keep Projects Focused
Each project should have a clear purpose and contain related tests. Avoid catch-all projects.
Use Descriptive Names
Name projects after their purpose (
smoke, critical) rather than technical details.Balance Granularity
Too many projects add complexity. Too few limit flexibility. Find the right balance for your team.
Document Your Structure
Add comments in your config explaining the purpose of each project and when to use it.
Next Steps
Running Test Groups
Learn how to run your test groups locally, in the cloud, or in CI/CD pipelines