Skip to content

feat(trace): add action screenshot and aria snapshot events - #42167

Merged
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:trace-aria-screenshot-events
Aug 9, 2026
Merged

feat(trace): add action screenshot and aria snapshot events#42167
Pavel Feldman (pavelfeldman) merged 1 commit into
microsoft:mainfrom
pavelfeldman:trace-aria-screenshot-events

Conversation

@pavelfeldman

Copy link
Copy Markdown
Member

No description provided.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread docs/src/api/class-tracing.md
Comment thread packages/playwright-core/src/server/dispatchers/dispatcher.ts Outdated
const actionTitle = renderTitleForCall(metadata);
const utility = await page.mainFrame().utilityContext();
const actionTitle = renderTitleForCall(progress.metadata);
const utility = await progress.race(page.mainFrame().utilityContext());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the point in replacing one progress.race at the callsite with multiple inside the method?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our linter demands that every awaited call needs to either race with progress or accept progress as the first argument. Here we pass it as the first arguments => must race.

traceSha1s: Set<string>,
recording: boolean;
callIds: Set<string>;
callProgresses: Map<string, Progress | undefined>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any usages of the values, why do we store them in the map?

@pavelfeldman Pavel Feldman (pavelfeldman) Aug 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No reason, I also wanted to make it a set. Done.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

🔴 The failure is caused by this PR

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

test-step.spec.ts:1264 › should report api step failure fails on ubuntu-latest-node24 and ubuntu-latest-node26 because the progress/timeout refactor in this PR now leaks a TimeoutNegativeWarning onto stdout, which breaks the test's byte-for-byte output assertion. Not a flake: it fails only on this PR's two SHAs and has never failed on any other.

Details

Caused by this PR

  • [playwright-test] › test-step.spec.ts:1264 › should report api step failure (node24 + node26) — the test runs page.click('input', { timeout: 1 }) and asserts the reporter output exactly. On this PR the received output gains three leading lines:

    (node:30027) TimeoutNegativeWarning: -4.664999999999964 is a negative number.
    Timeout duration was set to 1.
    (Use `node --trace-warnings ...` to show where the warning was created)
    

    The cause is the ProgressController.run change in packages/playwright-core/src/server/progress.ts. The deadline is now computed earlier via timeoutToDeadline(options?.timeout), then the progress object is built, and only afterwards the timer is armed with setTimeout(..., deadline - monotonicTime()). With a 1ms timeout the remaining delay is already negative by the time the timer is set, so Node ≥24 prints TimeoutNegativeWarning to stdout and pollutes the captured output. Older Node runtimes don't emit the warning, which is why only node24/node26 fail.

    Fix: clamp the delay, e.g. setTimeout(..., Math.max(0, deadline - monotonicTime())).

Verification

  • All 4 failures in the results DB are on this PR only: SHAs 8fd27ff1 and 4c352624 (PR feat(trace): add action screenshot and aria snapshot events #42167), each on both ubuntu-latest-node24 and ubuntu-latest-node26, project playwright-test — hard failures, not retry flakes.
  • The same (playwright-test, test-step.spec.ts, should report api step failure) passed 4473 of 4477 runs across 646 SHAs; the only 4 failures are the ones above. No pre-existing history of this test failing.

The flaky entries in the reports (video/screencast, heap, page-event-request, ui-mode, locator-query, etc.) all passed on retry and don't touch the progress/timeout path, so there's nothing to triage there.

Triaged by the Playwright bot.

Triaged by the Playwright bot - agent run

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🟡 Probably not this PR, but one failure I can't fully clear

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

The latest run is clean on tests 1 (0 failures — the earlier test-step.spec.ts:1264 regression is gone in the newer commit). The MCP run has 3 failures, none of which I can pin on this PR: two are pre-existing flakes on the same Windows-Firefox bot, and one is a macOS-Chrome network race with too thin a history to certify. This PR touches the shared input/instrumentation path, but a real regression there would fail across browsers and OSes — not only one already-flaky combo.

Details

Overall: No failure is convincingly caused by this PR. All three are on a single MCP run (31230535587), each on one bot only, and every one of these tests passes on the other ~13 bots in the same run.

Pre-existing flake / infra

Uncertain

  • [chrome] › mcp/network.spec.ts:210 › browser_network_requests lists a failed request once (mcp-macos-latest-chrome) — toHaveLength expected 1, received 0: the failed request wasn't captured in time, a classic network-timing race. For this exact (chrome, …) identity it's the only failure in the DB (1 of 1912 runs), so I can't call it a pre-existing flake by the strict bar. It has flaked once before on a sibling project (firefox, PR fix(aria): keep icon-only clickable elements in ai snapshots #42034), it passed on every other bot in this run, and this PR's changes don't touch MCP network capture — so most likely infra noise, but I couldn't prove it. A rerun of that job would settle it.

Why not the PR

  • The input-path edit in packages/playwright-core/src/server/input.ts (onBeforeInputAction now takes progress directly) is shared, browser-agnostic server code. If it broke click/dblclick/uncheck it would fail on Chromium and WebKit too, not just one Windows-Firefox bot — and it doesn't.

Triaged by the Playwright bot - agent run

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

7 flaky ⚠️ [chromium-library] › library/chromium/oopif.spec.ts:150 › should take screenshot `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@frozen-time-library-chromium-linux`
⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:371 › should produce network events, routing, and annotations for Service Worker `@chromium-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/heap.spec.ts:223 › should not leak workers `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`

51035 passed, 1190 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

8063 passed, 1284 skipped


Merge workflow run.

@pavelfeldman
Pavel Feldman (pavelfeldman) merged commit b4e7c87 into microsoft:main Aug 9, 2026
46 checks passed
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