DEV Community

Cover image for Tagging your Playwright Tests

Tagging your Playwright Tests

Debbie O'Brien on March 14, 2024

Tags are used to filter tests in the HTML report, UI Mode, or VSCode extension. It's also possible to filter them with the CLI by using --grep - so...
Collapse
 
uncleaaroh profile image
UncleAaroh.eth

Wow, thanks for sharing this Debbie. I found out about this from the Happy Hour today. You guys are doing an amazing work. Keep it up !

PS. I really prefer this new format of tagging, the previous one was an oddball.

Collapse
 
henrieke_leis_79d135dd4 profile image
Henrieke Leisen

This is a great feature. It would be awesome if it could be used in the playwight.config aswell.

projects: [
 {
      name: "speed",
      dependencies: ["login"],
      grep: /@speed/,
      use: {
        baseURL: baseURL,
        storageState: STORAGE_STATE_ADMIN,
      },
    },
...
]
Enter fullscreen mode Exit fullscreen mode
Collapse
 
brianpalma profile image
Brian Palma

You must enclose the tag in quotation marks for it to work:

npx playwright test --grep "@login"