test(mcp): capture debug logs around cli show / connectToDashboard (do-not-merge)#40703
Draft
Skn0tt wants to merge 7 commits intomicrosoft:mainfrom
Draft
test(mcp): capture debug logs around cli show / connectToDashboard (do-not-merge)#40703Skn0tt wants to merge 7 commits intomicrosoft:mainfrom
Skn0tt wants to merge 7 commits intomicrosoft:mainfrom
Conversation
Adds an opt-in (`PWTEST_CLI_LOG_DIR`) facility for redirecting the detached `cli show` daemon's stdout/stderr to per-spawn log files, and turns it on for every test in `tests/mcp/cli-fixtures.ts` together with `DEBUG=pw:*`. The cli fixture's teardown now surfaces every file from `cli-logs/`, `daemon/`, and `registry/` as a test attachment on every run (pass or fail), so we can diff a passing run against a flaky one when chasing dashboard / connectToDashboard timeouts. Empty files are rewritten with `<empty>` before attaching so they show up in `attachments/` and "no output" is distinguishable from "missing".
microsoft#40642)" This reverts commit dd468b4.
…microsoft#40626)" This reverts commit f536e37.
The previous change unconditionally routed the spawned dashboard daemon's stdio through `daemonStdio()` when `PWTEST_CLI_LOG_DIR` is set. In foreground mode (`--port=0`) the test fixture `startDashboardServer` waits for "Listening on ..." on the CLI's stdout — redirecting to a file makes that marker never arrive, so every test that calls `startDashboardServer()` times out at 30s. Only redirect to log files when the daemon is detached.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cli show spawns the dashboard daemon detached and previously returned immediately. Callers (tests, scripts) had no way to know when the dashboard was actually usable, leading to races - e.g. on slow Windows CI where Chrome cold-launch takes ~26s, the registry entry appears well before the dashboard page finishes navigating. Add a fourth 'pipe' stdio entry (fd 3) so the detached daemon can signal READY back to the parent once the dashboard server is listening, the browser is launched and bound, and page.goto has completed. Parent waits up to 60s, destroys its read end so Windows reaps the pipe handle, then unref()s and returns. The child's write is wrapped in try/catch to tolerate EPIPE (parent closed early on timeout) and the developer-debug case of running node dashboardApp.js directly.
This comment has been minimized.
This comment has been minimized.
Makes the report/trace show which CLI call was in flight when a test timed out, instead of just "Test timeout of 30000ms exceeded".
CI evidence on this branch shows all remaining MCP flakes are Windows-only budget exhaustion: Chrome cold-launch can eat the full 30s test budget on win-chrome, and the dashboard React mount sometimes pushes past the default 5s expect timeout. Linux and macOS runs were fully green, so keep them tight to fail fast on genuine regressions.
Contributor
Test results for "MCP"7031 passed, 1068 skipped Merge workflow run. |
Member
Author
|
wow, that helped |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec branch to flush out flakiness around
cli showandconnectToDashboardin dashboard/annotate tests.PWTEST_CLI_LOG_DIRlog capture for the detachedcli showdaemon (packages/playwright-core/src/tools/cli-client/program.ts).DEBUG=pw:*for every MCP test intests/mcp/cli-fixtures.ts; the cli fixture teardown surfaces every file fromcli-logs/,daemon/, andregistry/as a test attachment on every run (pass or fail).Do not merge — diagnostic branch only.