-
-
Notifications
You must be signed in to change notification settings - Fork 0
fix: resolve Playwright browser executable not found errors in CI #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -121,7 +121,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| if: | | ||||||||||||||||||||||||||||||||||||||||||||||
| (github.event_name != 'workflow_dispatch') || | ||||||||||||||||||||||||||||||||||||||||||||||
| (github.event.inputs.browser == 'chromium' || github.event.inputs.browser == 'all') | ||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 30 | ||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 45 | ||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||
| CHARON_EMERGENCY_TOKEN: ${{ secrets.CHARON_EMERGENCY_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||
| CHARON_EMERGENCY_SERVER_ENABLED: "true" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -200,15 +200,29 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Playwright browsers | ||||||||||||||||||||||||||||||||||||||||||||||
| id: playwright-cache | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | ||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||
| path: ~/.cache/ms-playwright | ||||||||||||||||||||||||||||||||||||||||||||||
| key: playwright-chromium-${{ hashFiles('package-lock.json') }} | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install & verify Playwright Chromium | ||||||||||||||||||||||||||||||||||||||||||||||
| run: npx playwright install --with-deps chromium | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "⏳ Installing Playwright Chromium (with system dependencies)..." | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Start: $(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||||||||||||||||||||||||||||||||||||||||||||||
| npx playwright install --with-deps chromium | ||||||||||||||||||||||||||||||||||||||||||||||
| INSTALL_EXIT=$? | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Install exit code: $INSTALL_EXIT" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if [ $INSTALL_EXIT -ne 0 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "::error::Playwright Chromium installation failed" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Cache contents:" | ||||||||||||||||||||||||||||||||||||||||||||||
| ls -la ~/.cache/ms-playwright/ || echo "Cache directory empty" | ||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Verifying Chromium executable..." | ||||||||||||||||||||||||||||||||||||||||||||||
| if npx playwright test --list --project=chromium 2>&1 | grep -q "Chromium"; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Chromium executable verified" | ||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "::error::Chromium executable not found after installation" | ||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Completion: $(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Chromium tests (Shard ${{ matrix.shard }}/${{ matrix.total-shards }}) | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -284,7 +298,7 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| if: | | ||||||||||||||||||||||||||||||||||||||||||||||
| (github.event_name != 'workflow_dispatch') || | ||||||||||||||||||||||||||||||||||||||||||||||
| (github.event.inputs.browser == 'firefox' || github.event.inputs.browser == 'all') | ||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 30 | ||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 45 | ||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||
| CHARON_EMERGENCY_TOKEN: ${{ secrets.CHARON_EMERGENCY_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||
| CHARON_EMERGENCY_SERVER_ENABLED: "true" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -363,15 +377,29 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||
| - name: Install dependencies | ||||||||||||||||||||||||||||||||||||||||||||||
| run: npm ci | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Playwright browsers | ||||||||||||||||||||||||||||||||||||||||||||||
| id: playwright-cache | ||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 | ||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||
| path: ~/.cache/ms-playwright | ||||||||||||||||||||||||||||||||||||||||||||||
| key: playwright-firefox-${{ hashFiles('package-lock.json') }} | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install & verify Playwright Firefox | ||||||||||||||||||||||||||||||||||||||||||||||
| run: npx playwright install --with-deps firefox | ||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "⏳ Installing Playwright Firefox (with system dependencies)..." | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Start: $(date -u +'%Y-%m-%dT%H:%M:%SZ')" | ||||||||||||||||||||||||||||||||||||||||||||||
| npx playwright install --with-deps firefox | ||||||||||||||||||||||||||||||||||||||||||||||
| INSTALL_EXIT=$? | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Install exit code: $INSTALL_EXIT" | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| if [ $INSTALL_EXIT -ne 0 ]; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "::error::Playwright Firefox installation failed" | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "Cache contents:" | ||||||||||||||||||||||||||||||||||||||||||||||
| ls -la ~/.cache/ms-playwright/ || echo "Cache directory empty" | ||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Verifying Firefox executable..." | ||||||||||||||||||||||||||||||||||||||||||||||
| if npx playwright test --list --project=firefox 2>&1 | grep -q "Firefox"; then | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Firefox executable verified" | ||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||
| echo "::error::Firefox executable not found after installation" | ||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+395
to
+401
|
||||||||||||||||||||||||||||||||||||||||||||||
| echo "✅ Verifying Firefox executable..." | |
| if npx playwright test --list --project=firefox 2>&1 | grep -q "Firefox"; then | |
| echo "✅ Firefox executable verified" | |
| else | |
| echo "::error::Firefox executable not found after installation" | |
| exit 1 | |
| fi | |
| echo "✅ Verifying Firefox executable by launching a minimal browser instance..." | |
| node <<'EOF' | |
| (async () => { | |
| try { | |
| const { firefox } = require('playwright'); | |
| const browser = await firefox.launch(); | |
| const version = browser.version(); | |
| console.log(`✅ Firefox launched successfully (version: ${version})`); | |
| await browser.close(); | |
| } catch (error) { | |
| console.error('::error::Failed to launch Firefox via Playwright:', error); | |
| process.exit(1); | |
| } | |
| })(); | |
| EOF |
Copilot
AI
Feb 4, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same issue for WebKit: playwright test --list --project=webkit | grep "WebKit" is not a reliable signal that the WebKit browser executable is present/usable, and the grep match can be inconsistent. Consider replacing with a deterministic executable-path existence check (or minimal launch) so the workflow fails fast for the right reason and avoids accidental false negatives/positives.
| if npx playwright test --list --project=webkit 2>&1 | grep -q "WebKit"; then | |
| echo "✅ WebKit executable verified" | |
| else | |
| echo "::error::WebKit executable not found after installation" | |
| WEBKIT_CACHE_GLOB="$HOME/.cache/ms-playwright/webkit-*" | |
| if compgen -G "$WEBKIT_CACHE_GLOB" > /dev/null; then | |
| echo "✅ WebKit executable directory found:" | |
| ls -ld $WEBKIT_CACHE_GLOB || true | |
| else | |
| echo "::error::WebKit executable directory not found after installation" | |
| ls -la ~/.cache/ms-playwright/ || echo "Cache directory missing or empty" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The “verify executable” check is not reliable:
npx playwright test --list --project=chromiumonly lists tests and typically won’t validate that the Chromium browser binary exists/is runnable. Additionally, grepping for the string "Chromium" is brittle (output is often "chromium" or may not include the browser name at all), which can cause false passes or false failures in CI. Prefer verifying via Playwright’s executable path (e.g., querychromium.executablePath()and assert the file exists/is executable) or a minimal launch check instead of--list+grep.