Skip to content

Conversation

@Zemotacqy
Copy link
Contributor

Prepares for #34183

  • Part 1: Refactor browser listing methods
  • Part 2: Introduce install --list command

@github-actions
Copy link
Contributor

Test results for "tests 1"

4 failed
❌ [default] › run-tests.spec.ts:1305:5 › should provide page snapshot to copilot @vscode-extension
❌ [default-reuse] › run-tests.spec.ts:1305:5 › should provide page snapshot to copilot @vscode-extension
❌ [default-trace] › run-tests.spec.ts:1305:5 › should provide page snapshot to copilot @vscode-extension
❌ [webkit-library] › library/screenshot.spec.ts:205:14 › element screenshot › element screenshot should work with a mobile viewport @webkit-ubuntu-22.04-node18

6 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:986:7 › cli codegen › should not throw csp directive violation errors @firefox-ubuntu-22.04-node18
⚠️ [firefox-page] › page/page-wait-for-function.spec.ts:104:3 › should work with strict CSP policy @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › ui-mode-trace.spec.ts:396:5 › should work behind reverse proxy @macos-latest-node18-1
⚠️ [playwright-test] › ui-mode-test-output.spec.ts:80:5 › should show console messages for test @ubuntu-latest-node22-1
⚠️ [webkit-library] › library/browsercontext-device.spec.ts:45:5 › device › should scroll to click @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › library/ignorehttpserrors.spec.ts:30:3 › should isolate contexts @webkit-ubuntu-22.04-node18

39209 passed, 804 skipped
✔️✔️✔️

Merge workflow run.

Copy link
Member

@yury-s yury-s left a comment

Choose a reason for hiding this comment

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

It's not obvious to me that this refactoring actually improves anything. It may be easier to just include it into the PR that adds the command.


// Remove stale browsers.
await this._validateInstallationCache(linksDir);
const browserList: Array<{ browserName: string, browserVersion: number, hostDir: string, browserPath: string }> = await this._traverseBrowserInstallations(linksDir);
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't need explicit type declaration here.


// Remove stale browsers.
await this._validateInstallationCache(linksDir);
const browserList: Array<{ browserName: string, browserVersion: number, hostDir: string, browserPath: string }> = await this._traverseBrowserInstallations(linksDir);
Copy link
Member

Choose a reason for hiding this comment

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

ditto

if (!getAsBooleanFromENV('PLAYWRIGHT_SKIP_BROWSER_GC')) {
const usedBrowserPaths: Set<string> = new Set();
for (const browser of browserList) {
const browserName = browser.browserName;
Copy link
Member

Choose a reason for hiding this comment

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

    const { browserName, browserRevision, usedBrowserPath } = browser;

// We want a location that won't have a node_modules dir anywhere along its path
const tmpWorkspace = path.join(TMP_WORKSPACES, path.basename(test.info().outputDir));
await fs.promises.mkdir(tmpWorkspace);
await fs.promises.mkdir(tmpWorkspace, { recursive: true });
Copy link
Member

Choose a reason for hiding this comment

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

Why did this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was trying to run tests locally, and faced error while trying to create directory: /tmp/pwt/workspace. mkdir_p was the fix.

}

private async _deleteStaleBrowsers(browserList: Array<{ browserName: string, browserVersion: number, hostDir: string, browserPath: string }>) {
if (!getAsBooleanFromENV('PLAYWRIGHT_SKIP_BROWSER_GC')) {
Copy link
Member

Choose a reason for hiding this comment

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

Prefer early return.

@Zemotacqy
Copy link
Contributor Author

Thanks for the review: @yury-s . I would raise another PR with all the desired changes. Closing this for now.

@Zemotacqy Zemotacqy closed this May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants