Move web UI tests to Playwright; add 4 more converter docs/copy updates#19
Merged
Conversation
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.
TLDR
Replaces happy-dom UI unit tests with real-browser Playwright E2E specs (desktop + mobile), adds a coverage merger between vitest and Playwright, and updates docs/copy to advertise the four new converters (F#, Dart, PHP, Protobuf) that already exist in the framework.
Details
New: Playwright E2E harness for the web package
@playwright/test,monocart-coverage-reports, and apackages/web/playwright.config.tswith desktop + mobile projects (viewports 1400x900 and 420x900,isMobile/hasTouchon mobile).e2e-harness.htmlpage (+eleventy/harness.njk,e2e/harness.ts) exposes the web package's UI modules onwindow.__E2Eso specs can drive them in real CSS/DOM context. Entry registered invite.config.tsandvite-plugin-copy-eleventy.ts; markedeleventyExcludeFromCollectionsand robots-blocked.packages/web/e2e/:converter.spec.ts,editor-zoom.spec.ts,playground.spec.ts,splitter.spec.ts,viewport.spec.ts,zoom-controls.spec.ts— plussupport/coverage-fixture.ts(CDP coverage capture) andsupport/global-teardown.ts.tsconfig.e2e.json;scripts/**/*ande2e/**/*added totsconfig.jsoninclude list.make test-playwrightMakefile target for iterating on E2E only.make ci(.github/workflows/ci.yml).Coverage merging
packages/web/scripts/merge-coverage.tsunions vitest (v8) and Playwright (monocart) istanbulcoverage-final.jsonfiles at line identity, writescoverage/merged/coverage-summary.json, mirrors it tocoverage/coverage-summary.jsonfor the repo-level ratcheter, and enforcescoverage-thresholds.jsonagainst the merged result.vitest.config.tsno longer enforces threshold directly — coverage emits JSON tocoverage/vitest/and the merger owns threshold enforcement.Deleted (moved to Playwright)
packages/web/test/converter.test.ts,editor-zoom.test.ts,playground.test.ts,splitter.test.ts,viewport.test.ts,zoom-controls.test.ts— all the happy-dom UI-interaction suites. Their black-box behaviour is now covered in the real browser.UI/source tweaks
src/splitter.ts:initSplitternow acceptsstorageKey,orientation("auto" | "row" | "col"), anddefaultRatio, replacing the hard-coded portrait-only behaviour.src/converter.ts,src/playground.ts: minor refactors aligned with the new splitter signature and harness mount.src/styles.css: hooks editor + backdrop selectors unified with the other editors; converter page switches to a full-viewport flex layout (no vertical scroll on mobile); mobile docs nav becomes a<details>disclosure; blog-index/post-main/post-header/post-title CSS dedup'd.Docs & copy
docs/specs/converters.md,docs/specs/api.md,docs/specs/getting-started.md,docs/shared/intro.md,eleventy/blog/welcome.md,eleventy/index.njk,eleventy/converter.njk,eleventy/docs.njk— all updated from "5 languages (TS/Python/Rust/Go/C#)" to "9 languages (+ F#, Dart, PHP, Protobuf)" and call out lossless round-tripping. Converter table rows added for the four new languages.packages/typediagram/test/markdown.test.tsandpackages/vscode/test/markdown-it-plugin.test.ts: new interleaved-fence, multi-fence, indented-fake-fence, long-backtick-fence, and bad-fence-between-good-fences tests.Claude.md: testing rules clarified — "Don't split tests for assertions or user interactions. Merge them."How Do The Automated Tests Prove It Works?
[WEB-SPLITTER] …specs run against both desktop (col-resize,gridTemplateColumns) and mobile (row-resize,gridTemplateRows) viewports and verifyapplies default 50/50 split in landscape,uses gridTemplateRows in portrait (mobile),restores persisted ratio from localStorage,clamps stored ratio below MIN,clamps stored ratio above MAX(0.15/0.85),drag updates grid and pointerup saves ratio,pointercancel ends the drag and saves ratio, and the two no-op paths.[WEB-EDITOR-ZOOM]proves default 13px, persisted-size restore + clamp (8–32), and Ctrl/Meta wheel zoom including the plain-wheel no-op.[WEB-ZOOM-CONTROLS]asserts the bar renders 5 buttons, routes clicks to each of zoomIn/zoomOut/reset/fit, exports no-ops when no SVG is present, and triggers an anchor download (diagram.svg,blob:href) when the viewport contains an SVG.[WEB-CONVERTER]exercises all 9 language tabs, flip behaviour, Rust + flip filling all three panels (no 'No Rust type definitions found'), round-trip back to the original TD source, and scroll-sync between textarea and backdrop.[WEB-PLAYGROUND]+[WEB-PLAYGROUND-PRESETS]cover source/hooks tabs, real debounced re-render on hook input, localStorage persistence, syntax-highlight backdrop tokens, the invalid-hook diagnostic, preset chip append/remove, aria-pressed state, z-index ordering, and hand-typing a preset block lighting up the matching chip.[WEB-VIEWPORT]proves pan/zoom preservation across re-renders — the bug-fix invariant from the old unit test, now in a real browser.make cicontinues to runfmt-check → lint → test → build → bundle-size.make testnow runs vitest + Playwright for the web package and fails if the merged coverage drops belowcoverage-thresholds.json.