test: make "outerWidth and outerHeight" test work on small screens (#14124)

This commit is contained in:
Dmitry Gozman 2022-05-12 18:46:03 +01:00 committed by GitHub
parent f562058805
commit 83d82fa466
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,7 @@ it('should set the proper viewport size', async ({ page, server }) => {
});
it('should return correct outerWidth and outerHeight', async ({ page }) => {
await page.setViewportSize({ width: 410, height: 420 });
const size = await page.evaluate(() => {
return {
innerWidth: window.innerWidth,
@ -38,8 +39,8 @@ it('should return correct outerWidth and outerHeight', async ({ page }) => {
outerHeight: window.outerHeight,
};
});
expect(size.innerWidth).toBe(1280);
expect(size.innerHeight).toBe(720);
expect(size.innerWidth).toBe(410);
expect(size.innerHeight).toBe(420);
expect(size.outerWidth >= size.innerWidth).toBeTruthy();
expect(size.outerHeight >= size.innerHeight).toBeTruthy();
});