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/skip a few tests (#39056)
Dmitry Gozman15ef7b188e41
diff --git a/tests/library/tracing.spec.ts b/tests/library/tracing.spec.tsindex f76187ecc9..72e3966af0 100644--- a/tests/library/tracing.spec.ts+++ b/tests/library/tracing.spec.ts@@ -564,7 +564,7 @@ test('should not hang for clicks that open dialogs', async ({ context, page }) =await context.tracing.start({ screenshots: true, snapshots: true });const dialogPromise = page.waitForEvent('dialog');await page.setContent(`<div onclick='window.alert(123)'>Click me</div>`);- await page.click('div', { timeout: 2000 }).catch(() => {});+ await page.click('div', { timeout: 3500 }).catch(() => {});const dialog = await dialogPromise;await dialog.dismiss();await context.tracing.stop();diff --git a/tests/page/page-drag.spec.ts b/tests/page/page-drag.spec.tsindex 43e0f335be..fb59ba6b95 100644--- a/tests/page/page-drag.spec.ts+++ b/tests/page/page-drag.spec.ts@@ -300,7 +300,9 @@ it.describe('Drag and drop', () => {title: 'dragTo',drag: (page: Page, steps?: number) => page.locator('#red').dragTo(page.locator('#blue'), { steps }),}].forEach(({ title, drag }) => {- it(`should ${title} with tweened mouse movement`, async ({ page }) => {+ it(`should ${title} with tweened mouse movement`, async ({ page, headless }) => {+ it.skip(!headless, 'actual mouse interferes with the exact mousemove events');+await page.setContent(`<body style="margin: 0; padding: 0;"><div style="width:100px;height:100px;background:red;" id="red"></div>diff --git a/tests/page/page-mouse.spec.ts b/tests/page/page-mouse.spec.tsindex bb1954af46..6408074093 100644--- a/tests/page/page-mouse.spec.ts+++ b/tests/page/page-mouse.spec.ts@@ -267,8 +267,9 @@ it('should set modifier keys on click', async ({ page, server, browserName, isMa}});-it('should tween mouse movement', async ({ page, browserName, isAndroid }) => {+it('should tween mouse movement', async ({ page, browserName, isAndroid, headless }) => {it.skip(isAndroid, 'Bad rounding');+ it.skip(!headless, 'actual mouse interferes with the exact mousemove events');// The test becomes flaky on WebKit without next line.if (browserName === 'webkit')diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.tsindex d81470d5a2..9de325547a 100644--- a/tests/playwright-test/ui-mode-trace.spec.ts+++ b/tests/playwright-test/ui-mode-trace.spec.ts@@ -39,12 +39,12 @@ test('should merge trace events', async ({ runUITest }) => {listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Set content/,/Expect "toBe"/,/Click.*getByRole/,/Expect "toBe"/,- /After Hooks[\d.]+m?s/,+ /After Hooks/,]);});@@ -95,10 +95,10 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Set content/,/Expect "toBeVisible".*locator/,- /After Hooks[\d.]+m?s/,+ /After Hooks/,]);});@@ -120,12 +120,12 @@ test('should merge screenshot assertions', async ({ runUITest }) => {listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Set content/,- /Expect "toHaveScreenshot"[\d.]+m?s/,- /After Hooks[\d.]+m?s/,+ /Expect "toHaveScreenshot"/,+ /After Hooks/,/Attach "error-context"/,- /Worker Cleanup[\d.]+m?s/,+ /Worker Cleanup/,]);});@@ -169,11 +169,11 @@ test('should show snapshots for sync assertions', async ({ runUITest }) => {listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Set content/,/Click.*getByRole/,/Expect "toBe"/,- /After Hooks[\d.]+m?s/,+ /After Hooks/,]);await expect(@@ -209,11 +209,11 @@ test('should show snapshots for steps', {await expect(page.getByTestId('actions-tree')).toMatchAriaSnapshot(`- tree:- - treeitem /Before Hooks \\d+[hmsp]+/- - treeitem /first \\d+[hmsp]+/- - treeitem /middle \\d+[hmsp]+/- - treeitem /last \\d+[hmsp]+/- - treeitem /After Hooks \\d+[hmsp]+/+ - treeitem /Before Hooks/+ - treeitem /first/+ - treeitem /middle/+ - treeitem /last/+ - treeitem /After Hooks/`);await page.getByTestId('actions-tree').getByText('first').click();@@ -307,7 +307,7 @@ test('should not fail on internal page logs', async ({ runUITest, server }) => {listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Create context/,/Create page/,/Navigate to "\/empty.html"/,@@ -333,7 +333,7 @@ test('should not show caught errors in the errors tab', async ({ runUITest }, telistItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,+ /Before Hooks/,/Set content/,/Expect "toBeChecked".*locator/,/After Hooks/,@@ -509,10 +509,10 @@ test('should show custom fixture titles in actions tree', async ({ runUITest })await page.getByText('fixture test').dblclick();const listItem = page.getByTestId('actions-tree').getByRole('treeitem');await expect(listItem, 'action list').toHaveText([- /Before Hooks[\d.]+m?s/,- /Fixture "My Custom Fixture"[\d.]+m?s/,- /Fixture "fixture2"[\d.]+m?s/,- /After Hooks[\d.]+m?s/,+ /Before Hooks/,+ /Fixture "My Custom Fixture"/,+ /Fixture "fixture2"/,+ /After Hooks/,]);});@@ -531,9 +531,9 @@ line2\`);await page.getByText('multiline test').dblclick();const listItem = page.getByTestId('actions-tree').getByRole('treeitem');await expect(listItem, 'action list').toHaveText([- /Before Hooks[\d.]+m?s/,- /Type "line1\\nline2"[\d.]+m?s/,- /After Hooks[\d.]+m?s/,+ /Before Hooks/,+ /Type "line1\\nline2"/,+ /After Hooks/,]);});@@ -754,9 +754,9 @@ test('should be able to create and dispose APIRequestContext inside Promise.all'listItem,'action list').toHaveText([- /Before Hooks[\d.]+m?s/,- ...Array.from({ length: 100 }).map(() => /Create request context[\d.]+m?s/),- /After Hooks[\d.]+m?s/,+ /Before Hooks/,+ ...Array.from({ length: 100 }).map(() => /Create request context/),+ /After Hooks/,]);});