Repository navigation
Run upstream WPT sources directly and remove the adapted suite #87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
90976d4
Run upstream WPT sources through the package CLI
cowboyd 71226c9
Replace the adapted WPT suite with upstream execution
cowboyd 289eccf
Restore framework selections for upstream WPT
cowboyd a738b4e
Run WPT implementations and fixtures in one worker realm
cowboyd f7077a8
Support live named access in WPT Window fixtures
cowboyd File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,2 @@ | ||
| # Preserve upstream WPT conventions. The shared harness files remain linted. | ||
| packages/web-platform-tests/src/compatibility/*/**/*.ts | ||
| packages/web-platform-tests/src/wpt/**/*.ts | ||
| # Preserve the original upstream WPT sources. The harness remains linted. | ||
| packages/web-platform-tests/wpt/** |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| [submodule "packages/web-platform-tests/wpt"] | ||
| path = packages/web-platform-tests/wpt | ||
| url = https://github.com/web-platform-tests/wpt.git |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| packages/web-platform-tests/wpt/** |
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
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
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
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,43 +1,49 @@ | ||
| # UI tests | ||
|
|
||
| Tests live alongside the implementation in `src/`; this directory contains their shared fixtures and WPT configuration. Run the UI tests from the workspace root: | ||
| Tests live alongside the implementation in `src/`; this directory contains their | ||
| terminal fixtures. Run the UI tests from the workspace root: | ||
|
|
||
| ```sh | ||
| pnpm --filter @clack/ui test | ||
| ``` | ||
|
|
||
| The test script builds the private `@bomb.sh/web-platform-tests` package before running Vitest. Use `pnpm test` from the workspace root to run the workspace tests. | ||
| The script builds the private WPT harness, runs local Vitest tests, and runs the | ||
| upstream cases selected by [`wpt.config.ts`](../wpt.config.ts). Use `pnpm test` | ||
| from the workspace root to run all workspace tests. | ||
|
|
||
| ## Terminal fixtures | ||
|
|
||
| [`createTestUI`](ui.ts) starts the real UI with an in-process [Termless terminal](terminal.ts). It supplies application-facing input/output streams and exposes the document and terminal screen. Use `await using` to dispose the UI and terminal together, and `expect.poll` to wait for rendered output, as in [`ui.test.ts`](../src/ui.test.ts). | ||
| [`createTestUI`](ui.ts) starts the real UI with an in-process | ||
| [Termless terminal](terminal.ts). It supplies application-facing input/output | ||
| streams and exposes the document and terminal screen. Use `await using` to dispose | ||
| the UI and terminal together, and `expect.poll` to wait for rendered output, as in | ||
| [`ui.test.ts`](../src/ui.test.ts). | ||
|
|
||
| [`createTestTerminal`](terminal.ts) can also be used independently. Its `type` and `press` helpers write to the application's input stream, and terminal responses return through that same stream. It is an async disposable resource. | ||
| [`createTestTerminal`](terminal.ts) can also be used independently. Its `type` and | ||
| `press` helpers write to the application's input stream, and terminal responses | ||
| return through that same stream. It is an async disposable resource. | ||
|
|
||
| Rendering, scheduling, notifications, and lifecycle behavior belong in the UI tests. [`render.test.ts`](../src/render.test.ts) exercises render requests and cancellation; [`ui.lifecycle.test.ts`](../src/ui.lifecycle.test.ts) exercises terminal restoration, pending writes, and failure propagation. | ||
| Rendering, scheduling, notifications, and lifecycle behavior belong in the UI | ||
| tests. [`render.test.ts`](../src/render.test.ts) exercises render requests and | ||
| cancellation; [`ui.lifecycle.test.ts`](../src/ui.lifecycle.test.ts) exercises | ||
| terminal restoration, pending writes, and failure propagation. | ||
|
|
||
| ## DOM compatibility | ||
| ## DOM conformance | ||
|
|
||
| [`dom.compatibility.test.ts`](../src/dom.compatibility.test.ts) registers the shared compatibility suite with Vitest. Its synchronous factory creates a fresh instance of the real [`Document`](../src/dom.ts) for each case, with a no-op render notification callback. This fixture owns no external resources, so it needs no disposal callback. | ||
| [`wpt.config.ts`](../wpt.config.ts) supplies the document factory and global | ||
| bindings used by original Web Platform Test files. Add source paths and original | ||
| case names there while implementing DOM behavior. The | ||
| [WPT harness README](../../web-platform-tests/README.md) describes selection, | ||
| whole-file execution, and fixture capabilities. | ||
|
|
||
| [`dom.test.ts`](dom.test.ts) explicitly holds local DOM coverage missing from the enabled WPT cases. This is usually because getting the WPT test prequisites set up is too onerous a task. For example, testing node properties like nextSibling and previousSibling require things like `document.implementation.createDocumentType()` | ||
|
|
||
| [`wpt.config.ts`](wpt.config.ts) supplies the implementation's `globals` and selects the upstream files and cases enforced by this integration. Add new global bindings there. Omitting `config` runs all adapted cases; `exclude` removes matches and explicit `include` rules take precedence. Source keys support `*` and `**`; values are `true` for a whole source or arrays of exact case names and regular expressions. Unmatched rules are configuration errors. No other test groups must be enabled to run a case. | ||
|
|
||
| The configuration explicitly excludes unsupported directories. Add includes or narrow exclusions as cases pass. Selecting a source runs all of our adapted cases from that file; it does not imply complete coverage of the upstream file or interface. | ||
|
|
||
| Include the source or case in the configuration while implementing it. Vitest's `-t` can narrow the configured selection by source path and case name: | ||
| After building the harness once, run selected cases without rebuilding: | ||
|
|
||
| ```sh | ||
| pnpm --filter @clack/ui test src/dom.compatibility.test.ts -t 'Document-createElement.html.*createElement\(foo\)' | ||
| pnpm --filter @clack/ui exec wpt Node-parentNode -t 'Root element' | ||
| ``` | ||
|
|
||
| If the shared package is already built, avoid rebuilding by using `pnpm --filter @clack/ui exec bsh test src/dom.compatibility.test.ts` with the same name filter. | ||
|
|
||
| When implementing behavior, read the source-named file under [`src/wpt`](../../web-platform-tests/src/wpt), implement its operations, and update the configuration once its cases pass. Extend the fixture when cases need document parsing, host input, or cleanup. Implementation-specific rendering, notification, and lifecycle checks remain in the UI tests. | ||
|
|
||
| ## Host input | ||
|
|
||
| Host input cases require a [`DOMInputDriver`](../../web-platform-tests/src/shared/input-driver.ts) that delivers input through the normal terminal input pipeline. A terminal adapter must resolve mouse targets through the UI's layout, await operation completion, and release held input during cleanup, including after failures. Calling `dispatchEvent`, invoking `.click()`, or directly assigning control values does not exercise that host behavior. | ||
|
|
||
| Select keyboard/mouse delivery, platform interaction policies, and trusted-event cases independently as the implementation and its adapter support them. The shared suite's [browser tooling](../../web-platform-tests/README.md#development) validates the input contract with Playwright; the UI adapter must use terminal layout and input semantics. | ||
| Read the upstream source and helpers under | ||
| [`packages/web-platform-tests/wpt`](../../web-platform-tests/wpt) when working | ||
| through failures. All subtests in selected files execute; only configured and | ||
| name-filtered results are reported. Implementation-specific rendering and | ||
| lifecycle checks remain in the local UI tests. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use
pnpmtasks to automatically runbuildbeforetest