fix(ci): create tracesDir before stacks write + add MCP test retries#40735
Closed
SebTardif wants to merge 2 commits intomicrosoft:mainfrom
Closed
fix(ci): create tracesDir before stacks write + add MCP test retries#40735SebTardif wants to merge 2 commits intomicrosoft:mainfrom
SebTardif wants to merge 2 commits intomicrosoft:mainfrom
Conversation
When tracesDir is provided (not a temp dir), the directory may not exist yet when the first live stack is written. The zip() function already does mkdir before writing, but addStackToTracingNoReply assumes the directory exists and fails with ENOENT on Windows CI where directory creation timing is less predictable.
Contributor
Author
|
Closing: the .stacks mkdir fix duplicates #40730, and the retries alone don't address the root cause (Connection closed in annotate tests on Windows). The team is already actively working on these issues. |
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.
Summary
.stacksfile during live tracing (the directory may not exist yet)retries: process.env.CI ? 3 : 0to the MCP test config, matching every other test suiteBug: ENOENT on
.stacksfile (tracing.spec.ts)tracingStarted()inlocalUtils.tscomputes the stacks file path insidetracesDir, but whentracesDiris provided (not a temp dir), the directory is never created. Thezip()function doesmkdir(path.dirname(...), { recursive: true })before writing the trace zip, butaddStackToTracingNoReply()assumes the directory exists and callswriteFile()directly.On Windows CI, this causes an intermittent ENOENT because the directory creation timing between the browser launch (which creates
tracesDirfor its own trace files) and the first client-side stacks write is less predictable:Fix: call
mkdir({ recursive: true })intracingStarted()whentracesDiris provided, so the directory is guaranteed to exist before any stacks are written. This matches the existing pattern inzip().Example CI failure: PR #40722, windows-latest - firefox at
tracing.spec.ts:54.Retries: match other test configs
The MCP test suite is the only test config in the project without CI retries:
tests/library/playwright.config.tsprocess.env.CI ? 3 : 0tests/installation/playwright.config.tsprocess.env.CI ? 3 : 0tests/electron/playwright.config.tsprocess.env.CI ? 3 : 0tests/extension/playwright.config.tsprocess.env.CI ? 2 : 0tests/android/playwright.config.tsprocess.env.CI ? 1 : 0tests/mcp/playwright.config.tsThe ENOENT bug is a concrete fix, but the MCP tests also have non-deterministic failures that only retries can address:
McpError: Connection closedduring teardown races (e.g.,config.ini.spec.ts,video.spec.tson webkit Windows)toHaveCountassertions on timing-sensitive UI elements (e.g.,annotate.spec.ts)http.spec.tson webkit Windows)These are the same class of non-deterministic failures that retries already handle in every other test suite.