mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
parent
ffb719385b
commit
f45f20a8c9
@ -352,5 +352,7 @@ export async function toPass(
|
|||||||
|
|
||||||
return { message, pass: this.isNot };
|
return { message, pass: this.isNot };
|
||||||
}
|
}
|
||||||
|
if (testStateBeforeToPassMatcher && testInfo)
|
||||||
|
testInfo._restoreErrorState(testStateBeforeToPassMatcher);
|
||||||
return { pass: !this.isNot, message: () => '' };
|
return { pass: !this.isNot, message: () => '' };
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,24 @@ test('should swallow all soft errors inside toPass matcher, if successful', asyn
|
|||||||
expect(result.failed).toBe(1);
|
expect(result.failed).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should work with no.toPass and failing soft assertion', async ({ runInlineTest }) => {
|
||||||
|
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20518' });
|
||||||
|
|
||||||
|
const result = await runInlineTest({
|
||||||
|
'a.spec.ts': `
|
||||||
|
const { test } = pwt;
|
||||||
|
test('should work', async () => {
|
||||||
|
await test.expect(() => {
|
||||||
|
expect.soft(1).toBe(2);
|
||||||
|
}).not.toPass({ timeout: 1000 });
|
||||||
|
});
|
||||||
|
`
|
||||||
|
});
|
||||||
|
expect(result.exitCode).toBe(0);
|
||||||
|
expect(result.failed).toBe(0);
|
||||||
|
expect(result.passed).toBe(1);
|
||||||
|
});
|
||||||
|
|
||||||
test('should show only soft errors on last toPass pass', async ({ runInlineTest }) => {
|
test('should show only soft errors on last toPass pass', async ({ runInlineTest }) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'a.spec.ts': `
|
'a.spec.ts': `
|
||||||
|
Loading…
x
Reference in New Issue
Block a user