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/fix a few tests (#38687)
Dmitry Gozman5225b7bd763b
diff --git a/tests/library/hit-target.spec.ts b/tests/library/hit-target.spec.tsindex d18915a1a8..d13f21f8fa 100644--- a/tests/library/hit-target.spec.ts+++ b/tests/library/hit-target.spec.ts@@ -40,8 +40,8 @@ it('should block all events when hit target is wrong', async ({ page, server })}});- const error = await page.click('button', { timeout: 1000 }).catch(e => e);- expect(error.message).toContain('page.click: Timeout 1000ms exceeded.');+ const error = await page.click('button', { timeout: 3000 }).catch(e => e);+ expect(error.message).toContain('page.click: Timeout 3000ms exceeded.');// Give it some time, just in case.await page.waitForTimeout(1000);@@ -107,8 +107,8 @@ it('should block all events when hit target is wrong and element detaches', asyn}});- const error = await page.click('button', { timeout: 1000 }).catch(e => e);- expect(error.message).toContain('page.click: Timeout 1000ms exceeded.');+ const error = await page.click('button', { timeout: 3000 }).catch(e => e);+ expect(error.message).toContain('page.click: Timeout 3000ms exceeded.');// Give it some time, just in case.await page.waitForTimeout(1000);@@ -359,7 +359,7 @@ it('should detect overlay from another shadow root', async ({ page, server }) =></script>`);- const error = await page.locator('#container1 >> text=click me').click({ timeout: 2000 }).catch(e => e);+ const error = await page.locator('#container1 >> text=click me').click({ timeout: 3000 }).catch(e => e);expect(error.message).toContain(`<div id="container2"></div> intercepts pointer events`);});@@ -391,7 +391,7 @@ it('should detect overlaid element in a transformed iframe', async ({ page }) =>"></iframe>`);const locator = page.frameLocator('iframe').locator('div');- const error = await locator.click({ timeout: 2000 }).catch(e => e);+ const error = await locator.click({ timeout: 3000 }).catch(e => e);expect(error.message).toContain('<section>Overlay</section> intercepts pointer events');});diff --git a/tests/library/screenshot.spec.ts b/tests/library/screenshot.spec.tsindex 9d525f2f62..719e0d14a4 100644--- a/tests/library/screenshot.spec.ts+++ b/tests/library/screenshot.spec.ts@@ -134,7 +134,7 @@ browserTest.describe('page screenshot', () => {}, async ({ browserName, headless, platform, contextFactory, channel }) => {browserTest.fixme(browserName === 'chromium' && !headless && platform === 'linux', 'Chromium has gpu problems on linux with large screenshots');// TODO: figure this out. https://github.com/microsoft/playwright/issues/38476- browserTest.fixme(platform === 'darwin' && channel === 'chromium-tip-of-tree', 'SwiftShader is forced on Mac, and does not render below 8192px');+ browserTest.fixme(platform === 'darwin' && browserName === 'chromium', 'SwiftShader is forced on Mac, and does not render below 8192px');browserTest.slow(true, 'Large screenshot is slow');const context = await contextFactory();diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.tsindex b65fa3db1d..07397c5663 100644--- a/tests/library/tracing.spec.ts+++ b/tests/library/tracing.spec.ts@@ -431,7 +431,7 @@ for (const params of [}]) {browserTest(`should produce screencast frames ${params.id}`, async ({ video, contextFactory, browserName, platform, headless, isHeadlessShell }, testInfo) => {- browserTest.skip(browserName === 'chromium' && video === 'on', 'Same screencast resolution conflicts');+ browserTest.skip(video === 'on', 'Same screencast resolution conflicts');browserTest.fixme(browserName === 'chromium' && !isHeadlessShell, 'Chromium (but not headless-shell) screencast has a min width issue');browserTest.fixme(params.id === 'fit' && browserName === 'chromium' && platform === 'darwin', 'High DPI maxes image at 600x600');browserTest.fixme(params.id === 'fit' && browserName === 'webkit' && platform === 'linux', 'Image size is flaky');diff --git a/tests/page/expect-boolean.spec.ts b/tests/page/expect-boolean.spec.tsindex 4f256cb65a..f2eddbc3f1 100644--- a/tests/page/expect-boolean.spec.ts+++ b/tests/page/expect-boolean.spec.ts@@ -452,14 +452,14 @@ test.describe('toBeHidden', () => {test('fail', async ({ page }) => {await page.setContent('<input></input>');const locator = page.locator('input');- const error = await expect(locator).toBeHidden({ timeout: 1000 }).catch(e => e);+ const error = await expect(locator).toBeHidden({ timeout: 3000 }).catch(e => e);expect(error.message).toContain(`locator resolved to <input/>`);});test('fail with not', async ({ page }) => {await page.setContent('<button style="display: none"></button>');const locator = page.locator('button');- const error = await expect(locator).not.toBeHidden({ timeout: 1000 }).catch(e => e);+ const error = await expect(locator).not.toBeHidden({ timeout: 3000 }).catch(e => e);expect(error.message).toContain(`locator resolved to <button></button>`);});@@ -663,7 +663,7 @@ test.describe('toBeAttached', () => {test('fail with not', async ({ page }) => {await page.setContent('<input></input>');const locator = page.locator('input');- const error = await expect(locator).not.toBeAttached({ timeout: 1000 }).catch(e => e);+ const error = await expect(locator).not.toBeAttached({ timeout: 3000 }).catch(e => e);expect(error.message).toContain(`locator resolved to <input/>`);});diff --git a/tests/page/page-aria-snapshot-ai.spec.ts b/tests/page/page-aria-snapshot-ai.spec.tsindex 4677087d0a..6a7eae205a 100644--- a/tests/page/page-aria-snapshot-ai.spec.ts+++ b/tests/page/page-aria-snapshot-ai.spec.ts@@ -429,7 +429,7 @@ it('return empty snapshot when iframe is not loaded', { annotation: { type: 'issawait page.waitForSelector('iframe');// Get the snapshot of the page- const snapshot = await snapshotForAI(page, { timeout: 100 });+ const snapshot = await snapshotForAI(page, { timeout: 3000 });// The iframe should be present but emptyexpect(snapshot).toContainYaml(`