Playwright Fixtures Explained: Built-in Fixtures (page, request & more)
Ever wondered what `{ page }` or `{ request }` actually are in your Playwright tests? π€ And why don't we ever have to write code to open a browser, create a page, or close it at the end of a test? In this video, we break down Playwright Fixtures! We explain how Playwright uses fixtures as "ready-made helpers" to automate the setup and teardown of your tests. We also do a side-by-side comparison of writing a test WITH fixtures versus writing one WITHOUT fixtures (where you have to manually launch Chromium and manage contexts). π‘ What you will learn in this video: β’ What a fixture actually is (and why they are called "fixtures") β’ Code Walkthrough: Playwright tests WITH vs. WITHOUT fixtures β’ Why fixtures beat beforeEach & afterEach hooks for test isolation β’ The "Toolbox" analogy: How to pull only the tools you need β’ How to use multiple fixtures in a single test β’ Preview of Custom Fixtures (using test.extend & test.use) for the next video! π οΈ The 5 Built-in Playwright Fixtures Covered: β’ page β Represents a browser tab (for UI testing) β’ browser β Represents the entire browser instance β’ context β Represents a browser session (cookies, storage, etc.) β’ request β Used for making API calls (for API testing) β’ browserName β Tells you which browser is running (Chromium, Firefox, WebKit) If you want to write cleaner, more maintainable test automation scripts, understanding fixtures is key. Timestamps: 00:00 What are those arguments in our test functions? 01:02 What is a Fixture? (The automatic helper) 01:38 Why don't we write page.open() or page.close()? 02:34 Test Isolation: How fixtures keep tests independent 02:52 The 5 Built-in Fixtures explained 04:51 Writing a Playwright test WITHOUT fixtures (The manual way) 06:18 Why not just use beforeEach & afterEach hooks? 07:45 The Toolbox Analogy: Destructuring your fixtures 08:33 Examples of using browser, context, and browserName fixtures 09:50 The request fixture for API Testing 10:22 Using multiple fixtures in a single test 11:45 What's next? Sneak peek at Custom Fixtures If you found this tutorial helpful, please give it a like and subscribe for more Playwright content! #Playwright #TestAutomation #SoftwareTesting #PlaywrightTutorial #QAAutomation #WebTesting #BuiltInFixtures
More like this

Agentic AI Test Automation Framework Tutorial | Selenium, Playwright & QA Copilot

Playwright Test Automation Jobs Are Booming | RD Automation Learning

2748 Playwright Jobs in India | Playwright & Modern Testing | RD Automation Learning

Playwright with Python & Pytest | Reporting | How To Generate PyTest & Allure Reports (Session 16)
Join the discussion
Sign in to join the discussion
Sign in