-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Expect.toPass to work with soft asserts #20437
Comments
I fixed it by the following approach, but I'm not sure this is a fully safe way with no side-effects await expect(async () => {
test.info().errors = [];
test.info().status = 'passed';
// all my soft asserts
expect(test.info().errors).toHaveLength(0);
}).toPass();
|
I don't think we have a good definition of soft assert inside toPass block. One is saying "retry if failed" and another is saying "pretend you did not fail". Do you think you could remove soft? toPass will retry until all of the expects pass, so it does not seem to add much. |
The reason for soft assert is the same - make a test to be able to check multiple conditions. I have an object with inner objects. And some values with specific IDs in these inner objects should be changed after some test actions. So I verify every place and it's useful to use soft asserts instead of something like param1&¶m2&¶m3 as with soft asserts I can check several places and get an informative report in case of fail. In your case if I use non-soft asserts and test fails, I see only the first issue. |
Why was this issue closed?Thank you for your involvement. This issue was closed due to limited engagement (upvotes/activity), lack of recent activity, and insufficient actionability. To maintain a manageable database, we prioritize issues based on these factors. If you disagree with this closure, please open a new issue and reference this one. More support or clarity on its necessity may prompt a review. Your understanding and cooperation are appreciated. |
After some test actions, I load a complex object via API and check its structure by multiple soft asserts.
This structure doesn't update fast so the API call might return the object with obsolete data.
I tried wrapping these soft asserts like
But the test fails and the console output looks like
7
14
21
28
35
35
35
35
35
The text was updated successfully, but these errors were encountered: