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!

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Aya Akl
Aya Akl

Written by Aya Akl

Author @QualityNexus || #Quality is my thing - Passionate human being who wants to change the world!!

No responses yet

Write a response