Skip to content

docs: fix reference paths and Playwright API examples - #13

Open
dajiaohuang wants to merge 2 commits into
currents-dev:mainfrom
dajiaohuang:repostew/fix-broken-reference-links
Open

dajiaohuang wants to merge 2 commits into
currents-dev:mainfrom
dajiaohuang:repostew/fix-broken-reference-links

Conversation

@dajiaohuang

@dajiaohuang dajiaohuang commented Oct 15, 2026 •

Copy link
Copy Markdown

Summary

Correct existing reference paths and Playwright examples that currently fail or describe a different API contract:

  • Fix seven broken local reference links in five documents.
  • Correct soft-assert failure inspection, waitForFunction options, shadow locators, permission-state serialization, fixture type parameters and GraphQL response parsing.
  • Use complete touch sequences and native WebSocket routing; correct service-worker constructor/update-routing examples and extension startup/API limitations.
  • Replace the coverage example's unused worker page and mixed JS/CSS schemas with a test-page fixture and a working V8 → Istanbul → report/threshold workflow. JS coverage uses functions/source, not CSS ranges/text.
  • Correct SPA serving, report/artifact paths, worker-process isolation, component-test process boundaries and screenshot comparison facts.

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

  • Local reference check: 327 links, zero broken after the path corrections.
  • Ten isolated Playwright 1.64.1/Chromium fixture tests passed, including expected base failures and corrected behavior for soft assertions, wait timeouts, shadow selectors, serialized permissions, touch gestures, WebSocket routing, service-worker constructors, DataTransfer and JSON response parsing. The soft-assert test deliberately records an expected failure to verify the early-exit path.
  • Extracted the new coverage fixture/conversion script from the document: collected the actual test-page script, generated HTML/LCOV/JSON-summary reports, passed a line threshold and correctly rejected an unmet function threshold.
  • Local SPA deep-link fixture: http-server -s returned 404; serve -s returned the application document (200).
  • Agnix 0.57.0 with the repository config: 0 errors, 8 warnings on existing cache-path/URL examples, 1 version-pinning informational diagnostic.
  • git diff --check passed.

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.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.

@baz-reviewer

baz-reviewer Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Review this PR on Baz

Baz Summary

Correct Playwright documentation examples and reference paths across authentication, browser APIs, touch interactions, WebSockets, extensions, component testing, forms, GraphQL, and visual testing. Rework the coverage workflow to collect test-page V8 data, convert it to Istanbul format, generate reports, and enforce valid thresholds across CI and sharded runs.

Topics

TopicDetails
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)
  • playwright-best-practices/advanced/authentication.md
  • playwright-best-practices/advanced/mobile-testing.md
  • playwright-best-practices/advanced/network-advanced.md
  • playwright-best-practices/browser-apis/browser-apis.md
  • playwright-best-practices/browser-apis/service-workers.md
  • playwright-best-practices/browser-apis/websockets.md
  • playwright-best-practices/core/assertions-waiting.md
  • playwright-best-practices/core/configuration.md
  • playwright-best-practices/core/fixtures-hooks.md
  • playwright-best-practices/core/global-setup.md
  • playwright-best-practices/core/locators.md
  • playwright-best-practices/core/test-data.md
  • playwright-best-practices/debugging/error-testing.md
  • playwright-best-practices/debugging/flaky-tests.md
  • playwright-best-practices/frameworks/angular.md
  • playwright-best-practices/testing-patterns/browser-extensions.md
  • playwright-best-practices/testing-patterns/component-testing.md
  • playwright-best-practices/testing-patterns/drag-drop.md
  • playwright-best-practices/testing-patterns/file-upload-download.md
  • playwright-best-practices/testing-patterns/forms-validation.md
  • playwright-best-practices/testing-patterns/graphql-testing.md
  • playwright-best-practices/testing-patterns/visual-regression.md
Latest Contributors(0)
UserCommitDate
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)
  • playwright-best-practices/infrastructure-ci-cd/other-providers.md
  • playwright-best-practices/infrastructure-ci-cd/parallel-sharding.md
  • playwright-best-practices/infrastructure-ci-cd/performance.md
  • playwright-best-practices/infrastructure-ci-cd/reporting.md
  • playwright-best-practices/infrastructure-ci-cd/test-coverage.md
Latest Contributors(0)
UserCommitDate


Merger  Activate to get a short verdict whether this PR is good to go or not

Skills  Activate Skill Maintainer to keep your skills up to date

Planner  This PR would have been improved with Baz Planner - Try it now

Comment on lines +101 to +105
const touches = [{
identifier: 0,
clientX: x + deltaX * i / 10,
clientY: y + deltaY * i / 10,
}];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Severity web_search

Want Baz to fix this for you? Activate Fixer

Other fix methods

Fix in Cursor

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.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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.

1 participant