How to test and monitor your APIs with Playwright
Вставка
- Опубліковано 23 лип 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: playwright.dev/docs/api-testing
Checkly Multistep Check docs: www.checklyhq.com/docs/multis...
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 - Наука та технологія
i love checkly
Hope more videos on GraphQL API testing using Playwright
Let's see what we can do. :) Do you have any specific topics in mind?
Graphql api automation using bdd
Thanks, that is interesting, i might use Playwright to test APIs as well since i'll be already using to e2e tests. Is it using a browser under the hood while API testing though? I hope not, as i don't see the need to have a browser context for that
I'm pretty sure `request` doesn't spin up a browser. :)
Hello, which tool do you use for auto complete ? Thank for everything
It's Github's Copilot. :)
Great content! Can you make video API Authentication to bypass UI login. Ty! Cheers ☺️
Let's check if I understand correctly: you would like to watch a video that shows how to login via HTTP and then pass the session data to a browser session to save time?
@@ChecklyHQ perhaps Matko wants to see how to use global-setup where you can login and save the storageState.json, then load the storageStage before all the tests thus bypassing subsequent login flows.
@@ChecklyHQ Yeah, to perform auth via API post req and then use that session in test to save time