Playwright Tips and Tricks

Image of Author
Invalid Date (last updated October 18, 2022)

Running one project locally, and all projects on CI

Projects are a good way to support different browsers and screen widths. But, by default, every project is ran when the full test suite is ran. For fast feedback loops, you will perhaps want to only run one project, like just the chromium browser or chromium mobile suite.

You can use a CLI flag to isolate one project. You can add that flag to your local dev environment keyboard shortcuts.

For example, say you have a chromium browser project,

const config = {
  projects: [
      name: "chromium",
      use: {
        ...devices["Desktop Chrome"],

You can run just that project like this,

npx playwright test --project=chromium

You can add it to your local dev env keybindings as well. For example, I have a .vscode/tasks.json file that uses the flag, and keybindings that execute that task. This means I can have fast feedback loops on local, and a much more thorough test suite running on CI.

Lastly, you can still run npx playwright test manually on local to run all your tests.