diff --git a/tests/browsercontext-pages.spec.ts b/tests/browsercontext-pages.spec.ts index 48f5602626..4d5ceab181 100644 --- a/tests/browsercontext-pages.spec.ts +++ b/tests/browsercontext-pages.spec.ts @@ -108,6 +108,29 @@ it('should click the button with offset with page scale', async ({browser, serve await context.close(); }); +it('should return bounding box with page scale', async ({ browser, server, browserName }) => { + it.skip(browserName === 'firefox'); + + const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true }); + const page = await context.newPage(); + await page.goto(server.PREFIX + '/input/button.html'); + const button = await page.$('button'); + await button.evaluate(button => { + document.body.style.margin = '0'; + button.style.borderWidth = '0'; + button.style.width = '200px'; + button.style.height = '20px'; + button.style.marginLeft = '17px'; + button.style.marginTop = '23px'; + }); + const box = await button.boundingBox(); + expect(Math.round(box.x * 100)).toBe(17 * 100); + expect(Math.round(box.y * 100)).toBe(23 * 100); + expect(Math.round(box.width * 100)).toBe(200 * 100); + expect(Math.round(box.height * 100)).toBe(20 * 100); + await context.close(); +}); + it('should not leak listeners during navigation of 20 pages', async ({contextFactory, server}) => { it.slow('We open 20 pages here!'); diff --git a/tests/page/elementhandle-bounding-box.spec.ts b/tests/page/elementhandle-bounding-box.spec.ts index 17f8e259c3..805fe08c3f 100644 --- a/tests/page/elementhandle-bounding-box.spec.ts +++ b/tests/page/elementhandle-bounding-box.spec.ts @@ -16,7 +16,6 @@ */ import { test as it, expect } from './pageTest'; -import { browserTest } from '../config/browserTest'; it.skip(({ isAndroid }) => isAndroid); @@ -88,29 +87,6 @@ it('should work with SVG nodes', async ({ page, server }) => { expect(pwBoundingBox).toEqual(webBoundingBox); }); -browserTest('should work with page scale', async ({ browser, server, browserName }) => { - browserTest.skip(browserName === 'firefox'); - - const context = await browser.newContext({ viewport: { width: 400, height: 400 }, isMobile: true }); - const page = await context.newPage(); - await page.goto(server.PREFIX + '/input/button.html'); - const button = await page.$('button'); - await button.evaluate(button => { - document.body.style.margin = '0'; - button.style.borderWidth = '0'; - button.style.width = '200px'; - button.style.height = '20px'; - button.style.marginLeft = '17px'; - button.style.marginTop = '23px'; - }); - const box = await button.boundingBox(); - expect(Math.round(box.x * 100)).toBe(17 * 100); - expect(Math.round(box.y * 100)).toBe(23 * 100); - expect(Math.round(box.width * 100)).toBe(200 * 100); - expect(Math.round(box.height * 100)).toBe(20 * 100); - await context.close(); -}); - it('should work when inline box child is outside of viewport', async ({ page, server }) => { await page.setContent(`