From cd05efe26524369ad0658e0bd0fac77ffbc82806 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Tue, 9 Jan 2024 19:22:56 +0000 Subject: [PATCH] chore(firefox): rewrite error message for $HOME directory ownership mismatch --- packages/playwright-core/src/server/firefox/firefox.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/playwright-core/src/server/firefox/firefox.ts b/packages/playwright-core/src/server/firefox/firefox.ts index 90a03b7bf94a4..96d1edae4c04f 100644 --- a/packages/playwright-core/src/server/firefox/firefox.ts +++ b/packages/playwright-core/src/server/firefox/firefox.ts @@ -40,6 +40,9 @@ export class Firefox extends BrowserType { _doRewriteStartupLog(error: ProtocolError): ProtocolError { if (!error.logs) return error; + // https://github.com/microsoft/playwright/issues/6500 + if (error.logs.includes(`as root in a regular user's session is not supported.`)) + error.logs = '\n' + wrapInASCIIBox(`Firefox is unable to launch if the $HOME folder isn't owned by the current user.\nWorkaround: Set the HOME=/root environment variable${process.env.GITHUB_ACTION ? ' in your GitHub Actions workflow file' : ''} when running Playwright.`, 1); if (error.logs.includes('no DISPLAY environment variable specified')) error.logs = '\n' + wrapInASCIIBox(kNoXServerRunningError, 1); return error;