Automate REST APIs using Playwright and Typescript - explained with live coding
Till now we have learn how to automate UI using Playwright. Playwright has capabilities to automate APIs as well. One can easily automate REST API calls and verify the response using Playwright and typescript. In Playwright APIRequestContext can be used to trigger APIs for end-to-end automation. APIRequestContext has all the methods to automate like Get, Post, Fetch, Head, Put, Patch, Delete.
To Automate API using Playwright
1. Create a repo or use existing repo
2. Start writing test case
3. Hit the request and store response in the variable
4. Verify the response using expect
5. Verify some strings from the response in case of POST
I have created a YouTube video in the "software testing tips and tricks" channel where I have explained how to automate REST APIs using playwright and typescript with live coding. in this video, I have shown
1. Test example APIs and how they work using Postman Manually.
2. How to Automate Rest APIs with the live scripting?
3. How to validate APIs in Automation using expect?
All Playwright Tutorial Posts -
- Setup NodeJS playwright and run the first script
- Learn basic automation with Playwright - with code
- Expect and Auto-waits in Playwright
- How to debug the playwright script?
- How to compare screenshots using Playwright?
- Best Practices with Playwright automation
- Playwright Tutorial - Handle Multiple Tabs with Playwright
- automate downloads using Playwright?
- Automate file upload using Playwright
- Different types of waits in the Playwright
No comments