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

deps(puppeteer): upgrade to 16.1.0 #14244

Merged
merged 16 commits into from
Aug 8, 2022
8 changes: 4 additions & 4 deletions core/scripts/benchmark-plus-extras.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ async function runOctane(page) {

process.stdout.write(`Running Octane...\n`);
await page.goto('https://chromium.github.io/octane/', {waitUntil: 'networkidle0'});
await page.waitFor('#run-octane');
await page.waitFor(5000);
await page.waitForSelector('#run-octane');
await page.waitForTimeout(5000);
page.on('console', pageLogger);
await page.click('#run-octane');
await page.waitForFunction(() => {
Expand All @@ -47,8 +47,8 @@ async function runOctane(page) {
async function runSpeedometer(page) {
process.stdout.write(`Running Speedometer...\n`);
await page.goto('https://browserbench.org/Speedometer2.0/', {waitUntil: 'networkidle0'});
await page.waitFor('#home button');
await page.waitFor(5000);
await page.waitForSelector('#home button');
await page.waitForTimeout(5000);
await page.click('#home button');

const loggerInterval = setInterval(async () => {
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"pako": "^2.0.3",
"preact": "^10.7.2",
"pretty-json-stringify": "^0.0.2",
"puppeteer": "13.7.0",
"puppeteer": "^16.1.0",
"resolve": "^1.20.0",
"rollup": "^2.52.7",
"rollup-plugin-node-resolve": "^5.2.0",
Expand Down Expand Up @@ -204,7 +204,7 @@
"open": "^8.4.0",
"parse-cache-control": "1.0.1",
"ps-list": "^8.0.0",
"puppeteer-core": "^13.7.0",
"puppeteer-core": "^16.1.0",
"robots-parser": "^3.0.0",
"semver": "^5.3.0",
"speedline-core": "^1.4.3",
Expand Down
15 changes: 12 additions & 3 deletions viewer/test/viewer-test-pptr.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,11 @@ describe('Lighthouse Viewer', () => {
it('should support saving as html', async () => {
const tmpDir = `${LH_ROOT}/.tmp/pptr-downloads`;
fs.rmSync(tmpDir, {force: true, recursive: true});
await viewerPage._client.send('Page.setDownloadBehavior', {
const session = await viewerPage.target().createCDPSession();
await session.send('Browser.setDownloadBehavior', {
behavior: 'allow',
downloadPath: tmpDir,
eventsEnabled: true,
});

await viewerPage.click('.lh-tools__button');
Expand All @@ -214,20 +216,27 @@ describe('Lighthouse Viewer', () => {
document.querySelector('.lh-tools__dropdown')).visibility === 'visible';
});

// For some reason, clicking this button doesn't always initiate the download after upgrading to Puppeteer 16.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why update this line? presumably the version it broke in is useful information.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't do a bisect to find the revision that broke it, this is just calling out the version upgrade that introduced the problem for us.

// As a workaround, we send another click signal 1s after the first to make sure the download starts.
// TODO: Find a more robust fix for this issue.
const timeoutHandle = setTimeout(() => viewerPage.click('a[data-action="save-html"]'), 1000);

const [, filename] = await Promise.all([
viewerPage.click('a[data-action="save-html"]'),
new Promise(resolve => {
viewerPage._client.on('Page.downloadWillBegin', ({suggestedFilename}) => {
session.on('Browser.downloadWillBegin', ({suggestedFilename}) => {
resolve(suggestedFilename);
});
}),
new Promise(resolve => {
viewerPage._client.on('Page.downloadProgress', ({state}) => {
session.on('Browser.downloadProgress', ({state}) => {
if (state === 'completed') resolve();
});
}),
]);

clearTimeout(timeoutHandle);

const savedPage = await browser.newPage();
const savedPageErrors = [];
savedPage.on('pageerror', pageError => savedPageErrors.push(pageError));
Expand Down
34 changes: 17 additions & 17 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,7 @@ delayed-stream@~1.0.0:
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=

devtools-protocol@0.0.981744, devtools-protocol@0.0.999451:
devtools-protocol@0.0.1019158, devtools-protocol@0.0.999451:
version "0.0.999451"
resolved "https://registry.yarnpkg.com/devtools-protocol/-/devtools-protocol-0.0.999451.tgz#7113f2a34beb69c688e5e247980a54b5589a62d2"
integrity sha512-6TGLxJjCO2Ap+YWukCriwuFGwEmKayZ5b4oGEYnHQv1rXgaJAhBIpTWJWwsv/EBQlyPVDBxYuz3SVRs7Heq3RA==
Expand Down Expand Up @@ -6072,14 +6072,14 @@ punycode@^2.1.0, punycode@^2.1.1:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

puppeteer-core@^13.7.0:
version "13.7.0"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-13.7.0.tgz#3344bee3994163f49120a55ddcd144a40575ba5b"
integrity sha512-rXja4vcnAzFAP1OVLq/5dWNfwBGuzcOARJ6qGV7oAZhnLmVRU8G5MsdeQEAOy332ZhkIOnn9jp15R89LKHyp2Q==
puppeteer-core@^16.1.0:
version "16.1.0"
resolved "https://registry.yarnpkg.com/puppeteer-core/-/puppeteer-core-16.1.0.tgz#0485312363e6e1d65889d4b31de677bd36f872e4"
integrity sha512-Eu9FCqdWU2PU/RY53sa+JTsbFiQg5fJyaHX5DP0WZ4+lVLVdMfR9dwPimRkSl9NEcArm7lZMpiDlVCYelE90ZA==
dependencies:
cross-fetch "3.1.5"
debug "4.3.4"
devtools-protocol "0.0.981744"
devtools-protocol "0.0.1019158"
extract-zip "2.0.1"
https-proxy-agent "5.0.1"
pkg-dir "4.2.0"
Expand All @@ -6088,16 +6088,16 @@ puppeteer-core@^13.7.0:
rimraf "3.0.2"
tar-fs "2.1.1"
unbzip2-stream "1.4.3"
ws "8.5.0"
ws "8.8.1"

puppeteer@13.7.0:
version "13.7.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-13.7.0.tgz#18e16f83e397cf02f7a0804c67c1603d381cfb0b"
integrity sha512-U1uufzBjz3+PkpCxFrWzh4OrMIdIb2ztzCu0YEPfRHjHswcSwHZswnK+WdsOQJsRV8WeTg3jLhJR4D867+fjsA==
puppeteer@^16.1.0:
version "16.1.0"
resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-16.1.0.tgz#06a32dc347c94642601017fbf83e1d37379b9651"
integrity sha512-lhykJLbH2bbBaP3NfYI2Vj0T4ctrdfVdEVf8glZITPnLfqrJ0nfUzAYuIz5YcA79k5lmFKANIhEXex+jQChU3g==
dependencies:
cross-fetch "3.1.5"
debug "4.3.4"
devtools-protocol "0.0.981744"
devtools-protocol "0.0.1019158"
extract-zip "2.0.1"
https-proxy-agent "5.0.1"
pkg-dir "4.2.0"
Expand All @@ -6106,7 +6106,7 @@ puppeteer@13.7.0:
rimraf "3.0.2"
tar-fs "2.1.1"
unbzip2-stream "1.4.3"
ws "8.5.0"
ws "8.8.1"

q@^1.5.1:
version "1.5.1"
Expand Down Expand Up @@ -7514,10 +7514,10 @@ write-file-atomic@^4.0.1:
imurmurhash "^0.1.4"
signal-exit "^3.0.7"

ws@8.5.0:
version "8.5.0"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f"
integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==
ws@8.8.1:
version "8.8.1"
resolved "https://registry.yarnpkg.com/ws/-/ws-8.8.1.tgz#5dbad0feb7ade8ecc99b830c1d77c913d4955ff0"
integrity sha512-bGy2JzvzkPowEJV++hF07hAD6niYSr0JzBNo/J29WsB57A2r7Wlc1UFcTR9IzrPvuNVO4B8LGqF8qcpsVOhJCA==

ws@>=7.4.6, ws@^7.0.0, ws@^7.3.1:
version "7.4.6"
Expand Down