Skip to content

feat(fetch): implement APIResponse.timing() - #41800

Merged
dgozman merged 1 commit into
microsoft:mainfrom
dgozman:fix-41747
Jul 15, 2026
Merged

feat(fetch): implement APIResponse.timing()#41800
dgozman merged 1 commit into
microsoft:mainfrom
dgozman:fix-41747

Conversation

@dgozman

@dgozman dgozman commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Expose per-phase resource timing on APIResponse via a new timing() method, mirroring Request.timing(). The timings were already collected for HAR/trace recording; this surfaces them through the public API.
  • The return type is shared with Request.timing() in the docs via a new resource-timing template; while sharing, fixed copy-paste errors in domainLookupEnd and connectEnd descriptions.
  • Phases that did not happen (e.g. reused keep-alive socket) or are unknown (HAR replay) are reported as -1, consistent with browser requests.

Fixes #41747

@dgozman
dgozman requested a review from yury-s July 15, 2026 15:04
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

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

🟢 Both failures are pre-existing MCP flakes — this PR is clear

This PR only touches APIResponse.timing() (client/server fetch.ts, protocol, and fetch/HAR tests). The two failures are in the MCP annotate flow, which this change doesn't exercise, and both flip verdict across many unrelated PRs.

Details

Pre-existing flake / infra

  • [chromium] › mcp/annotate.spec.ts:447 › should switch screencast to -s session on show --annotate — flaky across the test-results DB: failed 7 of 211 chromium runs (~3%) and passed the other 204, over 5 distinct PRs, on SHAs unrelated to this branch. Not caused by this PR.
  • [webkit] › mcp/annotate.spec.ts:173 › user-initiated annotate downloads zip with feedback.md — same story: failed 7 of 213 webkit runs (~3%), passed 206, over 3 distinct PRs. This test flakes more heavily on firefox (12/208) too. Not caused by this PR.

Nothing in the diff reaches the MCP annotate/screencast code paths, and the aggregated history shows both tests failing on PRs that predate and are unrelated to this one — so these are flakes, not regressions.

Triaged by the Playwright bot - agent run

Comment thread packages/playwright-core/src/server/fetch.ts
@dgozman dgozman closed this Jul 15, 2026
@dgozman dgozman reopened this Jul 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Test results for "MCP"

7760 passed, 1249 skipped


Merge workflow run.

@github-actions

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 flaky ⚠️ [chromium-library] › library/video.spec.ts:736 › screencast › should work with video+trace `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/video.spec.ts:495 › screencast › should capture static page in persistent context @smoke `@chromium-ubuntu-22.04-node20`
⚠️ [chromium-library] › library/video.spec.ts:699 › screencast › should capture full viewport on hidpi `@chromium-ubuntu-22.04-node22`

49716 passed, 1156 skipped


Merge workflow run.

@dgozman
dgozman merged commit eb874fa into microsoft:main Jul 15, 2026
90 of 93 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.

[Feature]: Expose recorded ResourceTiming on APIResponse (parity with Request.timing())

2 participants