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
test: unflake some timeout-dependent tests (#19139)
Dmitry Gozman23e02dd006cb
diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.tsindex b1ed0c2a7d..d83a425e94 100644--- a/tests/playwright-test/expect.spec.ts+++ b/tests/playwright-test/expect.spec.ts@@ -435,18 +435,14 @@ test('should respect expect.timeout', async ({ runInlineTest }) => {test('timeout', async ({ page }) => {await page.goto('data:text/html,<div>A</div>');- await Promise.all([- expect(page).toHaveURL('data:text/html,<div>B</div>'),- new Promise(f => setTimeout(f, 2000)).then(() => expect(true).toBe(false))- ]);+ const error = await expect(page).toHaveURL('data:text/html,<div>B</div>').catch(e => e);+ expect(error.message).toContain('expect.toHaveURL with timeout 1000ms');+ expect(error.message).toContain('data:text/html,<div>');});`,}, { workers: 1 });- const output = stripAnsi(result.output);- expect(output).toContain('expect(received).toHaveURL(expected)');- expect(output).toContain('expect.toHaveURL with timeout 1000ms');- expect(result.failed).toBe(1);- expect(result.exitCode).toBe(1);+ expect(result.exitCode).toBe(0);+ expect(result.passed).toBe(1);});test('should log scale the time', async ({ runInlineTest }) => {diff --git a/tests/playwright-test/hooks.spec.ts b/tests/playwright-test/hooks.spec.tsindex 7ed25b4470..c1cb331ffa 100644--- a/tests/playwright-test/hooks.spec.ts+++ b/tests/playwright-test/hooks.spec.ts@@ -716,14 +716,14 @@ test('test.setTimeout should work separately in beforeAll', async ({ runInlineTeconst { test } = pwt;test.beforeAll(async () => {console.log('\\n%%beforeAll');- test.setTimeout(100);+ test.setTimeout(1000);});test('passed', async () => {console.log('\\n%%test');- await new Promise(f => setTimeout(f, 500));+ await new Promise(f => setTimeout(f, 2000));});`,- }, { timeout: 2000 });+ }, { timeout: 3000 });expect(result.exitCode).toBe(0);expect(result.passed).toBe(1);expect(result.output.split('\n').filter(line => line.startsWith('%%'))).toEqual([