Skip to content

Commit

Permalink
feat(all): use the latest version of puppeteer
Browse files Browse the repository at this point in the history
Summary:
Update MemLab OSS to use the latest version of puppeteer.

Related #89

Differential Revision: D48304768

fbshipit-source-id: 62a6b05025b965dcbde6348043120884a14263ac
  • Loading branch information
JacksonGL authored and facebook-github-bot committed Aug 14, 2023
1 parent 99fafbd commit 872b302
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 108 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -22,7 +22,7 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"jest": "^29.6.2",
"typescript": "^4.6.3"
},
"scripts": {
Expand Down
7 changes: 4 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -46,8 +47,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"repository": {
Expand Down
82 changes: 0 additions & 82 deletions packages/api/src/__tests__/API/E2EFindWebWorkerLeaks.test.ts

This file was deleted.

7 changes: 4 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -48,8 +49,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/options/e2e/SetDeviceOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const devices = constant.isFRL
: constant.isFB
? require('puppeteer-core/DeviceDescriptors')
: // eslint-disable-next-line @typescript-eslint/no-var-requires
require('puppeteer').devices;
require('puppeteer').KnownDevices;

export default class SetDeviceOption extends BaseOption {
getOptionName(): string {
Expand Down
7 changes: 4 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -47,8 +48,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"repository": {
Expand Down
7 changes: 4 additions & 3 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0",
Expand All @@ -44,8 +45,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/e2e/src/lib/operations/ClickOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @oncall web_perf_infra
*/

import type {Page} from 'puppeteer';
import type {ElementHandle, Page} from 'puppeteer';
import type {AnyOptions, Optional} from '@memlab/core';

import {info, config, utils} from '@memlab/core';
Expand Down Expand Up @@ -106,7 +106,7 @@ class ClickOperation extends BaseOperation {
if (idx < 0 || idx >= elems.length) {
utils.haltOrThrow(`clicking ${idx + 1}-th element, which doesn't exist`);
}
await elems[idx].click({clickCount});
await (elems[idx] as ElementHandle<Element>).click({clickCount});
await Promise.all(elems.map(e => e.dispose()));
}

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e/src/lib/operations/InteractionUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ async function getElementsContainingText(
): Promise<ElementHandle<Element>[]> {
const xpath = `//*[not(self::script)][contains(text(), '${text}')]`;
const elements = await page.$x(xpath);
return elements;
return elements as ElementHandle<Element>[];
}

export default {
Expand Down
6 changes: 4 additions & 2 deletions packages/e2e/src/lib/operations/UploadOperation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* @oncall web_perf_infra
*/

import type {Page} from 'puppeteer';
import type {ElementHandle, Page} from 'puppeteer';

import path from 'path';
import {config, utils} from '@memlab/core';
Expand Down Expand Up @@ -37,7 +37,9 @@ class UploadOperation extends BaseOperation {
async act(page: Page): Promise<void> {
this.log(`uploading file ${this.file}...`);

const uploadHandle = await page.$(this.selector);
const uploadHandle = (await page.$(
this.selector,
)) as ElementHandle<HTMLInputElement>;
if (!uploadHandle) {
throw utils.haltOrThrow(
`upload failed, selector not found: ${this.selector}`,
Expand Down
7 changes: 4 additions & 3 deletions packages/heap-analysis/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -38,8 +39,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"repository": {
Expand Down
7 changes: 4 additions & 3 deletions packages/memlab/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"chalk": "^4.0.0",
"fs-extra": "^4.0.2",
"minimist": "^1.2.0",
"puppeteer": "^13.5.1",
"puppeteer": "^21.0.3",
"puppeteer-core": "^21.0.3",
"string-width": "^4.2.0",
"util.promisify": "^1.1.1",
"xvfb": "^0.4.0"
Expand All @@ -47,8 +48,8 @@
"@types/minimist": "^1.2.2",
"@types/node": "^12.16.3",
"@types/puppeteer": "^5.4.4",
"jest": "^27.5.1",
"ts-jest": "^27.1.4",
"jest": "^29.6.2",
"ts-jest": "^29.1.1",
"typescript": "^4.6.3"
},
"scripts": {
Expand Down

0 comments on commit 872b302

Please sign in to comment.