Skip to content

Commit

Permalink
Fix for devices missing from puppeteer-extra
Browse files Browse the repository at this point in the history
  • Loading branch information
workeffortwaste committed Feb 10, 2022
1 parent 5f76d24 commit e1f0189
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions layout-shift-gif.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ const options = yargs(hideBin(process.argv))
.demandOption(['url'])
.argv

const devices = puppeteer.devices

/* Network conditions */
const Good3G = {
offline: false,
Expand All @@ -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) => {
Expand Down

0 comments on commit e1f0189

Please sign in to comment.