Avoid flaky end-to-end tests due to poorly hydrated Frontends with Playwright's toPass()

  Рет қаралды 2,892

Checkly

Checkly

Күн бұрын

In this video we'll dive into the world of flaky tests in Playwright and synthetic monitoring with Checkly. We examine a site with poor Frontend hydration patterns, their effect on test stability, and how to work around them.
Learn how to avoid using artificial delays and implementing a retry mechanism with Playwright's 'toPass()' method to achieve stable testing instead.
0:00 Intro
0:38 Example of a poorly hydrated page
2:17 Recommended fix for poor hydration
3:32 Custom action retries with 'toPass()'
5:18 'toPass()' options
6:12 Running Playwright using the `--repeat-each` option
6:43 Outro
Checkly Synthetic Monitoring: www.checklyhq.com/product/syn...
Playwright 'toPass()' docs: playwright.dev/docs/test-asse...
#playwright #testing #monitoring #syntheticmonitoring

Пікірлер: 30
@sayyedumair1017
@sayyedumair1017 3 ай бұрын
Great video. This is really helpful in my daily work. Thanks for sharing this.
@roblesrt
@roblesrt 3 ай бұрын
This appears to be a better workaround than Webdriverio where I struggle with. This is very helpful in my case. Thanks for sharing!
@ChecklyHQ
@ChecklyHQ 3 ай бұрын
Yeah, testing poor hydration is tricky, but this turned out to be valuable for me. Happy the video was helpful!
@_firearmy
@_firearmy 3 ай бұрын
Great video and explained very clean. Thank you!
@ChecklyHQ
@ChecklyHQ 3 ай бұрын
Glad it was helpful!
@andreaskarz
@andreaskarz 2 ай бұрын
That's really cool - I love Playwright 😍😍
@og4789
@og4789 4 ай бұрын
Creepy I exactly faced this poor hydration behavior on the tested web app few days ago for the first time. What a timing, Thank you for showing that option! 🙏
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Great! 🎉 Happy this video came at the right time. Let us know how it goes. ;)
@lfc67671
@lfc67671 4 ай бұрын
To further this incredible timing I literally ran into this issue today! Great vid thank you Checkly!
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
@@lfc67671Yay! 🎉
@harshasuraweera
@harshasuraweera 4 ай бұрын
great explanation!
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Glad it was helpful! 💙
@dvdpeeters
@dvdpeeters 4 ай бұрын
Super nice !!
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thanks. Happy it's been valuable. 🎉
@HossamEldinMohamed3
@HossamEldinMohamed3 4 ай бұрын
Thanks for the awesome video and tips! Keep up the good work
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Thanks for the kind words. Happy the videos are valuable. :)
@barscanates5573
@barscanates5573 18 күн бұрын
Hello! I really appreciate that. Could you please create a video list focused solely on fighting flakiness in testing? This is a critical area for all testers.
@ChecklyHQ
@ChecklyHQ 18 күн бұрын
This is a great idea and I'll come to this in the upcoming weeks. I'll let you know here.
@coderkind
@coderkind 4 ай бұрын
Another great video; thank you. I’d possibly disagree with the “right fix” advice on Playwright’s docs to disable interactive controls until after hydration though, as that could cause confusion and frustration to screen reader users. They might attempt to interact with an element initially announced as being disabled/dimmed, and when that control was subsequently enabled via hydration then you’d have to manage how to update that state to the screen reader user.
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Love this comment! You make a great point. I followed the PWT docs for the sake of the storyline of the video. But I think you're correct. Disabled controls aren't focusable and won't trigger validations - and generally in the UX/a11y community it's advised to not disable controls for these reasons. But yeah, the topic of poor hydration + disabled controls is probably for another day and/or video. Thanks! 💙
@coderkind
@coderkind 4 ай бұрын
@@ChecklyHQthank you. It was more of an end-user issue I was highlighting (not necessarily Playwright operation); that it’s not great to set out a page as having x elements non-operable and to then amend that, as it’s something that then possibly has to be managed so the screen reader user is aware they can use those elements. It might be edge-case; that the page will hydrate and elements are enabled before a screen reader user attempts to use those elements, but it might be more of-a-thing in things like modals (where you often have a button default-focused).
@aaronmcadam
@aaronmcadam 4 ай бұрын
Fantastic video! I'm curious: how did you create the demo app to force a hydration error for your test to fall?
@ChecklyHQ
@ChecklyHQ 4 ай бұрын
Hah - that's a great question! For this example I only delayed adding the event listeners via a `setTimeout`. 🫣 But the same problem could appear because of various reasons. :)
@maverick53500
@maverick53500 2 ай бұрын
Unfortunately this solution works 50% of the time. I used it in 2 tests, in one of them it works, and in the other it doesn't. I have 2 assertions inside (toBeVisible and toHaveText) followed by page reload. The 'page reload' part is not executed for some reason... I had to wrap it in try-catch block, with 'expect' part inside 'try', and the page reload inside 'catch'
@ChecklyHQ
@ChecklyHQ 2 ай бұрын
Happy you figured it out. :)
@nickfwhite4296
@nickfwhite4296 2 ай бұрын
I am new in test automation, and I needed to test redirects after page reload, so I used await page.waitForLoadState('load'); await page.waitForTimeout(500); await page.reload(); await page.waitForLoadState('load'); await page.waitForTimeout(500); await expect(page.locator('.product-card-wrapper').first()).toContainText('PLN'); but .toPass() is much faster and stable, thank you a lot
@ChecklyHQ
@ChecklyHQ Ай бұрын
Yay! Happy the video has been valuable. 💙
Add accessibility checks to your Playwright end-to-end tests
11:18
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 16 МЛН
What it feels like cleaning up after a toddler.
00:40
Daniel LaBelle
Рет қаралды 78 МЛН
Sigma Kid Hair #funny #sigma #comedy
00:33
CRAZY GREAPA
Рет қаралды 35 МЛН
Why "page.goto()" is slowing down your tests
8:55
Checkly
Рет қаралды 2,7 М.
Don’t Do E2E Testing!
17:59
Continuous Delivery
Рет қаралды 152 М.
Performance Testing using Playwright
1:05:47
NY Web Performance Meetup
Рет қаралды 18 М.
How to test and monitor your APIs with Playwright
9:51
Checkly
Рет қаралды 3,1 М.
6 Tips to Manage Flaky Tests in Playwright
8:43
Semaphore CI
Рет қаралды 857
UI Libraries Are Dying, Here's Why
13:28
Theo - t3․gg
Рет қаралды 286 М.
Reuse Playwright  Code across Files and Tests with Fixtures
5:54
e2e testing with Playwright | OD111
15:52
Microsoft Developer
Рет қаралды 21 М.
Зарядка-брелок для Apple Watch
0:39
Rozetked
Рет қаралды 290 М.
Это Xiaomi Su7 Max 🤯 #xiaomi #su7max
1:01
Tynalieff Shorts
Рет қаралды 2 МЛН
Ноутбук за 20\40\60 тысяч рублей
42:36
Ремонтяш
Рет қаралды 352 М.