Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix: properly handle negated timed-out `toPass` matcher (#19580)
Andrey Lushnikovd7e7cab44a28
diff --git a/packages/playwright-test/src/matchers/matchers.ts b/packages/playwright-test/src/matchers/matchers.tsindex 3d39c390fb..b9477377e3 100644--- a/packages/playwright-test/src/matchers/matchers.ts+++ b/packages/playwright-test/src/matchers/matchers.ts@@ -358,5 +358,5 @@ export async function toPass(`- ${timeoutMessage}`,].join('\n') : timeoutMessage;- return { message, pass: false };+ return { message, pass: isNot ? true : false };}diff --git a/tests/playwright-test/expect-to-pass.spec.ts b/tests/playwright-test/expect-to-pass.spec.tsindex d76cf094c1..82f6308438 100644--- a/tests/playwright-test/expect-to-pass.spec.ts+++ b/tests/playwright-test/expect-to-pass.spec.ts@@ -166,4 +166,17 @@ test('should work with soft', async ({ runInlineTest }) => {expect(stripAnsi(result.output)).toContain('Received: 2');expect(result.exitCode).toBe(1);expect(result.failed).toBe(1);-});\ No newline at end of file+});++test('should not accept TimeoutError', async ({ runInlineTest }) => {+ const result = await runInlineTest({+ 'a.spec.ts': `+ const { test } = pwt;+ test('should fail', async () => {+ await test.expect(() => {}).not.toPass({ timeout: 1 });+ });+ `+ });+ expect(result.exitCode).toBe(1);+ expect(result.failed).toBe(1);+});