feat(dioxus): package test fixture + script support (Phase 8)#280
Conversation
Adds fixtures/package-tests/dioxus-app/ mirroring the tauri-app fixture: - Minimal Dioxus app with get_platform_info + generate_test_logs commands - Native mode WDIO config (embedded provider, all platforms) - Browser mode WDIO config (mode: 'browser', static dev server) - test/api.spec.ts: launch + execute + mock smoke - test/logging.spec.ts: backend + frontend log capture - test-browser/browser.spec.ts: browser mode smoke Updates scripts/test-package.ts to support --service=dioxus: - Adds dioxus to the service union type throughout - Packs @wdio/dioxus-service tarball - Copies packages/dioxus-embedded-driver to temp dir and rewrites Cargo.toml path dep (same pattern as the tauri-plugin copy for Tauri) - Filters dioxus-* fixtures by prefix; detects service from package name Adds .github/workflows/_ci-build-dioxus-package-app.reusable.yml (mirrors _ci-build-tauri-package-app.reusable.yml; no ACL manifest step). Registers fixtures/package-tests/dioxus-app in pnpm-workspace.yaml. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
pnpm install registers fixtures/package-tests/dioxus-app in the lockfile so Turbo can calculate transitive closures for the new workspace package. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR introduces a self-contained Dioxus package test fixture (
Confidence Score: 5/5All changes are additive: a new fixture, a new CI workflow, and an extension of an existing test script. No existing paths are altered in a breaking way. The six concerns raised in the previous review round have all been addressed cleanly. The new code follows the same patterns as the Tauri fixture it mirrors, the static-server port matches the devServerUrl, and autoXvfb: false in the native config is intentional — consistent with the Tauri native config which documents that xvfb-run wraps the command in CI. No files require special attention.
|
| Filename | Overview |
|---|---|
| scripts/test-package.ts | Adds dioxus to the service union, packs the service tarball with a typesDir existence guard, copies the embedded driver and its transitive dioxus-bridge dep, and rewrites Cargo.toml path deps with forward-slash-safe absolute paths — previous review concerns all addressed. |
| .github/workflows/_ci-build-dioxus-package-app.reusable.yml | New reusable workflow mirroring the Tauri equivalent; installs Linux Dioxus deps, builds via turbo with --only, and uploads src-dioxus/target as a cache artifact. |
| fixtures/package-tests/dioxus-app/wdio.conf.ts | Native mode WDIO config; sets autoXvfb: false intentionally (matches tauri-app, Xvfb is expected to wrap the whole command in CI) and validates the binary path at load time. |
| fixtures/package-tests/dioxus-app/wdio.browser.conf.ts | Browser mode config; autoXvfb: true and devServerUrl points to port 5173, which the test-package.ts script serves the browser/ directory on. |
| fixtures/package-tests/dioxus-app/test/api.spec.ts | restoreAllMocks moved to afterEach, covering failure paths; mock and execute assertions are complete. |
| fixtures/package-tests/dioxus-app/test/logging.spec.ts | Both log-capture tests now have waitUntil + final expect assertions covering both frontend and backend log paths. |
| fixtures/package-tests/dioxus-app/src-dioxus/Cargo.toml | Minimal Cargo config with correct four-level-up relative path to packages/dioxus-embedded-driver; serde, serde_json, and tracing deps look appropriate. |
| fixtures/package-tests/dioxus-app/src-dioxus/src/main.rs | Registers commands under #[cfg(debug_assertions)] only, ensuring the embedded driver is not linked in release builds; log directives for both wdio_dioxus_bridge and wdio_dioxus_embedded_driver are set. |
Sequence Diagram
sequenceDiagram
participant Dev as Developer / CI
participant Script as test-package.ts
participant TempDir as Isolated TempDir
participant Cargo as cargo build
participant WDIO as wdio run
Dev->>Script: "--service=dioxus [--skip-build]"
Script->>Script: buildAndPackService('dioxus')
Script->>TempDir: cpSync dioxus-app fixture
Script->>TempDir: rewrite package.json overrides
Script->>TempDir: cpSync packages/dioxus-embedded-driver
Script->>TempDir: cpSync packages/dioxus-bridge
Script->>TempDir: rewrite Cargo.toml path dep (absolute, forward-slash)
Script->>TempDir: pnpm install (isolated)
alt "mode=native"
Script->>Cargo: pnpm build (cargo build)
Cargo-->>Script: dioxus-package-test-app binary
Script->>WDIO: pnpm test (wdio.conf.ts)
else "mode=browser"
Script->>Script: startStaticServer(browser/, 5173)
Script->>WDIO: pnpm test:browser (wdio.browser.conf.ts)
Script->>Script: stopStaticServer
end
WDIO-->>Dev: test results + logs
Reviews (6): Last reviewed commit: "fix(dioxus-pkg-test): enable autoXvfb in..." | Re-trigger Greptile
- logging.spec.ts: add waitUntil + assertion to frontend log test so it actually validates capture (was a no-op pause with no assertion) - api.spec.ts: move restoreAllMocks() to afterEach so mocks are cleared even when the mock test body throws - test-package.ts: add existsSync guard on typesDir in Dioxus packing block, matching the pattern used by the Electron and Tauri blocks Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…oml regex miss - Guard native-types pack in Dioxus block with !result.typesPath so --service=both only packs it once (was running 3× across Electron, Tauri, and Dioxus blocks) - Add else-warning when the embedded-driver Cargo.toml path-dep regex doesn't match, surfacing the mismatch immediately instead of letting cargo build fail with an opaque "path not found" error Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
On Windows, path.normalize() produces backslash-separated paths which are interpreted as TOML escape sequences when written into Cargo.toml, making the file invalid and breaking cargo build. Apply .replace(/\\/g, '/') to both the Tauri plugin path and the Dioxus embedded driver path before embedding them in the TOML. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…olated env wdio-dioxus-embedded-driver/Cargo.toml has a path dep on wdio-dioxus-bridge via path = "../dioxus-bridge". After cpSync the driver lands at tempDir/packages/dioxus-embedded-driver/, so Cargo resolves the bridge at tempDir/packages/dioxus-bridge/ — which was never created. Copy the bridge source to the same location so the relative path resolves correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Without autoXvfb: true, non-headless Chrome fails to open on Linux CI runners that have no display server. Mirrors the Tauri browser config. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
fixtures/package-tests/dioxus-app/— a self-contained package test fixture mirroringfixtures/package-tests/tauri-app/scripts/test-package.tswith full--service=dioxussupport.github/workflows/_ci-build-dioxus-package-app.reusable.yml(mirrors the Tauri equivalent)fixtures/package-tests/dioxus-appinpnpm-workspace.yamlFixture contents (
fixtures/package-tests/dioxus-app/)src-dioxus/— minimal Dioxus app withget_platform_info+generate_test_logscommands,wdio-dioxus-embedded-driverwired viainstall_with_commandswdio.conf.ts— native mode, embedded provider (works on all platforms)wdio.browser.conf.ts— browser mode, static dev servertest/api.spec.ts— launch,browser.dioxus.execute, onemock()call,restoreAllMockstest/logging.spec.ts— backend + frontend log capture viawaitUntil+ file readtest-browser/browser.spec.ts— browser-mode smoke (service loads, execute available)browser/index.html— minimal static page for browser modescripts/test-package.tschangesserviceunion:'electron' | 'tauri' | 'dioxus' | 'both'@wdio/dioxus-servicetarball; overrides the workspace dep in the isolated copypackages/dioxus-embedded-driverto temp dir and rewrites the Cargo.toml path dep (same pattern as the tauri-plugin copy)dioxus-*prefix filtering; tri-value service detection from package nameCI workflow
Mirrors
_ci-build-tauri-package-app.reusable.ymlwithout the ACL manifest debug step. Uploadssrc-dioxus/targetas a build artifact for use in the package test jobs.Test plan
pnpx tsx scripts/test-package.ts --service=dioxus --skip-buildafter a manualcargo buildin the fixture — confirm the three specs passpnpx tsx scripts/test-package.ts --service=dioxus— builds, packs, copies embedded driver, runs testspnpx tsx scripts/test-package.ts --service=tauri— no regressionpnpx tsx scripts/test-package.ts --service=electron— no regression🤖 Generated with Claude Code