13 releases (2 stable)
| 1.0.1 | Jan 14, 2026 |
|---|---|
| 1.0.0 | Jan 8, 2026 |
| 0.5.1 | Jan 8, 2026 |
| 0.4.2 | Jan 5, 2026 |
| 0.1.0 | Dec 10, 2025 |
#86 in WebAssembly
2,482 downloads per month
Used in 16 crates
4.5MB
109K
SLoC
jugar-probar
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.
Installation
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"] }
Quick Start
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"));
}
Features
Playwright Parity
- CSS, text, testid, XPath, role-based locators
- All standard assertions (visibility, text, count)
- All actions (click, fill, type, hover, drag)
- Auto-waiting with configurable timeouts
- Network interception and mobile emulation
WASM-Native Extensions
- Zero-copy memory views - Direct WASM memory inspection
- Type-safe entity selectors - Compile-time verified game object access
- Deterministic replay - Record inputs with seed, replay identically
- Invariant fuzzing - Concolic testing for game invariants
- Frame-perfect timing - Fixed timestep control
- WCAG accessibility - Color contrast and photosensitivity checking
Feature Flags
| Feature | Description |
|---|---|
browser |
CDP browser automation (chromiumoxide, tokio) |
runtime |
WASM runtime testing (wasmtime) |
derive |
Type-safe derive macros (probar-derive) |
Examples
# 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
API Overview
Assertions
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);
GUI Coverage
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%
Simulation
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);
CLI Tool
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
Documentation
License
MIT OR Apache-2.0
Dependencies
~20–51MB
~782K SLoC