diff --git a/lib/ExecutionContext.js b/lib/ExecutionContext.js index c2460bc488a8c..25ed67e1a4be1 100644 --- a/lib/ExecutionContext.js +++ b/lib/ExecutionContext.js @@ -626,7 +626,7 @@ function computeQuadArea(quad) { const p2 = quad[(i + 1) % quad.length]; area += (p1.x * p2.y - p2.x * p1.y) / 2; } - return area; + return Math.abs(area); } helper.tracePublicAPI(ElementHandle); diff --git a/test/assets/input/rotatedButton.html b/test/assets/input/rotatedButton.html new file mode 100644 index 0000000000000..1bce66cf5e261 --- /dev/null +++ b/test/assets/input/rotatedButton.html @@ -0,0 +1,21 @@ + + + + Rotated button test + + + + + + + + diff --git a/test/input.spec.js b/test/input.spec.js index 5a583e00c2ec5..dda263b611600 100644 --- a/test/input.spec.js +++ b/test/input.spec.js @@ -312,6 +312,11 @@ module.exports.addTests = function({testRunner, expect}) { await page.click('button'); expect(await page.evaluate(() => window.result)).toBe('Clicked'); }); + it('should click a rotated button', async({page, server}) => { + await page.goto(server.PREFIX + '/input/rotatedButton.html'); + await page.click('button'); + expect(await page.evaluate(() => result)).toBe('Clicked'); + }); it('should select the text with mouse', async({page, server}) => { await page.goto(server.PREFIX + '/input/textarea.html'); await page.focus('textarea');