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

Поделиться
HTML-код
  • Опубликовано: 22 ноя 2024

Комментарии • 48

  • @luckyruin
    @luckyruin 25 дней назад +2

    I was stuck on how to resolve this issue for too long. Thank you for saving my sanity

  • @GoplaySi
    @GoplaySi 17 дней назад +1

    You, sir, are a gentleman and a scholar. Also, you've given me fuel to scold our front end team!

    • @ChecklyHQ
      @ChecklyHQ  16 дней назад

      Happy to hear that!

  • @StuartMinionTheTestExpert
    @StuartMinionTheTestExpert Месяц назад +1

    I love this tip. I have had so many banging-head-on-wall moments with this type of problem and trying to avoid adding Time.Delays. Thanks for sharing.

    • @ChecklyHQ
      @ChecklyHQ  Месяц назад

      Yes, 100%. If the frontend is untestable I usually reach for `toPass()` first. 💪

  • @og4789
    @og4789 8 месяцев назад

    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  8 месяцев назад

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

    • @lfc67671
      @lfc67671 8 месяцев назад

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

    • @ChecklyHQ
      @ChecklyHQ  8 месяцев назад

      @@lfc67671Yay! 🎉

  • @kcconsigo7429
    @kcconsigo7429 Месяц назад

    Thank you. this saved my running tests in playwright automation project 😀😃

  • @suda-nz
    @suda-nz 2 месяца назад

    Thank you again~ I faced this issue this morning, and you saved me again.

  • @iHorus
    @iHorus 2 месяца назад

    Oh it helps a lot! Our product is basically made of hydration problems.

    • @ChecklyHQ
      @ChecklyHQ  2 месяца назад

      Yeah - I'm used to this state, too. 😅

  • @glebmirosnikovs6722
    @glebmirosnikovs6722 Месяц назад

    Thank you again, nice tip! Did not know about it. Big thanks, that you are sharing it with community!

  • @roblesrt
    @roblesrt 7 месяцев назад

    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  7 месяцев назад +1

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

  • @sayyedumair1017
    @sayyedumair1017 7 месяцев назад +2

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

  • @coderkind
    @coderkind 8 месяцев назад

    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  8 месяцев назад +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 8 месяцев назад +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).

  • @barscanates5573
    @barscanates5573 4 месяца назад

    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  4 месяца назад +1

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

  • @nickfwhite4296
    @nickfwhite4296 6 месяцев назад +1

    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  5 месяцев назад

      Yay! Happy the video has been valuable. 💙

    • @jimynicanorquintanillacero9401
      @jimynicanorquintanillacero9401 2 месяца назад

      Thanks nick, you give an idea to solve an issue with await page.waitForTimeout(500);

  • @blissweb
    @blissweb 17 дней назад

    This is gold !! Thanks for the tip.

    • @ChecklyHQ
      @ChecklyHQ  16 дней назад

      Happy it's useful! 🦝

  • @aaronmcadam
    @aaronmcadam 7 месяцев назад

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

    • @ChecklyHQ
      @ChecklyHQ  7 месяцев назад +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. :)

  • @_firearmy
    @_firearmy 7 месяцев назад

    Great video and explained very clean. Thank you!

    • @ChecklyHQ
      @ChecklyHQ  7 месяцев назад

      Glad it was helpful!

  • @andreaskarz
    @andreaskarz 6 месяцев назад

    That's really cool - I love Playwright 😍😍

  • @harshasuraweera
    @harshasuraweera 7 месяцев назад

    great explanation!

    • @ChecklyHQ
      @ChecklyHQ  7 месяцев назад

      Glad it was helpful! 💙

  • @dvdpeeters
    @dvdpeeters 7 месяцев назад

    Super nice !!

    • @ChecklyHQ
      @ChecklyHQ  7 месяцев назад

      Thanks. Happy it's been valuable. 🎉

  • @cristiancruciani3603
    @cristiancruciani3603 3 месяца назад

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

    • @ChecklyHQ
      @ChecklyHQ  3 месяца назад

      Yay! That's great to hear!

  • @Indian1947-o1z
    @Indian1947-o1z 2 месяца назад

    cool

  • @maverick53500
    @maverick53500 6 месяцев назад

    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  6 месяцев назад

      Happy you figured it out. :)

  • @HossamEldinMohamed3
    @HossamEldinMohamed3 8 месяцев назад

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

    • @ChecklyHQ
      @ChecklyHQ  8 месяцев назад +1

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