Skip to main content

Crate rightkit_qa

Crate rightkit_qa 

Source
Expand description

rightkit-qa: the Rust QA harness for Right Suite apps (macOS and Windows).

Replaces @rightkit/qa (embedded-WebDriver launch, run lock, evidence, guard, frames/paint/panes) and the Node e2e harness pattern (tests/e2e/lib.mjs, ui.mjs, scripts/e2e.mjs). Everything is Rust; no Node or Python runtime.

Targets:

  • engine: engine::EngineTarget drives the app engine over CLI words and the framed stdio sidecar.
  • app UI: control::Control launches the real Tauri app hidden/backgrounded and drives it through the in-app rightkit-control server.
  • Chrome: browser feature, through rightkit-browser.

Scenarios are declarative TOML (scenario) run by the CLI, or plain Rust integration tests wrapped by harness::Harness::scenario (tier gating, requires-skip, per-scenario evidence, orphan check). Knobs reach managed (rightkit cargo) test runs through cargo features plus a settings::Settings file, never the caller’s environment.

Validators: media (WAV stats, PNG/frame non-uniformity) and loudness (BS.1770 integrated loudness, range, true peak), pure Rust except where a compressed container needs a caller-supplied ffmpeg. mock::MockServer stands in for paid providers.

Re-exports§

pub use util::Error;
pub use util::Result;

Modules§

audio
Audio is always muted during QA. Apps are told through RIGHTKIT_QA_MUTE=1 and Chrome gets --mute-audio; on macOS the system output can additionally be muted for the run and restored afterwards (opt-in, restored on drop). Playback is asserted from DOM/engine state, never from sound.
check
Assertions over a step’s JSON result: a small path syntax (a.b[0].c, list[*].name) plus value predicates, and ${...} interpolation of saved results into later steps.
config
Per-app config: rightkit-qa.toml, the TOML replacement for right-qa.config.mjs.
control
Drive the real Tauri app through the in-app rightkit-control server.
engine
Black-box driving of an app’s engine binary: one-shot CLI words and the framed stdio sidecar protocol (newline-delimited JSON through rightkit-framed-sidecar). Nothing mocks the engine.
evidence
A receipt that names a file without hashing it is a claim, not evidence. Every artifact is hashed when recorded, a check may only reference hashed artifacts, and the bundle can be re-verified against the filesystem.
guard
The guard that keeps the in-app QA control surface out of production builds.
harness
Scenario wrapper for plain Rust integration tests (#[test] fn x() { h.scenario(...) }).
http
Minimal blocking HTTP/1.1 client over loopback TcpStream. Every call has an explicit deadline: a request that never answers is a failed step, not a hang.
lock
Run lock: one QA run per lock directory. A lock is reclaimed only when its owner is provably gone (pid dead, or the pid now belongs to a different process); a live owner is never displaced however long its run takes. Age applies only to a lock directory that never received an owner record (a crash between mkdir and the owner write).
loudness
Loudness in pure Rust: ITU-R BS.1770-4 integrated loudness (K-weighting, 400 ms blocks with 75 % overlap, -70 LUFS absolute and -10 LU relative gates), EBU Tech 3342 loudness range, sample peak and 4x-oversampled true peak.
media
Content validators for generated artifacts: a file existing is not a result. Pure Rust for WAV/PNG/loudness; ffmpeg (a caller-supplied binary path) only where a compressed container must be decoded. See also crate::loudness.
mock
Local HTTP mock for PAID providers: paid-tier scenarios assert the exact requests the product would send, and never make a billed call.
page
Page-side QA primitives that run through Control::eval (or any evaluator): frame-scoped selectors, painted-not-acknowledged timing, and active-pane geometry. These port the frames, paint, and panes modules of the TS package; the scripts are plain function bodies (return ...).
process
Owned processes: every child is spawned through rightkit-process (process group / Job Object), registered with a Tracker, and killed by recorded pid only. Nothing here ever matches processes by name for killing.
scenario
Declarative scenarios (*.scenario.toml) and the step executor.
settings
Test settings that survive rightkit cargo test.
suite
A QA run: select scenarios by tier, take the run lock, create the isolated workspace, run scenarios sequentially, sweep orphans, and write hashed evidence.
util
Shared error type and small helpers.
workspace
An isolated, reliably removable home for one QA run: own data dir (so the app takes its own single-instance lock), own evidence dir, retrying disposal that reports what it could not remove, and a sweep for crashed runs.