From e1f018960f8c039b243478d5991873d3cfff0e1e Mon Sep 17 00:00:00 2001 From: Chris Johnson <49479599+workeffortwaste@users.noreply.github.com> Date: Thu, 10 Feb 2022 18:46:32 +0000 Subject: [PATCH] Fix for devices missing from puppeteer-extra --- layout-shift-gif.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/layout-shift-gif.js b/layout-shift-gif.js index c7b5936..0651876 100644 --- a/layout-shift-gif.js +++ b/layout-shift-gif.js @@ -45,8 +45,6 @@ const options = yargs(hideBin(process.argv)) .demandOption(['url']) .argv -const devices = puppeteer.devices - /* Network conditions */ const Good3G = { offline: false, @@ -56,7 +54,18 @@ const Good3G = { } /* Device for mobile emulation */ -const phone = devices['Nexus 5X'] +const phone = { + name: 'Nexus 5X', + userAgent: 'Mozilla/5.0 (Linux; Android 8.0.0; Nexus 5X Build/OPR4.170623.006) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.0 Mobile Safari/537.36', + viewport: { + width: 412, + height: 732, + deviceScaleFactor: 2.625, + isMobile: true, + hasTouch: true, + isLandscape: false + } +} /* Detect layout shift */ const clsDetection = (type) => {