mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
Seven QA scripts hard-coded macOS Google Chrome. They now share chromeExecutablePath(): PUPPETEER_EXECUTABLE_PATH when set, then macOS Chrome when installed, otherwise Puppeteer's managed browser. The cables screenshot path is built with fileURLToPath so it works on Windows. qa-overlay-baseline keeps its fixed Chrome because its baselines record the executable. Co-authored-by: Sameh Khamis <[email protected]>
21 lines
685 B
JavaScript
21 lines
685 B
JavaScript
/**
|
|
* The browser for gates that drive an installed Chrome. These gates were
|
|
* written against macOS Google Chrome, which Windows and Linux do not have.
|
|
*/
|
|
import { existsSync } from 'node:fs';
|
|
|
|
export const MACOS_CHROME =
|
|
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
|
|
|
|
/**
|
|
* PUPPETEER_EXECUTABLE_PATH when set, then macOS Google Chrome when it is
|
|
* installed. Otherwise undefined, so Puppeteer launches the browser it manages.
|
|
*/
|
|
export function chromeExecutablePath({
|
|
env = process.env,
|
|
exists = existsSync,
|
|
} = {}) {
|
|
if (env.PUPPETEER_EXECUTABLE_PATH) return env.PUPPETEER_EXECUTABLE_PATH;
|
|
return exists(MACOS_CHROME) ? MACOS_CHROME : undefined;
|
|
}
|