playwright-python icon indicating copy to clipboard operation
playwright-python copied to clipboard

[Feature] Add soft assertions

Open heathiviesyncro opened this issue 2 years ago • 4 comments

It would be nice to get the soft assertions that are available in node to be available in python.

https://playwright.dev/docs/test-assertions#soft-assertions

Thank you

heathiviesyncro avatar Apr 25 '22 17:04 heathiviesyncro

Any idea how to implement this now? Try/Except with short timeout or is there a better way?

vlado48 avatar Jun 02 '22 21:06 vlado48

I am using pytest-check for soft assertions. Adds another dependency to the project, but it works great.

aspenboy avatar Dec 07 '22 18:12 aspenboy

I am using pytest-check for soft assertions. Adds another dependency to the project, but it works great.

I tried this one but couldn't get it working with expect(). Do you have an example of this?

Also +1 for soft assertions to be implemented in python as well as typescript.

jfp1992 avatar Sep 27 '23 12:09 jfp1992

I tried this one but couldn't get it working with expect(). Do you have an example of this?

It's a separate assertion mechanism, so you don't use it within expect(). Pretty nice examples are included on the github page: https://github.com/okken/pytest-check

Also - you can mix assertions in your tests, so it's fine to use assert, expect() and check().

aspenboy avatar Sep 27 '23 12:09 aspenboy