UNPKG

playwright-fluent

Version:
38 lines (37 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const playwright_fluent_1 = require("../../playwright-fluent"); const devices_1 = require("../../../devices"); describe.skip('Playwright Fluent - emulateDevice', () => { let p; beforeEach(() => { p = new playwright_fluent_1.PlaywrightFluent(); }); afterEach(async () => { await p.close(); }); test('should target webkit in headfull mode with simulated device', async () => { // Given const browser = 'webkit'; const options = { headless: false, }; const device = (0, devices_1.getDevice)('iPhone 6 landscape') || devices_1.defaultDevice; const url = 'https://reactstrap.github.io'; // When await p .withBrowser(browser) .withOptions(options) .emulateDevice('iPhone 6 landscape') .navigateTo(url) .wait(5000); // Then const windowState = await p.getCurrentWindowState(); expect(Math.abs(windowState.innerWidth - device.viewport.width)).toBeLessThanOrEqual(10); expect(Math.abs(windowState.innerHeight - device.viewport.height)).toBeLessThanOrEqual(10); // Then default viewport should have (almost) the same size as the browser window // const viewport = { width: windowState.innerWidth, height: windowState.innerHeight }; // expect(Math.abs(viewport.height - windowState.outerHeight)).toBeLessThanOrEqual(132); // expect(Math.abs(viewport.width - windowState.outerWidth)).toBeLessThanOrEqual(20); }); });