Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: migrate puppeteer@22 #567

Merged
merged 5 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- master

env:
PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD: true

jobs:
contributors:
if: "${{ github.event.head_commit.message != 'build: contributors' }}"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- master

env:
PUPPETEER_SKIP_CHROME_HEADLESS_SHELL_DOWNLOAD: true

jobs:
matrix:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Every browser context is isolated. They won't share cookies/cache with other bro

#### options

Any [browser.createIncognitoBrowserContext#options](https://pptr.dev/next/api/puppeteer.browsercontextoptions) can be passed.
Any [browser.createBrowserContext#options](https://pptr.dev/next/api/puppeteer.browsercontextoptions) can be passed.

Additionally, you can setup:

Expand Down Expand Up @@ -437,7 +437,7 @@ browserless.getDevice({ device: 'Macbook Pro 15' })
// }
```

It extends from [puppeteer.devices](https://github.com/puppeteer/puppeteer/blob/master/docs/api.md#puppeteerdevices), adding some missing devices there.
It extends from [puppeteer.KnownDevices](https://pptr.dev/api/puppeteer.knowndevices/), adding some missing devices there.

#### options

Expand Down Expand Up @@ -716,7 +716,7 @@ Wait a quantity of time, selector or function using [page.waitForSelector](https

type:`number`

Wait a quantity of time, selector or function using [page.waitForTimeout](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfortimeoutmilliseconds).
Wait a quantity time in milliseconds.

##### waitUntil

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
"dev": "concurrently \"gulp\" \"npm run dev:server\"",
"dev:server": "browser-sync start --server --files \"index.html, README.md, static/**/*.(css|js)\"",
"lint": "standard",
"postinstall": "node node_modules/puppeteer/install.mjs",
"prerelease": "pnpm run update:check",
"pretest": "pnpm run lint",
"release": "lerna publish --yes --sort --conventional-commits -m \"chore(release): %s\" --create-release github",
Expand Down
Binary file added packages/browserless/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion packages/browserless/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest",
"ava": "5",
"ps-list": "7",
"tinyspawn": "latest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/browserless/src/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const spawn = ({
puppeteer = requireOneOf(['puppeteer', 'puppeteer-core', 'puppeteer-firefox']),
mode = 'launch',
args = defaultArgs,
headless = 'new',
headless = true,
...launchOpts
} = {}) => puppeteer[mode]({ ignoreHTTPSErrors: true, args, headless, ...launchOpts })

Expand Down
2 changes: 1 addition & 1 deletion packages/browserless/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ module.exports = ({ timeout: globalTimeout = 30000, ...launchOpts } = {}) => {
let browserProcessPromise = spawn()

const createBrowserContext = contextOpts =>
getBrowser().then(browser => browser.createIncognitoBrowserContext(contextOpts))
getBrowser().then(browser => browser.createBrowserContext(contextOpts))

const getBrowser = async () => {
if (isClosed) return browserProcessPromise
Expand Down
2 changes: 1 addition & 1 deletion packages/devices/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"require-one-of": "~1.0.19"
},
"devDependencies": {
"ava": "latest",
"ava": "5",
"lodash": "latest"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/devices/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = ({
puppeteer = requireOneOf(['puppeteer', 'puppeteer-core', 'puppeteer-firefox']),
lossyDeviceName = true
} = {}) => {
const { devices: puppeteerDevices } = puppeteer
const { KnownDevices: puppeteerDevices } = puppeteer
const devices = { ...puppeteerDevices, ...customDevices }
const deviceDescriptors = Object.keys(devices)

Expand Down
2 changes: 1 addition & 1 deletion packages/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"whoops": "~4.1.7"
},
"devDependencies": {
"ava": "latest"
"ava": "5"
},
"engines": {
"node": ">= 12"
Expand Down
2 changes: 1 addition & 1 deletion packages/function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest",
"ava": "5",
"browserless": "^10.2.6",
"lodash": "latest"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/goto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest",
"ava": "5",
"p-wait-for": "3"
},
"engines": {
Expand Down
10 changes: 6 additions & 4 deletions packages/goto/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

const { PuppeteerBlocker } = require('@cliqz/adblocker-puppeteer')
const { shallowEqualObjects } = require('shallow-equal')
const { setTimeout } = require('node:timers/promises')
const createDevices = require('@browserless/devices')
const toughCookie = require('tough-cookie')
const pReflect = require('p-reflect')
Expand Down Expand Up @@ -203,7 +204,6 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
waitForFunction,
waitForSelector,
waitForTimeout,
waitForXPath,
waitUntil = 'auto',
waitUntilAuto = _waitUntilAuto,
onPageRequest,
Expand Down Expand Up @@ -370,15 +370,17 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..

for (const [key, value] of Object.entries({
waitForSelector,
waitForXPath,
waitForFunction,
waitForTimeout
waitForFunction
})) {
if (value) {
await run({ fn: page[key](value), timeout: gotoTimeout, debug: { [key]: value } })
}
}

if (waitForTimeout) {
await setTimeout(waitForTimeout)
}

await inject(page, {
timeout: actionTimeout,
mediaType,
Expand Down
2 changes: 1 addition & 1 deletion packages/lighthouse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest"
"ava": "5"
},
"engines": {
"node": ">= 12"
Expand Down
2 changes: 1 addition & 1 deletion packages/screencast/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest",
"ava": "5",
"file-type": "16"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/screenshot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
},
"devDependencies": {
"@browserless/test": "^10.2.4",
"ava": "latest",
"ava": "5",
"cheerio": "latest"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/screenshot/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ test('graphics features', async t => {
'Canvas out-of-process rasterization': 'Disabled',
'Direct Rendering Display Compositor': 'Disabled',
Compositing: 'Software only. Hardware acceleration disabled',
'Multiple Raster Threads': 'Disabled',
'Multiple Raster Threads': 'Enabled',
OpenGL: 'Disabled',
Rasterization: 'Software only. Hardware acceleration disabled',
'Raw Draw': 'Disabled',
Expand Down
4 changes: 2 additions & 2 deletions packages/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
"test"
],
"devDependencies": {
"ava": "latest",
"ava": "5",
"browserless": "latest",
"fs-extra": "latest",
"img-diff-js": "latest",
"pdf-parse": "latest",
"puppeteer": "~21.10.0",
"puppeteer": "~22.0.0",
"signal-exit": "latest",
"temperment": "latest"
},
Expand Down