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
chore: remove env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK (#12605)
Dmitry Gozman62a032baa08f
diff --git a/packages/playwright-core/src/server/dom.ts b/packages/playwright-core/src/server/dom.tsindex 62d8f44564..dee816e81a 100644--- a/packages/playwright-core/src/server/dom.ts+++ b/packages/playwright-core/src/server/dom.ts@@ -418,52 +418,6 @@ export class ElementHandle<T extends Node = Node> extends js.JSHandle<T> {return maybePoint;const point = roundPoint(maybePoint);progress.metadata.point = point;-- if (process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK)- return this._finishPointerAction(progress, actionName, point, options, action);- else- return this._finishPointerActionDetectLayoutShift(progress, actionName, point, options, action);- }-- private async _finishPointerAction(progress: Progress, actionName: ActionName, point: types.Point, options: types.PointerActionOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions, action: (point: types.Point) => Promise<void>): Promise<'error:notconnected' | { hitTargetDescription: string } | 'done'> {- if (!options.force) {- if ((options as any).__testHookBeforeHitTarget)- await (options as any).__testHookBeforeHitTarget();- progress.log(` checking that element receives pointer events at (${point.x},${point.y})`);- const hitTargetResult = await this._checkHitTargetAt(point);- if (hitTargetResult !== 'done')- return hitTargetResult;- progress.log(` element does receive pointer events`);- }-- if (options.trial) {- progress.log(` trial ${actionName} has finished`);- return 'done';- }-- await progress.beforeInputAction(this);- await this._page._frameManager.waitForSignalsCreatedBy(progress, options.noWaitAfter, async () => {- if ((options as any).__testHookBeforePointerAction)- await (options as any).__testHookBeforePointerAction();- progress.throwIfAborted(); // Avoid action that has side-effects.- let restoreModifiers: types.KeyboardModifier[] | undefined;- if (options && options.modifiers)- restoreModifiers = await this._page.keyboard._ensureModifiers(options.modifiers);- progress.log(` performing ${actionName} action`);- await action(point);- progress.log(` ${actionName} action done`);- progress.log(' waiting for scheduled navigations to finish');- if ((options as any).__testHookAfterPointerAction)- await (options as any).__testHookAfterPointerAction();- if (restoreModifiers)- await this._page.keyboard._ensureModifiers(restoreModifiers);- }, 'input');- progress.log(' navigations have finished');-- return 'done';- }-- private async _finishPointerActionDetectLayoutShift(progress: Progress, actionName: ActionName, point: types.Point, options: types.PointerActionOptions & types.PointerActionWaitOptions & types.NavigatingActionWaitOptions, action: (point: types.Point) => Promise<void>): Promise<'error:notconnected' | { hitTargetDescription: string } | 'done'> {await progress.beforeInputAction(this);let hitTargetInterceptionHandle: js.JSHandle<HitTargetInterceptionResult> | undefined;diff --git a/tests/hit-target.spec.ts b/tests/hit-target.spec.tsindex e6f3eb5fa0..dc499bd593 100644--- a/tests/hit-target.spec.ts+++ b/tests/hit-target.spec.ts@@ -49,8 +49,6 @@ it('should block all events when hit target is wrong', async ({ page, server })});it('should block click when mousedown fails', async ({ page, server }) => {- it.skip(!!process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK);-await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => {button.addEventListener('mousemove', () => {@@ -118,8 +116,6 @@ it('should block all events when hit target is wrong and element detaches', asyn});it('should not block programmatic events', async ({ page, server }) => {- it.skip(!!process.env.PLAYWRIGHT_NO_LAYOUT_SHIFT_CHECK);-await page.goto(server.PREFIX + '/input/button.html');await page.$eval('button', button => {button.addEventListener('mousemove', () => {diff --git a/tests/tap.spec.ts b/tests/tap.spec.tsindex b898045d94..e5559b01cd 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 = ['pointerover', 'pointerenter', 'pointerout', 'pointerleave'];expect(await eventsHandle.jsonValue()).toEqual(expected);});