Frontend/Web Test Automation: Using Playwright Fixtures for API Handling

Aya Akl
Aug 12, 2024

--

This is Part two of another blog post that I talked about how awesome using Fixtures provided by Playwright!

This was Part 1: Frontend/Web Test Automation: Enhance POM using Playwright Fixtures

Photo by Yucel Moran on Unsplash

If building your test framework in a customizable way that you either want to interact with the real API network or you wanna mock that API network call, Playwright gives you a way of course to do both and here I will be talking how to customize that in a Fixture and use it in your tests.

1- Define MockAPI

2- Define RealAPI

3- Define the APIFixture

4- Usage in Tests

We can then use the merge option I mentioned in Part 1 first then use the APIFixtures as follows

That’s it for now, more to follow! :)

HAPPY TESTING!

--

--

Aya Akl

#Quality is my thing - Passionate human being who wants to change the world!! #MobileTester #SDET #iOS #Testing