Repository navigation
docs: fix reference paths and Playwright API examples - #13
dajiaohuang wants to merge 2 commits into
Conversation
|
| Topic | Details | |||
|---|---|---|---|---|
| Playwright examples | Correct Playwright API contracts and examples for user-facing testing flows, including touch sequences, service workers, WebSockets, permissions, locators, fixtures, component boundaries, drag-and-drop, GraphQL responses, and extension startup. Update cross-document references and clarify browser, SPA-serving, animation, and process-isolation behavior.Modified files (22)
Latest Contributors(0)
| |||
| Coverage workflow | Replace incompatible coverage calculations with a test-page fixture that writes separate JavaScript and CSS coverage, convert JavaScript V8 functions through v8-to-istanbul, and produce Istanbul reports and thresholds. Clarify shard merging, CI artifact paths, reporter configuration, and coverage-process boundaries.Modified files (5)
Latest Contributors(0)
|
| const touches = [{ | ||
| identifier: 0, | ||
| clientX: x + deltaX * i / 10, | ||
| clientY: y + deltaY * i / 10, | ||
| }]; |
There was a problem hiding this comment.
Touch points omit page and screen coordinates
Legacy handlers that calculate movement from pageX/pageY or screenX/screenY see zero deltas, causing swipe or pull-to-refresh assertions to fail; include these fields in pan and the file-menu touchstart, since omitted TouchInit members default to 0.
Want Baz to fix this for you? Activate Fixer
Other fix methods
Prompt for AI Agents
Before applying, verify this suggestion against the current code. In
`playwright-best-practices/advanced/mobile-testing.md` around lines 101-105, update the
`pan` helper’s `touchmove` points to include `pageX`/`pageY` and `screenX`/`screenY`
values consistent with the generated client coordinates. Apply the same complete
`TouchInit` coordinate fields to the `touchstart` example around lines 173-176 so legacy
handlers can calculate movement correctly.
There was a problem hiding this comment.
The default-value observation is correct, but the need for those coordinates depends on the application handler. Playwright's v1.64.1 pan example explicitly supplies only clientX/clientY because its consumer uses only those fields; it says to supply page/screen coordinates when the app needs them. TouchInit defaults these coordinate members independently to zero, rather than deriving one coordinate space from another.
For a page-coordinate consumer, page coordinates must account for the document scroll offset; screen coordinates are screen-relative, not generally copies of client coordinates. That would require an app-specific adaptation, not indiscriminately assigning the same values to every field.
This collection does not include implementations of the illustrative /carousel or /files handlers, and this review identifies no concrete consumer that requires page/screen coordinates. The existing isolated regression verifies touch event delivery and a held-touch timer, not page/screen coordinate compatibility or a real carousel/file-menu implementation. Omitted page/screen fields do not affect a client-coordinate-only handler or that timer, but I am not claiming compatibility with handlers that read them.
Leaving these examples unchanged rather than adding unneeded fields without a demonstrated failing consumer. A specific handler requiring another coordinate space would be actionable evidence for a bounded adaptation.
There was a problem hiding this comment.
Thanks for the clarification—you're right that additional coordinate fields must be supplied only when a concrete consumer requires the appropriate coordinate space. I'll save this guidance to memory once the PR is merged.
Summary
Correct existing reference paths and Playwright examples that currently fail or describe a different API contract:
waitForFunctionoptions, shadow locators, permission-state serialization, fixture type parameters and GraphQL response parsing.functions/source, not CSSranges/text.The coverage section needs the larger change because its original collector, converter and percentage calculations use incompatible schemas; fixing just the collector would leave the advertised report/check workflow broken. Other edits remain local to the incorrect examples/facts.
Evidence
Checked against Playwright 1.64.1's official assertions, coverage API, touch events, WebSocket routing, component testing, extensions, and related configuration/fixture/reporting contracts.
Validation
http-server -sreturned 404;serve -sreturned the application document (200).git diff --checkpassed.These are documentation changes, not a claim that every illustrative backend, framework, CI provider, Electron app, or native extension UI was executed. Framework/CI-specific changes also use the documented API contracts; no real login, payment, mailbox or third-party application was exercised.
Need help on this PR? Tag
@codesmith-botwith what you need.