Repository navigation
test: share one fake desktop runtime across e2e specs - #139
Merged
Merged
Conversation
Add tests/e2e/helpers/fakeDesktop.ts, which installs isTauri and __TAURI_INTERNALS__ (with transformCallback and event listen/unlisten), answers the desktop startup commands with neutral defaults, and throws on any command a spec did not handle. Move the seven specs that wrote their own fakes onto it, before or after load. Refs #134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Addresses self-review of #139: push files and emit the inbox event in one page task as before, add unregisterCallback so Channel cleanup has a fake, document the JSON-only arg for fakeDesktopAfterLoad, and drop the unused emitDesktopEvent helper. Refs #134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Nov 7, 2026
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.
Refs #134.
What
Adds
tests/e2e/helpers/fakeDesktop.ts, one fake Tauri runtime for e2e specs:window.isTauri,__TAURI_INTERNALS__(invokeandtransformCallback), and__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener.get_app_versionreturns4.1.0,check_for_updatesandtake_opened_filereturnnull, andplugin:event|listen/unlistenregister and remove real listeners.desktop.handle(command | commands[], (args, command) => …), which replaces a default if one exists. Any other command still throws (Unexpected desktop command: …), so a new native call is noticed.desktop.callsrecords every command name;desktop.emit(event, payload)delivers events to listeners.fakeDesktopBeforeLoad(page, setup?, arg?)uses an init script and runs before any app code.fakeDesktopAfterLoad(page, setup?, arg?)usespage.evaluatefor specs that check web behavior first and then switch.Appis lazy-loaded, so startup code can still run against the fake. Because the startup commands now have defaults, that is harmless, and specs no longer need to sequence around it.fakeDesktopCalls(page).setupruns in the page, so like any Playwright page function it must be self-contained.argmust be JSON-serializable.Migrated specs
i18n.spec.ts(release notes),settings-legal-links.spec.ts,desktop-file-open.spec.ts. The opened-filesignal()is nowdesktop.emit('kromacut-opened-files'), still in the same page task as the queue push, and the spec-localcallslog is nowfakeDesktopCalls.i18n.spec.ts(desktop save prompts),palette-,profile-,hd-calibration-, andstack-matrix-desktop-save.spec.ts. Each still keeps its own save-flow state and handlers. Only the runtime plumbing moved.No CI workflows or npm scripts changed (those are in #138's scope). There is no changelog entry, since this is test-only infrastructure with no new coverage.
Verification
npm run lintandtsc -bpass.CI=1 npx playwright test --config playwright.i18n.config.ts: 17 passed.@smoke), under the defaultplaywright.config.tssettings (production build + preview): 34 passed. Port 5173 was held by another worktree's preview server, so I ran them through a temporary config that only changed the port to 5274 and disabled server reuse. That config is not committed.🤖 Generated with Claude Code