Skip to content

Commit 14abf39

Browse files
committed
chore(ci): harden browser detection for dnd e2e
1 parent 9e4a1cd commit 14abf39

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ jobs:
112112
run: |
113113
if command -v google-chrome >/dev/null 2>&1; then
114114
echo "PUPPETEER_EXECUTABLE_PATH=$(command -v google-chrome)" >> "$GITHUB_ENV"
115+
elif command -v google-chrome-stable >/dev/null 2>&1; then
116+
echo "PUPPETEER_EXECUTABLE_PATH=$(command -v google-chrome-stable)" >> "$GITHUB_ENV"
115117
elif command -v chromium-browser >/dev/null 2>&1; then
116118
echo "PUPPETEER_EXECUTABLE_PATH=$(command -v chromium-browser)" >> "$GITHUB_ENV"
117119
elif command -v chromium >/dev/null 2>&1; then

frontend/scripts/dnd-reorder-regression.mjs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import http from 'node:http'
22
import { spawn } from 'node:child_process'
3+
import fs from 'node:fs'
34
import path from 'node:path'
45
import process from 'node:process'
56
import { fileURLToPath } from 'node:url'
@@ -81,7 +82,22 @@ const sendJson = (res, statusCode, payload) => {
8182
const getBrowserExecutablePath = () => {
8283
const fromEnv = process.env.PUPPETEER_EXECUTABLE_PATH
8384
if (fromEnv) return fromEnv
84-
if (process.platform === 'linux') return '/usr/bin/chromium'
85+
if (process.platform === 'linux') {
86+
const candidates = [
87+
'/usr/bin/google-chrome',
88+
'/usr/bin/google-chrome-stable',
89+
'/usr/bin/chromium-browser',
90+
'/usr/bin/chromium',
91+
]
92+
for (const candidate of candidates) {
93+
try {
94+
fs.accessSync(candidate, fs.constants.X_OK)
95+
return candidate
96+
} catch {
97+
// keep searching
98+
}
99+
}
100+
}
85101
return undefined
86102
}
87103

0 commit comments

Comments
 (0)