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

Sdílet
Vložit
  • čas přidán 21. 08. 2024

Komentáře • 33

  • @sayyedumair1017
    @sayyedumair1017 Před 4 měsíci +1

    Great video.
    This is really helpful in my daily work. Thanks for sharing this.

  • @roblesrt
    @roblesrt Před 4 měsíci

    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  Před 4 měsíci +1

      Yeah, testing poor hydration is tricky, but this turned out to be valuable for me. Happy the video was helpful!

  • @og4789
    @og4789 Před 4 měsíci

    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  Před 4 měsíci

      Great! 🎉 Happy this video came at the right time. Let us know how it goes. ;)

    • @lfc67671
      @lfc67671 Před 4 měsíci

      To further this incredible timing I literally ran into this issue today! Great vid thank you Checkly!

    • @ChecklyHQ
      @ChecklyHQ  Před 4 měsíci

      @@lfc67671Yay! 🎉

  • @andreaskarz
    @andreaskarz Před 3 měsíci

    That's really cool - I love Playwright 😍😍

  • @_firearmy
    @_firearmy Před 3 měsíci

    Great video and explained very clean. Thank you!

  • @coderkind
    @coderkind Před 4 měsíci

    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  Před 4 měsíci +1

      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 Před 4 měsíci +1

      @@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).

  • @harshasuraweera
    @harshasuraweera Před 4 měsíci

    great explanation!

    • @ChecklyHQ
      @ChecklyHQ  Před 4 měsíci

      Glad it was helpful! 💙

  • @cristiancruciani3603
    @cristiancruciani3603 Před 11 dny

    Crack! Im going crazy whit flakynes and you give me the solution

  • @barscanates5573
    @barscanates5573 Před měsícem

    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  Před měsícem +1

      This is a great idea and I'll come to this in the upcoming weeks. I'll let you know here.

  • @dvdpeeters
    @dvdpeeters Před 4 měsíci

    Super nice !!

    • @ChecklyHQ
      @ChecklyHQ  Před 4 měsíci

      Thanks. Happy it's been valuable. 🎉

  • @aaronmcadam
    @aaronmcadam Před 4 měsíci

    Fantastic video! I'm curious: how did you create the demo app to force a hydration error for your test to fall?

    • @ChecklyHQ
      @ChecklyHQ  Před 4 měsíci +1

      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. :)

  • @nickfwhite4296
    @nickfwhite4296 Před 3 měsíci

    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  Před 2 měsíci

      Yay! Happy the video has been valuable. 💙

  • @maverick53500
    @maverick53500 Před 3 měsíci

    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  Před 3 měsíci

      Happy you figured it out. :)

  • @HossamEldinMohamed3
    @HossamEldinMohamed3 Před 4 měsíci

    Thanks for the awesome video and tips! Keep up the good work

    • @ChecklyHQ
      @ChecklyHQ  Před 4 měsíci +1

      Thanks for the kind words. Happy the videos are valuable. :)