Skip to content

feat(dioxus): package test fixture + script support (Phase 8)#280

Merged
goosewobbler merged 7 commits into
feat/dioxus-servicefrom
feat/dioxus-phase8
May 13, 2026
Merged

feat(dioxus): package test fixture + script support (Phase 8)#280
goosewobbler merged 7 commits into
feat/dioxus-servicefrom
feat/dioxus-phase8

Conversation

@goosewobbler
Copy link
Copy Markdown
Contributor

Summary

  • Adds fixtures/package-tests/dioxus-app/ — a self-contained package test fixture mirroring fixtures/package-tests/tauri-app/
  • Extends scripts/test-package.ts with full --service=dioxus support
  • Adds .github/workflows/_ci-build-dioxus-package-app.reusable.yml (mirrors the Tauri equivalent)
  • Registers fixtures/package-tests/dioxus-app in pnpm-workspace.yaml

Fixture contents (fixtures/package-tests/dioxus-app/)

  • src-dioxus/ — minimal Dioxus app with get_platform_info + generate_test_logs commands, wdio-dioxus-embedded-driver wired via install_with_commands
  • wdio.conf.ts — native mode, embedded provider (works on all platforms)
  • wdio.browser.conf.ts — browser mode, static dev server
  • test/api.spec.ts — launch, browser.dioxus.execute, one mock() call, restoreAllMocks
  • test/logging.spec.ts — backend + frontend log capture via waitUntil + file read
  • test-browser/browser.spec.ts — browser-mode smoke (service loads, execute available)
  • browser/index.html — minimal static page for browser mode

scripts/test-package.ts changes

  • service union: 'electron' | 'tauri' | 'dioxus' | 'both'
  • Packs @wdio/dioxus-service tarball; overrides the workspace dep in the isolated copy
  • Copies packages/dioxus-embedded-driver to 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 name

CI workflow

Mirrors _ci-build-tauri-package-app.reusable.yml without the ACL manifest debug step. Uploads src-dioxus/target as a build artifact for use in the package test jobs.

Test plan

  • pnpx tsx scripts/test-package.ts --service=dioxus --skip-build after a manual cargo build in the fixture — confirm the three specs pass
  • pnpx tsx scripts/test-package.ts --service=dioxus — builds, packs, copies embedded driver, runs tests
  • pnpx tsx scripts/test-package.ts --service=tauri — no regression
  • pnpx tsx scripts/test-package.ts --service=electron — no regression

🤖 Generated with Claude Code

goosewobbler and others added 2 commits May 13, 2026 02:25
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-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 13, 2026

Greptile Summary

This PR introduces a self-contained Dioxus package test fixture (fixtures/package-tests/dioxus-app/) that mirrors the existing Tauri fixture, and extends scripts/test-package.ts with full --service=dioxus support including the embedded-driver and bridge copy steps needed for isolated builds.

  • Fixture (fixtures/package-tests/dioxus-app/): adds a minimal Dioxus desktop app with get_platform_info / generate_test_logs backend commands, three spec suites (API, logging, browser-mode smoke), and both native and browser WDIO configs.
  • Script (scripts/test-package.ts): adds dioxus to the service union, packs @wdio/dioxus-service, copies packages/dioxus-embedded-driver + its transitive packages/dioxus-bridge path dep to the isolated temp dir, and rewrites the Cargo.toml path with forward-slash-safe absolute paths.
  • CI workflow (.github/workflows/_ci-build-dioxus-package-app.reusable.yml): mirrors the Tauri reusable build workflow, including Linux dependency installation and src-dioxus/target artifact upload.

Confidence Score: 5/5

All 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.

Important Files Changed

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
Loading

Reviews (6): Last reviewed commit: "fix(dioxus-pkg-test): enable autoXvfb in..." | Re-trigger Greptile

Comment thread scripts/test-package.ts
Comment thread fixtures/package-tests/dioxus-app/test/logging.spec.ts
Comment thread fixtures/package-tests/dioxus-app/test/api.spec.ts
goosewobbler and others added 2 commits May 13, 2026 02:42
- 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>
Comment thread scripts/test-package.ts
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>
Comment thread scripts/test-package.ts
…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>
Comment thread fixtures/package-tests/dioxus-app/wdio.browser.conf.ts Outdated
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>
@goosewobbler goosewobbler merged commit 2b68406 into feat/dioxus-service May 13, 2026
75 checks passed
@goosewobbler goosewobbler deleted the feat/dioxus-phase8 branch May 13, 2026 10:12
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