Open gal064 opened 2 years ago
Sounds like a feature request to me. The current definition of soft assertions are that they will get collected and thrown on the test level: https://playwright.dev/docs/test-assertions#soft-assertions
To have them collected and thrown at the last test when using serial mode is very different.
Yep soft assertions may work according the dry definition but I think it's a bug from a user perspective (i.e. a miss when defining soft assertions).
The intended use-case of soft assertions is for a failure to not stop the test suite from running. This is not the case with serial tests, and probably not intentionally. I don't see any logic to why the current test should continue to run but subsequent tests stop.
With that said, I understand if it's not top priority though
Any update on the above feature/bug. Soft Assertions in serial mode, when we have multiple tests
Any update on the above feature/bug. Soft Assertions in serial mode, when we have multiple tests
Also looking for an update on this
Yep soft assertions may work according the dry definition but I think it's a bug from a user perspective (i.e. a miss when defining soft assertions).
The intended use-case of soft assertions is for a failure to not stop the test suite from running. This is not the case with serial tests, and probably not intentionally. I don't see any logic to why the current test should continue to run but subsequent tests stop.
With that said, I understand if it's not top priority though
agreeing with @gal064 - my use case is that I'm using serial mode to split filling out an order checkout process (which includes a lot of steps, expects, and page navigations) into multiple tests that have to run sequentially, and i just ran across a case in which i'd like an assertion to be soft (not to keep the soft failure permanently, but as a temporary measure to help me speed development) but i also understand there are other priorities. just wanted to add a data point!
I hope team is working on this bug. Any PR or work has been done so far ? Still see this in new version.
This would be really helpful. I'd love to know all the failing tests if there's a failing test but in serial mode (practically required for Android) a fail stops the tests.
Allowing the serial mode test to continue even if one test fails would be a very nice feature💪
This feature would be really helpful
This is a very required feature, would love to have this thing.
We recommend to wrap your expects and check that no errors were thrown in the last test.
For example, introduce these two helpers:
const errors: any[] = [];
async function soft(cb: () => any) {
try {
await cb();
} catch (e) {
errors.push(e);
}
}
async function checkErrors() {
await test.step('check errors', async () => {
for (const e of errors)
expect.soft(() => { throw e }).not.toThrow();
}, { box: true });
}
Now, you can use these helpers to wrap your expects, and check errors in the very last test:
test.describe.configure({ mode: 'serial' });
test('test1', async ({ page }) => {
// ...
await soft(() => expect(page.locator('body')).not.toBeVisible());
// ...
});
test('test2', async ({ page }) => {
// ...
await soft(() => expect(1).toBe(2));
// ...
});
test('check errors', async () => {
await checkErrors();
});
Describe the bug:
Code Snippet:
Help us help you! Put down a short code snippet that illustrates your bug and that we can run and debug locally.