Rayrun
← Back to videos

Test Group & Hooks | Playwright Tutorial - Part 25

Hello Guys, In this video, we'll discuss the test runner group and hooks.

In this video, the presenter explores two topics: test group and test hooks in Playwright test runner. The video begins with an introduction to test group, which allows users to group tests together and apply before and after hooks to the group. The presenter emphasizes the importance of reading documentation and understanding how to use test groups to avoid future problems.

Next, the presenter demonstrates how to create test groups in Playwright test runner. They show an example of grouping tests and using the before all hook to load a URL only once instead of loading it for each test. By using the before all hook, the presenter ensures that tests within the group run in the same browser context, saving time and resources.

The presenter also mentions that they have two test files, "first.test.ts" and "tc00.test.ts", and shows how to specify the test file to run using the "test match" configuration in the Playwright config file.

Finally, the presenter runs the test and shows that the tests within the group execute successfully. They also briefly mention other hooks like "before each" and demonstrate how it can be used in a similar way to the "before all" hook.

Overall, this video provides a detailed explanation of test group and test hooks in Playwright test runner, showcasing how these features can improve test efficiency and organization.

Related Videos

Playwright Tutorial: Output Console logs as step traces to UI watch Mode & Traceviewer
Playwright Tutorial: Output Console logs as step traces to UI watch Mode & Traceviewer
Playwright - Set timeout, parallelisation and retries directly in your test files
Playwright - Set timeout, parallelisation and retries directly in your test files
Migrate from Jest to Playwright Test Runner | Playwright Tutorial - part 77
Migrate from Jest to Playwright Test Runner | Playwright Tutorial - part 77
Playwright Base URL | Playwright Tutorial - Part 39
Playwright Base URL | Playwright Tutorial - Part 39
TwitterGitHubLinkedIn
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.