| Crates.io | jugar-probar |
| lib.rs | jugar-probar |
| version | 1.0.1 |
| created_at | 2025-12-10 23:12:22.544824+00 |
| updated_at | 2026-01-14 16:44:40.213934+00 |
| description | Probar: Rust-native testing framework for WASM games |
| homepage | |
| repository | https://github.com/paiml/probar |
| max_upload_size | |
| id | 1978915 |
| size | 5,107,976 |
jugar-probar is the Rust library for Probar - a Playwright-compatible testing framework for WASM games and applications.
Note: The CLI tool is published separately as probador.
Add to your Cargo.toml:
[dev-dependencies]
jugar-probar = "0.3"
With specific features:
[dev-dependencies]
jugar-probar = { version = "0.3", features = ["browser", "runtime", "derive"] }
use jugar_probar::prelude::*;
#[test]
fn test_game_starts() {
// Create test platform
let config = WebConfig::new(800, 600);
let mut platform = WebPlatform::new_for_test(config);
// Run initial frame
let output = platform.frame(0.0, "[]");
// Verify game started
assert!(output.contains("commands"));
}
| Feature | Description |
|---|---|
browser |
CDP browser automation (chromiumoxide, tokio) |
runtime |
WASM runtime testing (wasmtime) |
derive |
Type-safe derive macros (probar-derive) |
# Deterministic simulation with replay verification
cargo run --example pong_simulation -p jugar-probar
# Playwright-style locator API demo
cargo run --example locator_demo -p jugar-probar
# WCAG accessibility checking
cargo run --example accessibility_demo -p jugar-probar
# GUI coverage tracking
cargo run --example gui_coverage -p jugar-probar
use jugar_probar::Assertion;
// Value equality
let eq = Assertion::equals(&actual, &expected);
// Numeric range
let range = Assertion::in_range(value, 0.0, 100.0);
// Boolean checks
let truthy = Assertion::is_true(condition);
// Approximate equality (floats)
let approx = Assertion::approx_eq(3.14159, std::f64::consts::PI, 0.001);
use jugar_probar::gui_coverage;
let mut gui = gui_coverage! {
buttons: ["start", "pause", "quit"],
screens: ["title", "playing", "game_over"]
};
gui.click("start");
gui.visit("title");
println!("{}", gui.summary()); // "GUI: 33% (1/3 elements, 1/3 screens)"
assert!(gui.meets(80.0)); // Fail if below 80%
use jugar_probar::{run_simulation, run_replay, SimulationConfig, InputEvent};
// Record a simulation
let config = SimulationConfig::new(seed, frames);
let recording = run_simulation(config, |frame| {
vec![InputEvent::key_press("ArrowUp")]
});
// Replay and verify determinism
let replay = run_replay(&recording);
assert!(replay.determinism_verified);
For command-line usage, install the CLI separately:
cargo install probador
# Validate playbook state machines
probador playbook login.yaml --validate
# Run mutation testing
probador playbook login.yaml --mutate
# Export state diagrams
probador playbook login.yaml --export svg -o diagram.svg
MIT OR Apache-2.0