Talking about some of the key annotations you can use within playwright test framework
The video features Jared from Commit Quality who gives a detailed guide on playwright test annotations. Playwright, he explains, provides test annotations to manage aspects such as failures, flaky tests, skipping tests, focusing on tests and running tests in parallel among other features.
Jared states that annotations can be used on a single test or a group of tests, and you can have more than one annotation at a time. Furthermore, these annotations can be conditional. For instance, the skip annotation can be used to omit certain tests during execution, conditional on certain factors such as the type of browser being used.
The speaker introduces an 'only' function, where tests that have the 'only' annotation will exclusively run. This can be used on a single test or a group of tests. The video illustrates how this works, and directions on how to examine the output of the tests are given.
Jared then explains the 'fail' annotation, which unconditionally marks a test as being expected to fail, even if it passes. This can help to highlight issues and bugs that need to be addressed. He also presents the 'slow' annotation, which extends the default timeout of a test threefold, therefore allowing extra time for poorly performing tests.
Finally, he explains parallelization, whereby tests can be run in parallel to save time. This can be applied at a describe block level, forcing all tests within the block to run in parallel. He concludes by encouraging viewers to explore the Playwright documentation for more comprehensive knowledge and offers help in the comments section.
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].