feat: add page/locator.mark API to enhance playwright trace#9652
Open
hi-ogawa wants to merge 47 commits intovitest-dev:mainfrom
Open
feat: add page/locator.mark API to enhance playwright trace#9652hi-ogawa wants to merge 47 commits intovitest-dev:mainfrom
page/locator.mark API to enhance playwright trace#9652hi-ogawa wants to merge 47 commits intovitest-dev:mainfrom
Conversation
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
markTrace command to improve playwright trace with source locationmarkTrace API to enhance playwright trace
Add @see links for page.mark and locator.mark to match surrounding browser context API documentation references.
@vitest/browser
@vitest/browser-playwright
@vitest/browser-preview
@vitest/browser-webdriverio
@vitest/coverage-istanbul
@vitest/coverage-v8
@vitest/expect
@vitest/mocker
@vitest/pretty-format
@vitest/runner
@vitest/snapshot
@vitest/spy
@vitest/ui
@vitest/utils
vitest
@vitest/web-worker
@vitest/ws-client
commit: |
Document how Playwright locator.describe works internally and why it complements but does not replace Vitest mark-based trace anchoring.
This reverts commit f2cd343.
Annotate iframe locator actions with Playwright locator descriptions so trace labels stay focused on end-user selectors instead of Vitest iframe plumbing.
hi-ogawa
commented
Feb 20, 2026
| ### mark | ||
|
|
||
| ```ts | ||
| function mark(name: string, options?: { stack?: string }): Promise<void> |
Contributor
Author
There was a problem hiding this comment.
stack? option is added so that vitest-browser-xxx render helper can manipulate the trace. see vitest-community/vitest-browser-react#47
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.
Description
Currently Vitest's playwright trace only logs playwright's action API (e.g. click). This PR adds "mark trace" command to add an arbitrary point in trace. This can be also used internally for
expect.element, actions and render utility to show assertion location in source code.The trace source from remote machine requires microsoft/playwright#39302 to be fixed, but this PR should give other improvements already, so I don't think we need to wait for that.
TODO
vi.defineHelpervitest-browser-xxxrender API to trigger tracelocator.describeto strip offiframe[data-vitest="true"]tracing.groupAPI is not included in zip output microsoft/playwright#39302group + locator._expect('to.be.attached')hack (can be follow-up)Example:
🎥 trace view
Screencast.From.2026-02-20.10-00-45.mp4
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
pnpm run docscommand.Changesets
feat:,fix:,perf:,docs:, orchore:.