test: fix android test failure (#6487)

This commit is contained in:
Dmitry Gozman 2021-05-10 11:07:56 -07:00 committed by GitHub
parent f1a888de02
commit 00ec43974d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 24 deletions

View File

@ -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!');

View File

@ -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(`
<style>