Skip to content

Commit

Permalink
test: add a test for screen.avail{Width,Height} emulation (#4011)
Browse files Browse the repository at this point in the history
This currently does not work in WebKit.
  • Loading branch information
dgozman authored Sep 30, 2020
1 parent e280839 commit ccc827c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/browsercontext-viewport.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ it('should emulate device height', async ({page, server}) => {
expect(await page.evaluate(() => matchMedia('(device-height: 500px)').matches)).toBe(true);
});

it('should emulate availWidth and availHeight', (test, { browserName, platform }) => {
test.fail(browserName === 'webkit' && platform !== 'linux', 'Not implemented');
}, async ({page}) => {
await page.setViewportSize({width: 500, height: 600});
expect(await page.evaluate(() => window.screen.availWidth)).toBe(500);
expect(await page.evaluate(() => window.screen.availHeight)).toBe(600);
});

it('should not have touch by default', async ({page, server}) => {
await page.goto(server.PREFIX + '/mobile.html');
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);
Expand Down

0 comments on commit ccc827c

Please sign in to comment.