Skip to content
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.soft and soft assertions #3435

Closed
4 tasks done
unickq opened this issue May 23, 2023 · 1 comment · Fixed by #3507
Closed
4 tasks done

[Feature]: Expect.soft and soft assertions #3435

unickq opened this issue May 23, 2023 · 1 comment · Fixed by #3507
Labels
enhancement New feature or request pr welcome

Comments

@unickq
Copy link

unickq commented May 23, 2023

Clear and concise description of the problem

Soft assertions.

The idea of soft assertions - do not terminate test execution, but mark the test as failed.

Description can be taken from jestjs/jest#13205 and microsoft/playwright#11800.
Playwright currently supports it, which makes its test runner amazing. I think it would be great to have this in vitest

// Make a few checks that will not stop the test when failed...
await expect.soft(page.getByTestId('status')).toHaveText('Success');
await expect.soft(page.getByTestId('eta')).toHaveText('1 day');

// ... and continue the test to check more things.
await page.getByRole('link', { name: 'next page' }).click();
await expect.soft(page.getByRole('heading', { name: 'Make another order' })).toBeVisible();

Suggested solution

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

Alternative

No response

Additional context

No response

Validations

@sheremet-va
Copy link
Member

sheremet-va commented May 23, 2023

There was an idea to implement this as an optional field on a test in #2139, but I agree that expect.soft is a better API.

It also should be easier to implement than in Jest, because our expect is bound to a test.

@sheremet-va sheremet-va added enhancement New feature or request pr welcome labels May 23, 2023
@unickq unickq changed the title [Feature]: Expect.soft for setup and soft assertions [Feature]: Expect.soft and soft assertions May 23, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request pr welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants