Understanding Playwright Test Assertions

Поделиться
HTML-код
  • Опубликовано: 20 сен 2024
  • a beginner friendly, but in depth walk through of playwright assertions.
    understand how they work and the difference between different assertions.
    Web first assertions
    soft assertions
    jest expect assertions
    Polling that can be used to make resilient API assertions.

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

  • @imperuminate
    @imperuminate Год назад +1

    thanks for such videos

  • @randolphcarter3906
    @randolphcarter3906 Год назад

    Hello there! Thank you for this educative video. I have a question regarding the usage of assertions in conditional statements. Specifically, I would like to know if it's possible to use an assertion as a condition in an if-else block. Here's an example to illustrate my point:
    Let's say I have an assertion that checks the visibility of an element. If the element is visible, I want to print a console message saying "Visible." If the element is not visible, I want to print a console message saying "omg my test is broken!"
    Is it possible to use assertions in this way within an if-else block? Your insights on this matter would be greatly appreciated. Thank you in advance for your help!

    • @randolphcarter3906
      @randolphcarter3906 Год назад

      I've managed to do it using try-catch block! Finally everything works as it had to.))

    • @CommitQuality
      @CommitQuality  Год назад

      Awesome. I was going to suggest you look into try catch blocks, but it's worth noting it may be a bit of anti pattern for the assertions. If you want to find out if something failed but not fail the test immediately, using soft assertions may help

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

      You are such an amazing teacher take a bow 🙌 looking for ward to BDD with playwright typescript