How to test and monitor your APIs with Playwright

How to test and monitor your APIs with Playwright

Apr 17, 2024

In today's video, we explore a lesser-known feature of Microsoft's Playwright - API Testing.

We'll illustrate how to use Playwright for testing GraphQL as an example of an HTTP-based API; RESTful APIs can be tested too. We'll explain the usage of the 'request' fixture with Playwright, parse responses and validate their correctness.

Moreover, we'll delve into executing multiple API requests in a single Playwright test case while testing their responses.

A bonus tip we'll share is how to reuse your Playwright code with Checkly's new multistep checks for efficient production monitoring.

Questions? Feel free to drop them below. See you in the next video!

Playwright API testing docs:
Checkly Multistep Check docs:

00:00 Intro

00:19 GraphQL example API

01:35 The API testing test case

02:26 Making requests with the `request` fixture

03:17 Access the response body

03:43 Configuring Playwright projects

04:17 Adding assertions to your API tests

05:39 Making multiple requests in a single test case

06:06 Filter countries via GraphQL

08:23 Playwright API monitoring

09:29 Outro

#playwright #monitoring #apitesting #syntheticmonitoring #checkly