@qawolf/browser
Advanced tools
Comparing version 0.7.10 to 0.7.11
@@ -1,3 +0,2 @@ | ||
import { Size } from "@qawolf/types"; | ||
import { devices } from "puppeteer"; | ||
export declare const getDevice: (size?: Size) => devices.Device; | ||
export declare const getDevice: (device?: string | devices.Device) => devices.Device; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const puppeteer_1 = require("puppeteer"); | ||
exports.getDevice = (size = "desktop") => { | ||
if (size === "desktop") { | ||
exports.getDevice = (device = "desktop") => { | ||
if (typeof device !== "string") { | ||
return device; | ||
} | ||
if (device === "desktop") { | ||
return { | ||
@@ -19,10 +22,7 @@ name: "Desktop", | ||
} | ||
if (size === "tablet") { | ||
return puppeteer_1.devices["iPad"]; | ||
if (puppeteer_1.devices[device]) { | ||
return puppeteer_1.devices[device]; | ||
} | ||
else if (size === "phone") { | ||
return puppeteer_1.devices["iPhone 7"]; | ||
} | ||
throw new Error(`invalid size ${size}`); | ||
throw new Error(`puppeteer.devices["${device}"] was not found`); | ||
}; | ||
//# sourceMappingURL=device.js.map |
@@ -1,2 +0,1 @@ | ||
import { Size } from "@qawolf/types"; | ||
import { LaunchOptions as PuppeteerLaunchOptions } from "puppeteer"; | ||
@@ -6,6 +5,5 @@ import { Device } from "puppeteer/DeviceDescriptors"; | ||
export declare type LaunchOptions = { | ||
device?: Device; | ||
device?: string | Device; | ||
domPath?: string; | ||
recordEvents?: boolean; | ||
size?: Size; | ||
url?: string; | ||
@@ -12,0 +10,0 @@ videoPath?: string; |
@@ -41,3 +41,3 @@ "use strict"; | ||
logger_1.logger.verbose(`launch: ${JSON.stringify(options)}`); | ||
const device = options.device || device_1.getDevice(options.size); | ||
const device = device_1.getDevice(options.device); | ||
const browser = (yield puppeteer_1.launch(buildPuppeteerOptions(options, device))); | ||
@@ -44,0 +44,0 @@ browser._close = browser.close; |
{ | ||
"name": "@qawolf/browser", | ||
"description": "qawolf browser manager", | ||
"version": "0.7.10", | ||
"version": "0.7.11", | ||
"license": "BSD-3.0", | ||
@@ -30,5 +30,5 @@ "main": "./lib/index.js", | ||
"@qawolf/logger": "^0.7.5", | ||
"@qawolf/screen": "^0.7.10", | ||
"@qawolf/types": "^0.7.10", | ||
"@qawolf/web": "^0.7.10", | ||
"@qawolf/screen": "^0.7.11", | ||
"@qawolf/types": "^0.7.11", | ||
"@qawolf/web": "^0.7.11", | ||
"fs-extra": "^8.1.0", | ||
@@ -43,3 +43,3 @@ "lodash": "^4.17.15", | ||
}, | ||
"gitHead": "add5be096ca054cbafcd440fac5e95f60098246f" | ||
"gitHead": "b874bee8d48fdadfcfc35fb0083f622074aab8ec" | ||
} |
@@ -1,6 +0,10 @@ | ||
import { Size } from "@qawolf/types"; | ||
import { devices } from "puppeteer"; | ||
import { Device } from "puppeteer/DeviceDescriptors"; | ||
export const getDevice = (size: Size = "desktop"): devices.Device => { | ||
if (size === "desktop") { | ||
export const getDevice = (device: string | Device = "desktop"): Device => { | ||
if (typeof device !== "string") { | ||
return device; | ||
} | ||
if (device === "desktop") { | ||
return { | ||
@@ -22,11 +26,7 @@ name: "Desktop", | ||
if (size === "tablet") { | ||
// https://gs.statcounter.com/screen-resolution-stats/tablet/worldwide | ||
return devices["iPad"]; | ||
} else if (size === "phone") { | ||
// https://deviceatlas.com/blog/most-popular-smartphones#us | ||
return devices["iPhone 7"]; | ||
if (devices[device]) { | ||
return devices[device]; | ||
} | ||
throw new Error(`invalid size ${size}`); | ||
throw new Error(`puppeteer.devices["${device}"] was not found`); | ||
}; |
import { CONFIG } from "@qawolf/config"; | ||
import { logger } from "@qawolf/logger"; | ||
import { ScreenCapture } from "@qawolf/screen"; | ||
import { Size } from "@qawolf/types"; | ||
import { platform } from "os"; | ||
@@ -18,6 +17,5 @@ import { basename } from "path"; | ||
export type LaunchOptions = { | ||
device?: Device; | ||
device?: string | Device; | ||
domPath?: string; | ||
recordEvents?: boolean; | ||
size?: Size; | ||
url?: string; | ||
@@ -60,3 +58,3 @@ videoPath?: string; | ||
const device = options.device || getDevice(options.size); | ||
const device = getDevice(options.device); | ||
@@ -63,0 +61,0 @@ const browser = (await launchPuppeteerBrowser( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
197743
3319
Updated@qawolf/screen@^0.7.11
Updated@qawolf/types@^0.7.11
Updated@qawolf/web@^0.7.11