Skip to content

test(wasm-tauri): prove deterministic offline capture and teardown failures #21

Closed

Description

@zackees

Parent: #14

Dependencies

Purpose

Prove #14 end to end against a real native webview and actual compiled Wasm guest. This acceptance layer must not be made green with mocks, native duplicate guest logic, WebDriver, JavaScript capture, or desktop screenshots.

Scope

Add a focused integration harness that:

  1. Starts an offline loopback HTTP fixture with deterministic HTML, a fixed logical viewport-oriented color pattern, and a load-completion marker.
  2. Builds/uses the actual guest module and launches kernal-api-wasm-tauri as a child process.
  3. Supplies fixture URL and temporary exact .png output path.
  4. Records host timestamps for matching top-level load-finished and capture request.
  5. Decodes the output using portable Rust tooling; checks format, nonzero dimensions, tolerant expected color regions, and capture no earlier than 5.0 seconds after load-finished.
  6. Asserts process exit, webview close, Wasm teardown, and zero live kernel resources.

Cover malformed/non-HTTP(S) URL, disallowed redirect and popup, load timeout, native capture failure, unwritable output, guest trap, cancellation, and stale/cross-instance handles where exposed. Each must return a typed error, remove sibling temp output, leave no partial final PNG, and leak no window/task/guest thread/resource.

Non-goals

No mock runtime, fake screenshot backend, pixel-identical cross-engine hash, remote-network test, test-only ambient filesystem grant, or fixture direct Tauri navigation/capture.

Test design

The fixture may own the loopback server and observe structured trace events, but only CLI → Wasm guest → generated kernel ABI → private adapter performs UI work. Use fixed logical viewport/tolerant color regions because physical scaling and rendering vary by engine.

RED → GREEN acceptance criteria

  • RED: the initial focused test invokes intended real CLI/guest path and fails before the async Tauri/snapshot ABI exists; preserve evidence in PR history instead of committed failing CI.
  • GREEN: test invokes the produced guest module and proves no native duplicate orchestration ran.
  • GREEN: an offline page loads in a real webview and capture is requested >=5.0 seconds after matching top-level finished load.
  • GREEN: final output is a decodable viewport PNG with nonzero dimensions and expected tolerant color regions.
  • GREEN: trace proves generated async ABI crossings and zero resources after success.
  • GREEN: every listed failure gives typed error, removes temp output, leaves no partial final file, and releases windows/tasks/guest resources.
  • GREEN: no path uses WebDriver, injected JS capture, desktop capture, mock runtime, or fixture direct Tauri calls.

Platform concerns

Run against real native webviews on Linux/macOS/Windows; Linux later uses xvfb and WebKitGTK 4.1. The existing Linux-only png dependency cannot unchanged serve all hosts; use portable decoder configuration. Avoid hard-coded physical dimensions/pixel hashes.

Deliverables

Offline fixture, child-process harness, portable PNG assertions, structured timing/resource trace checks, and explicit no-partial-file/no-leak negative tests.

Activity

  1. added
    enhancement
    on Aug 27, 2026
  2. zackees commented on Sep 14, 2026

    @zackees
    CollaboratorAuthor

    Completed by PR #153 (merge fddd176). The offline real-webview guest/CLI integration harness, timing/resource traces, decodable screenshot assertions, negative teardown cases, and native screenshot proof matrix landed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions