test(browser): harden Chrome startup on CI
This commit is contained in:
@@ -30,3 +30,4 @@ jobs:
|
|||||||
- run: npm run verify:browser
|
- run: npm run verify:browser
|
||||||
env:
|
env:
|
||||||
REA_BROWSER_EXECUTABLE: /usr/bin/google-chrome
|
REA_BROWSER_EXECUTABLE: /usr/bin/google-chrome
|
||||||
|
REA_BROWSER_NO_SANDBOX: "true"
|
||||||
|
|||||||
@@ -38,6 +38,9 @@ try {
|
|||||||
executable,
|
executable,
|
||||||
[
|
[
|
||||||
"--headless=new",
|
"--headless=new",
|
||||||
|
...(process.env.REA_BROWSER_NO_SANDBOX === "true"
|
||||||
|
? ["--no-sandbox"]
|
||||||
|
: []),
|
||||||
"--remote-debugging-address=127.0.0.1",
|
"--remote-debugging-address=127.0.0.1",
|
||||||
"--remote-debugging-port=0",
|
"--remote-debugging-port=0",
|
||||||
`--user-data-dir=${profile}`,
|
`--user-data-dir=${profile}`,
|
||||||
@@ -45,6 +48,7 @@ try {
|
|||||||
"--no-default-browser-check",
|
"--no-default-browser-check",
|
||||||
"--disable-background-networking",
|
"--disable-background-networking",
|
||||||
"--disable-component-update",
|
"--disable-component-update",
|
||||||
|
"--disable-dev-shm-usage",
|
||||||
"--disable-sync",
|
"--disable-sync",
|
||||||
"--metrics-recording-only",
|
"--metrics-recording-only",
|
||||||
`${site.origin}/app?startup=browser-secret-value`,
|
`${site.origin}/app?startup=browser-secret-value`,
|
||||||
@@ -309,7 +313,7 @@ async function browserExecutable() {
|
|||||||
|
|
||||||
async function devtoolsPort(profile, child, stderr) {
|
async function devtoolsPort(profile, child, stderr) {
|
||||||
const activePort = join(profile, "DevToolsActivePort");
|
const activePort = join(profile, "DevToolsActivePort");
|
||||||
for (let attempt = 0; attempt < 200; attempt += 1) {
|
for (let attempt = 0; attempt < 600; attempt += 1) {
|
||||||
if (child.exitCode !== null)
|
if (child.exitCode !== null)
|
||||||
throw new Error(`Chrome exited before CDP startup: ${stderr()}`);
|
throw new Error(`Chrome exited before CDP startup: ${stderr()}`);
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user