Playwright API Testing Demo for Beginners

preview_player
Показать описание
Project Setup
Create a API Test Step-by-Step
How to run a GET API Request
How to run a POST API Request
How to run a PUT API Request
How to run a DELETE API Request
How to validate API Response
Check response, logs, errors in UI Mode
Check HTML Report

*API Testing with Playwright - Project Setup*

Step 1 - Create a new folder for API Testing Project
Step 2 - Open the folder in VS Code

Step 4 - Check if demo tests are running fine using commands npx playwright test
npx playwright test --ui
npx playwright show-report

*How to run a GET API Request *

Step 1 - Add imports

Step 2 - Create a test using request context

Step 3 - Send a GET request & store response in a variable

Step 4 - Verify the status code of the response is 200

Step 5 - Check response contains some text
expect(text).toContain('Janet');

Step 6 - Write response on the console

Step 7 - Run and check results

*How to run a POST API Request*

Step 1 - Add imports

Step 2 - Create a test using request context

Step 3 - Send a POST request along with request body & store response in a variable

data: {
"name": "Raghav",
"job": "teacher"
}
})

Step 4 - Verify response status code is 201

Step 5 - Check response contains some text
expect(text).toContain(Raghav);

Step 6 - Write response on the console

Step 7 - Run and check results

*How to run a PUT API Request*

test('Demo API PUT Request', async ({ request }) => {

data: {
"name": "Raghav",
"job": "teacher"
}
})
expect(text).toContain('Raghav');

})

*How to run a DELETE API Request*

test('Demo API DELETE Request', async ({ request }) => {

})

References

▬▬▬▬▬▬▬

Every Like & Subscription gives me great motivation to keep working for you
You can support my mission for education by sharing this knowledge and helping as many people as you can

If my work has helped you, consider helping any animal near you, in any way you can

Never Stop Learning
Raghav Pal

▬▬▬▬ USEFUL LINKS ▬▬▬▬


Рекомендации по теме
Комментарии
Автор

From Russia with love! :-) Dude, you have a talent for explaining complex topics in simple language. The best course on the Internet that I could find. I watched it in one breath. Keep it up!

СергейПилипенко-лъ
Автор

You are the best example of the "Simplicity is the Best city". Thanks for this video.

KarthikJambagi
Автор

Just finished this series on Playwright. What a great introduction to the Playwright docs! Lots of helpful examples to get started with. You have a great presentation voice for this material, by the way. Thanks for the instructions and encouragement throughout this playlist!

petropolisful
Автор

Your YouTube videos have been a lifeline for me in my studies, Sir . Thank you for being such an excellent teacher and sharing your expertise with the world.

KasuriThiyumini
Автор

This channel is my second home, thank you for all your amazing tutorials

alleluiaizimpamvu
Автор

Thanks for your lessons. You are the best teacher I ever met.

TatevikPoghosyan-xq
Автор

Perfect timing Raghav, I've been going through your step by step guide on Playwright UI automation but I was also interested if Playwright can be used for API testing. Would be great if you could do a guide on data-driven API tests in Playwright too.

spudman
Автор

Hi Raghav- Thank you for taking time and doing .
One question on get request. Since you are looking entire for Name. Is there a way to look for specific or first occurence of that name

skhambampati
Автор

Thanks for the course.

I was already familiar with playwright but it was refreshing.

However what I am missing is real life examples. How to structure tests and how to do them.

I have a project where we have 20 user roles, 1000 different input fields / dropdowns.

Based on what user will fill it will take different workflow.

How can I somehow make sure that database is reloaded with same data after successful tests.

How to read data from .csv file to use them in forms.

How to repeat same tests but with different input values.

How to make sure that tests are run in correct sequence instead of running each file separately.

This is honestly good for start but bigger projects require more thoughts than just how to fill 2 input fields with same data over and over again and clicking on 1 button.

Could you point me on such course please.

peterinvestor
Автор

Hi Raghav, this the best video I have found on internet for API Framework development..
can you please help with new set of videos for API auth and other topics (End-to-End) API framework..thanks a lot for this knowledge transfer 😊

vedashreeravish
Автор

Thank you very much Raghav, very easy to follow tutorial, I have learned a lot. I have just begun my career in software testing, this is simply great stuff. Subscribed, never stop learning!

SakataSamig
Автор

Raghav, I have completed your playwright beginner tutorial and I must say thank you from the bottom of my heart. You are an amazing human being & teacher!

Can I ask you one question, is the knowledge from this course enough to land a junior position as a playwright automation tester?

MrCRO
Автор

Want to thank you Sir for such an amazing tutorials and step by step guidelines.

infotech
Автор

Hi Raghav, Your explanation on Playwright Automation is top-notch. It is helping me a lot in understanding what a Playwright is ?. I want to continue learning more about Playwright features like Component testing. Could you please do videos on component testing using Playwright?

saikrishnacheekoti
Автор

This video is perfect but will you also make one about creating classes for data to feed into the UI test? i feel like this was a really important topic that was missed for this. Also will you make the same video for Selenium Python as far as Data and api testing?

michaeledmondson
Автор

Thanks Raghav for such a nice and quick session

RohiTSingh-dbsv
Автор

The whole course was amazing, thanks Raghav

ManojKumar-ywcm
Автор

Hi Raghav, have you tried Maestro? I'm looking for automated testing tool for single code base react native application. right now, Playwright is looked can help to perform test for web & API. but for maestro, it also can perform test on webview. Do you have any comments on this comparisons?

terjemahanminda-ahmadfahmi
Автор

You are the best !thank you so much Raghav for this.
I understood the basics of api testing

Can you please let me know on how to do deep dive into more like what kind of advanced topics I should explore in api testing

priyankav
Автор

Hi Raghav, if we use playwright-maestro for functional test, and vitest for backend unit test; what tool would you suggest for our test management tools?

terjemahanminda-ahmadfahmi
welcome to shbcf.ru