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 Жыл бұрын
I've managed to do it using try-catch block! Finally everything works as it had to.))
@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_wellington9 ай бұрын
You are such an amazing teacher take a bow 🙌 looking for ward to BDD with playwright typescript