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(click): revert layout shift logic (#10653)
Dmitry Gozman6e00af3b2ecd
diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.tsindex 18545e677f..9a261d50a1 100644--- a/packages/playwright-core/src/server/dom.ts+++ b/packages/playwright-core/src/server/dom.ts@@ -407,7 +407,7 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {const point = roundPoint(maybePoint);progress.metadata.point = point;- if (process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK)+ if (!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK)return this._finishPointerAction(progress, actionName, point, options, action);elsereturn this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);diff --git a/tests/hit-target.spec.ts b/tests/hit-target.spec.tsindex 04f857e3eb..e0afbfc557 100644--- a/tests/hit-target.spec.ts+++ b/tests/hit-target.spec.ts@@ -45,6 +45,8 @@ it('should block all events when hit target is wrong', async ({ page, server })});it('should block click when mousedown succeeds but mouseup fails', async ({ page, server }) => {+ it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);+await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => {button.addEventListener('mousedown', () => {@@ -82,6 +84,8 @@ it('should click when element detaches in mousedown', async ({ page, server }) =});it('should not block programmatic events', async ({ page, server }) => {+ it.skip(!process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK);+await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => {button.addEventListener('mousedown', () => {diff --git a/tests/tap.spec.ts b/tests/tap.spec.tsindex ad080b059a..6536c7a45d 100644--- a/tests/tap.spec.ts+++ b/tests/tap.spec.ts@@ -48,7 +48,7 @@ it('trial run should not tap', async ({ page }) => {await page.tap('#a');const eventsHandle = await trackEvents(await page.$('#b'));await page.tap('#b', { trial: true });- const expected = process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];+ const expected = !process.env.PLAYWRIGHT_LAYOUT_SHIFT_CHECK ? [] : ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];expect(await eventsHandle.jsonValue()).toEqual(expected);});