Fix Playwright test hangs: Chrome extensions require non-headless mode#2303
Fix Playwright test hangs: Chrome extensions require non-headless mode#2303
Conversation
- Add check for blob-reports existence before merging - Create all-blob-reports directory if it doesn't exist - Skip merge steps if no reports were downloaded - Ensure screenshots directory exists before upload - Handle missing directories in grep and cat commands - Fix potential failures when download-artifact finds no matching artifacts Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
Add additional check to ensure directory contains files before running grep Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
|
@copilot Actionlint is failing, please check and fix. |
Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
... Fixed actionlint errors in commit 7d5a194 by quoting Regarding the test stalling - my changes only modified the merge job (lines 123-215), not the test execution steps. The test command The current test run (21898794436) has been running for ~20 minutes (started 09:05-09:06, still in_progress). This appears to be run attempt 2, suggesting the first attempt may have been cancelled. I see recent workflow runs on master are also showing similar patterns (null/in_progress status). Can you check if this is a pre-existing issue or if you'd like me to investigate further? The test execution step is outside the scope of my artifact handling fixes. |
Playwright screenshots hang when the page is not in the foreground. This was causing all 5 test shards to stall indefinitely. Added await page.bringToFront() before all toHaveScreenshot() calls to ensure the page is in the foreground before taking screenshots. This follows the pattern already used in one test (line 177) where the comment explicitly states: "Bring the page to the foreground so the screenshot doesn't hang" Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
…port Root cause: Chrome extensions don't load service workers in headless mode, causing tests to hang indefinitely waiting for serviceworker event. Changes: - Set headless: false in playwright-util.js (requires xvfb in CI) - Use proper user data directory instead of empty string - Add timeout to beforeEach welcome page wait to prevent hanging - Add .playwright-user-data/ to .gitignore Testing showed: - Service worker count: 0 in headless mode - Service worker count: 1 in non-headless mode with xvfb - Extensions require X11 display to function properly CI should run with xvfb-run to provide virtual display. Co-authored-by: MarvNC <17340496+MarvNC@users.noreply.github.com>
Playwright tests hung indefinitely waiting for Chrome extension service workers, which don't start in headless mode.
Changes
playwright-util.js
headless: false- extensions require X11 display to load service workers''visual.spec.js
beforeEachwelcome page wait to prevent hangs.gitignore
.playwright-user-data/directoryContext
Chrome's headless mode (
--headless=newor--headless) prevents extension service workers from initializing:CI must provide X11 display via
xvfb-run(pre-installed on GitHub Actions runners).Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
accounts.google.com/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --disable-dev-shm-usage --string-annotations --crashpad-handler-pid=4877 --enable-crash-reporter=, --user-data-dir=/tmp/test-context-5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,145620216729299429,11584222736616880899,262144 --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameL odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node(dns block)/home/REDACTED/.cache/ms-playwright/chromium-1148/chrome-linux/chrome /home/REDACTED/.cache/ms-playwright/chromium-1148/chrome-linux/chrome --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheck(dns block)/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --disable-dev-shm-usage --string-annotations --crashpad-handler-pid=5219 --enable-crash-reporter=, --user-data-dir=/tmp/test-context-5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2746535251859873338,9622377674281901988,262144 --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameL k/_temp/ghcca-node/node/bin/bash--reporter=list user.email(dns block)example.com/home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1148/chrome-linux/headless_shell /home/REDACTED/.cache/ms-playwright/chromium_headless_shell-1148/chrome-linux/headless_shell --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheck nfig/composer/vendor/bin/bash(dns block)redirector.gvt1.com/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --disable-dev-shm-usage --string-annotations --crashpad-handler-pid=4877 --enable-crash-reporter=, --user-data-dir=/tmp/test-context-5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,145620216729299429,11584222736616880899,262144 --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameL odules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin/node(dns block)/home/REDACTED/.cache/ms-playwright/chromium-1148/chrome-linux/chrome /home/REDACTED/.cache/ms-playwright/chromium-1148/chrome-linux/chrome --disable-field-trial-config --disable-REDACTED-networking --disable-REDACTED-timer-throttling --disable-REDACTEDing-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-REDACTED-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheck(dns block)/proc/self/exe /proc/self/exe --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --disable-dev-shm-usage --string-annotations --crashpad-handler-pid=5219 --enable-crash-reporter=, --user-data-dir=/tmp/test-context-5 --change-stack-guard-on-fork=enable --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,2746535251859873338,9622377674281901988,262144 --disable-features=AcceptCHFrame,AutoExpandDetailsElement,AvoidUnnecessaryBeforeUnloadCheckSync,CertificateTransparencyComponentUpdater,DestroyProfileOnBrowserClose,DialMediaRouteProvider,GlobalMediaControls,HttpsUpgrades,ImprovedCookieControls,LazyFrameL k/_temp/ghcca-node/node/bin/bash--reporter=list user.email(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.