From bcb62de4b26caf107179ce280c989b85253cc5e6 Mon Sep 17 00:00:00 2001 From: Pavel Date: Fri, 6 Dec 2019 14:47:26 -0800 Subject: [PATCH] fix(test): make click tests pass everywhere --- src/dom.ts | 18 +++++++++--------- test/click.spec.js | 29 ++++++++++++----------------- 2 files changed, 21 insertions(+), 26 deletions(-) diff --git a/src/dom.ts b/src/dom.ts index 148f5cd6b0..46ebdb8586 100644 --- a/src/dom.ts +++ b/src/dom.ts @@ -275,17 +275,17 @@ export class ElementHandle extends js.JSHandle { point.y += border.y; } const metrics = await this._world.delegate.layoutViewport(); - // Give one extra pixel to avoid any issues on viewport edge. + // Give 6 (six) extra pixels to avoid any issues on viewport edge. let scrollX = 0; - if (point.x < 1) - scrollX = point.x - 1; - if (point.x > metrics.width - 1) - scrollX = point.x - metrics.width + 1; + if (point.x < 6) + scrollX = point.x - 6; + if (point.x > metrics.width - 6) + scrollX = point.x - metrics.width + 6; let scrollY = 0; - if (point.y < 1) - scrollY = point.y - 1; - if (point.y > metrics.height - 1) - scrollY = point.y - metrics.height + 1; + if (point.y < 6) + scrollY = point.y - 6; + if (point.y > metrics.height - 6) + scrollY = point.y - metrics.height + 6; return { point, scrollX, scrollY }; } diff --git a/test/click.spec.js b/test/click.spec.js index 536d35c3f1..af9d121fb2 100644 --- a/test/click.spec.js +++ b/test/click.spec.js @@ -78,7 +78,7 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME ]); expect(page.url()).toBe(server.PREFIX + '/wrappedlink.html#clicked'); }); - it.skip(FFOX)('should click when one of inline box children is outside of viewport', async({page, server}) => { + it('should click when one of inline box children is outside of viewport', async({page, server}) => { await page.setContent(`