Skip to content

perf(test): avoid redundant stack capture#41961

Merged
Skn0tt merged 1 commit into
microsoft:mainfrom
Skn0tt:skn0tt-optimize-stack-capture
Jul 23, 2026
Merged

perf(test): avoid redundant stack capture#41961
Skn0tt merged 1 commit into
microsoft:mainfrom
Skn0tt:skn0tt-optimize-stack-capture

Conversation

@Skn0tt

@Skn0tt Skn0tt commented Jul 23, 2026

Copy link
Copy Markdown
Member

Reuses already captured locations instead of taking a second stack trace.

Node 26, headless Chromium:

  • page.evaluate(): 399 → 274 µs (-31%)
  • polling expect: 568 → 493 µs (-13%)
  • synchronous expect: 164 → 100 µs (-39%)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c00ba4a1-a424-46ae-967e-2ddf02f91511
@Skn0tt
Skn0tt requested a review from dgozman July 23, 2026 14:43
@Skn0tt

Skn0tt commented Jul 23, 2026

Copy link
Copy Markdown
Member Author

Inspired by microsoft/playwright-python#3147. I also checked Java and DotNet, couldn't find a significant improvement there.

@Skn0tt
Skn0tt merged commit 4181340 into microsoft:main Jul 23, 2026
46 of 48 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [firefox] › mcp/cli-core.spec.ts:179 › dialog-dismiss @mcp-windows-latest-firefox

7785 passed, 1262 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟡 The one failure is very unlikely to be caused by this PR, but I can't outright prove it's a flake

[firefox] › mcp/cli-core.spec.ts:179 › dialog-dismiss (bot mcp-windows-latest-firefox) is the only failure in the merged report. This PR only touches test-runner stack/location capture (expect.ts, testInfo.ts), which can't reach the MCP CLI snapshot output — so I lean strongly toward noise, but the only failure of this test on record is on this PR, so I'm calling it yellow rather than green.

Details

Uncertain (leaning not-caused-by-PR)

  • [firefox] › mcp/cli-core.spec.ts:179 › dialog-dismiss — failed with expect(inlineSnapshot).not.toContain('MyAlert') where inlineSnapshot was undefined, after the step ran ~15s (looks like the snapshot CLI call hung/returned nothing). The diff here reuses already-captured stack frames for step location/boxedStack in the test runner's reporting path — it never influences a matcher's received value or the MCP CLI's snapshot output. So the diff has no path to this assertion. It's Firefox-on-Windows only; the same test passed on every other browser/OS in this run.

    What keeps it out of the green bucket: per our flake rule I need the same test failing where this PR can't be responsible, and I couldn't find that. In the aggregated CI results this test is essentially never red — mcp-windows-latest-firefox is 179/180 passed, and it's 0 failures across 400+ runs on every other bot. The single red on record is this PR's own run (sha a3587afb, branch skn0tt-optimize-stack-capture), and it wasn't retried, so there's no green-on-rerun to lean on either.

    To settle it: re-run the failed MCP shard. Given the change can't reach this code path, I'd expect it to go green.

Triaged by the Playwright bot - agent run

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

4 flaky ⚠️ [chromium-library] › library/video.spec.ts:664 › screencast › should capture full viewport `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/popup.spec.ts:260 › should not throw when click closes popup `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-node22`
⚠️ [playwright-test] › ui-mode-test-watch.spec.ts:185 › should watch new file `@windows-latest-node22`

49846 passed, 1146 skipped


Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants