← Back to Discord Forum

projects in configuration - Use by demand

jan.ostgrenposted in #help-playwright
Open in Discord

Hi I want define projects , but as default no run them. Only run when I specify the projects on command line, Is this possible?

This thread is trying to answer question "Is it possible to define projects that do not run by default, but only run when specified on the command line?"

5 replies

@jan.ostgren Please review https://playwright.dev/docs/test-cli


you can sent --project cli option to run specific project

Nice if you could run without project in cli with some option.

So you want to run cli command but not run tests?

@skorp32: No an option to run without project as in Visual Code.

No an option to run without project as in Visual Code.


Sure, you can define projects that won't run by default in @playwright/test. These projects only run when you specify them on the command line.

Configuring Projects

Projects are configured in the playwright.config.ts file. Each project has a unique name and specific configuration options.

// playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test';

const config: PlaywrightTestConfig = {
  projects: [
      name: 'staging',
      // other configuration options...
      name: 'production',
      // other configuration options...

export default config;

Running Specific Projects

To run a specific project, use the --project command line option followed by the project name.

npx playwright test --project=staging

This command will only run the tests associated with the "staging" project.

Why Use Projects?

Projects give you control over which tests to run and under what conditions. You can define multiple projects with different configurations such as different timeouts, retries, or even against different environments like staging and production.

Remember, @playwright/test runs all projects by default. But with the --project command line option, you can choose which project(s) to run.

For more tips on efficient test scripting with Playwright, check out this blog post.

Related Discord Threads

AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email luc@ray.run.