Тёмный

How to wait for a specific API response in your Playwright end-to-end tests 

Checkly
Подписаться 3,5 тыс.
Просмотров 7 тыс.
50% 1

Наука

Опубликовано:

 

19 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@mayankgupta7858
@mayankgupta7858 19 дней назад
You made it Simple and Reliable. Amazing content!
@ChecklyHQ
@ChecklyHQ 19 дней назад
Glad you liked it!
@sheiksadakkathulla7364
@sheiksadakkathulla7364 6 месяцев назад
i am using it more than a year ...which is very useful on dynamically generating test data...
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Great 👍 Yeah, that's a nice use case!
@kumekster
@kumekster 20 дней назад
As always, great content.
@pineapplesoda
@pineapplesoda 6 месяцев назад
This is so useful, thank you! I would love to see a video on checking payment transactions.
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Happy the videos are useful. Could you explain a bit more detailed what process / transaction you'd like to see?
@kkrkkr5093
@kkrkkr5093 6 месяцев назад
this video actually came in clutch
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Happy this video has been helpful!
@LenaChe977
@LenaChe977 25 дней назад
Great content🙌 Thanks a lot.
@ChecklyHQ
@ChecklyHQ 25 дней назад
Happy it's been valuable! 💙
@abcdrk
@abcdrk 2 месяца назад
Pretty helpful content, thanks!
@ChecklyHQ
@ChecklyHQ 2 месяца назад
Happy it's been valuable. :)
@EricWilliamsonTech
@EricWilliamsonTech 6 месяцев назад
Great content! Thanks!
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Glad you liked it!
@leonidvr6455
@leonidvr6455 4 месяца назад
I did similar approach in my UI tests
@pabloortiz6031
@pabloortiz6031 6 месяцев назад
Thanks
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Happy it's been valuable. :)
@feralgoose7157
@feralgoose7157 2 месяца назад
Thanks for this, I have been using network checks to reduce the waits for elements on the page. In my scenario, I wait for a response from the Api that populates the screen and then start interacting with the page. If I don't have this check the test is flaky that Playwright tries to interact with elements that are still getting populated. This seems to work, but it seems navigation from one page to the next is a bit broken, since the page I navigate from needs to know about network traffic to instantiate the page we are going to. I am wondering if there is a better pattern.
@ChecklyHQ
@ChecklyHQ 2 месяца назад
It's hard to give advice without knowing the specifics. But generally it's always better to wait for a certain UI state and network waiting should be the last resort. Maybe there's certain data that shows up eventually? When you think of it, users also don't wait for a network request. They just click around, try to be user-first always. :) I hope this helps. 🦝
@hito6464
@hito6464 2 месяца назад
Hi, thank you for the great lesson. I wonder If you could make a video on how to write a test for Adobe Analytics and Google Analytics (dataLayer) requests, which fire on page load and clicks. How to verify the values in the payload of such requests.
@ChecklyHQ
@ChecklyHQ 2 месяца назад
Great suggestion! I'll put it on the list!
@ShaneMc74
@ShaneMc74 6 месяцев назад
Great video! What would happen in a scenario where the api doesn’t get called or it returns an error (ie. Never resolves with success) will it just hit the test timeout?
@ChecklyHQ
@ChecklyHQ 6 месяцев назад
Great question! Your assumption is correct and the error handling depends on your project configuration. `waitForResponse()` has a timeout setting to limit the waiting for a particular API response. If this setting isn't set, the general test timeout will be hit eventually. :) It's up to you and the project requirements to find what works best.
@ShaneMc74
@ShaneMc74 6 месяцев назад
@@ChecklyHQ Thanks for confirming. Keep up the great videos
@GavrOleg
@GavrOleg 2 месяца назад
Have you ever encounter this issue: when implementing tests and running locally - everything is ok with "waitForResponse" and test is passing, but when it's being executed in CI (in our case in GitLab) - it throws a timeout exception on this waiting? What could be a reason of that?
@ChecklyHQ
@ChecklyHQ 2 месяца назад
Great question. I've never encountered a PWT issue and it's almost always an environment difference. The only way to find out is debug the network and application state via trace files. :) Hope this helps. :)
@_firearmy
@_firearmy 4 месяца назад
This is so useful, thank you! I have small doubt. How do I track the API response which is already invoked. Is it possible?
@ChecklyHQ
@ChecklyHQ 4 месяца назад
In this situation, the described approach wouldn't work well. But can you describe the scenario you're trying to test? Because I can't think of a case when it would be impossible to attach the network event handler. 🤔
@_firearmy
@_firearmy 4 месяца назад
@@ChecklyHQ Thank you for your attention. I require certain metadata from the app that will be captured with every full page load. I need this information to develop test cases. While I can obtain this metadata by either moving a global variable or invoking the metadata API, my objective is to accomplish this without directly modifying the app's code.
@AvinashKumar-rk5fz
@AvinashKumar-rk5fz 5 месяцев назад
Hey I have a scenario where I need to click on next button and there is navigation happens which sometimes takes more than 15s and I need to do some assertions but these navigations provides a lot of intermittent issues. Is the issue because of API calls. Please guide me on this
@ChecklyHQ
@ChecklyHQ 5 месяцев назад
Ideally would check if you could work around these without listening for the network (users wouldn't watch and check the network either). So if you're having a long lasting navigation you could increase the timeout for the assertions / actions on the slow page. :) The overall recommandation is to only listen to the network when you really have to. Hope this helps.
Далее
Why "page.goto()" is slowing down your tests
8:55
Просмотров 3,4 тыс.
Редакция. News: 60-я неделя
41:13
Просмотров 1,7 млн
СОВСЕМ НЕ СОБАЧКИ🤷
11:10
Просмотров 62 тыс.
Playwright: MOCK API Requests
8:54
Просмотров 7 тыс.
Шушаник прилетела из Еревана
0:48
ТЕЛЕФОН МЕНЯЕТ ЦВЕТ😅 #upx
0:34
Просмотров 639 тыс.
СКЕТЧ ТИКТОК || NIKOL KOULEN
0:28
Просмотров 284 тыс.
The picture getting old on Omegle #shorts
0:59
Просмотров 10 млн