Tag test in Playwright, Tags in playwright tests, Tagging in Playwright
Welcome to another video in the Playwright with TypeScript series! In this video, we delve into the concept of tags in Playwright, exploring their application, functionality, and best practices. Here are the key points covered:
Introduction to Tags: Tags are labels or identifiers attached to specific tests. They serve two primary use cases:
Adding Tags to Tests:
@
symbol before the tag name. For instance, @UI
or @API
. This method incorporates tags visually in the test titles and allows you to categorize tests based on their functionality, like UI tests or API tests.Practical Example:
Executing Tests and Viewing Reports:
npx playwright test
command.npx playwright show-report
command, which displays tags and allows filtering tests based on them.Advanced Tagging Options:
Command-Line Tag Filtering:
npx playwright test --grep=@TAG
is used to run tests that have certain tags.npx playwright test --grep-invert=@TAG
, which skips tests with the specified tag.Configuration File:
playwright.config.ts
) to define default behavior for including or excluding tagged tests during execution.The video concludes with a quick recap of the discussed topics, emphasizing the benefits of using tags for organizing and executing tests more effectively. Viewers are encouraged to explore the full Playwright tutorial playlist and stay tuned for upcoming videos.
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 [email protected].