From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios
Unlock this course with a free trial
Join today to access over 24,900 courses taught by industry experts.
Overview of Playwright fixtures - Microsoft Playwright Tutorial
From the course: Playwright Essential Training: Abstractions, Fixtures, and Complex Scenarios
Overview of Playwright fixtures
- [Instructor] The first time I saw a fixture in Playwright, I thought, wait, how does this even work? Fixtures are a lot like black magic. At their core, test Fixtures are used to establish the environment for each test, giving the test everything it needs and nothing else. Fixtures are a lot like the previous abstractions we've discussed, data factories and helper functions. But fixtures are first-class citizens, which gives you even lower level hooks into the Playwright test code base. Actually, all the Playwright test is built on the concept of test fixtures. Some of these examples include page, context, browser, and request, some of which we've used. The magic happens behind the scenes. When you request a fixture in your test, Playwrights Test Runner automatically initializes it, injects it where needed, and tears it down when it's done. The real power of fixtures comes from their flexibility. You can even override built-in fixtures or create your own custom ones. Fixtures have a…
Contents
-
-
-
- (Locked) Overview of Playwright fixtures3m 9s
- (Locked) Creating a fixture in Playwright3m 41s
- (Locked) Using a fixture in Playwright tests3m 56s
- (Locked) Overview of advanced fixtures in Playwright3m 16s
- (Locked) Implementing an advanced fixture in Playwright9m 44s
- (Locked) Challenge: Update message test to use fixtures37s
- (Locked) Solution: Update message test to use fixtures2m 12s
- (Locked)
-
-
-
-