Files
VibemakerSandbox/app/e2e/microban-probe.spec.js
chenlin fc5ee4f2c6 feat: release v0.2 multi-robot simulator
Add declarative robot packages, shared simulation lifecycle and Microban ONNX/PD walking with independent head control.

Unify comic UI and chase camera; default robot packages to a 4.5m arena with real collision walls. Include regression tests, asset provenance/licenses and verification evidence.
2026-10-28 14:00:26 +08:00

38 lines
1.4 KiB
JavaScript

import { test, expect } from "@playwright/test";
test("Microban actual WASM simplified PD stands, walks and turns without reset", async ({
page,
}, testInfo) => {
await page.goto("/e2e/fixtures/microban-probe.html");
await page.waitForFunction(() => window.probe || window.probeError);
expect(await page.evaluate(() => window.probeError)).toBeUndefined();
const result = await page.evaluate(async () => {
const p = window.probe,
segments = [];
for (const [name, seconds, vx, wz] of [
["stand", 10, 0, 0],
["forward", 20, 0.15, 0],
["rest", 3, 0, 0],
["backward", 10, -0.1, 0],
["rest", 3, 0, 0],
["left", 10, 0, 0.6],
["rest", 3, 0, 0],
["right", 10, 0, -0.6],
]) {
const before = p.state();
p.command.set([vx, 0, wz]);
await p.step(seconds * 50);
segments.push({ name, before, after: p.state() });
}
return segments;
});
await testInfo.attach("microban-probe.json", {
body: JSON.stringify(result, null, 2),
contentType: "application/json",
});
const forward = result.find((s) => s.name === "forward");
expect(forward.after.pos[0] - forward.before.pos[0]).toBeGreaterThan(0.5);
const backward = result.find((s) => s.name === "backward");
expect(backward.after.pos[0] - backward.before.pos[0]).toBeLessThan(-0.2);
console.log(JSON.stringify(result));
});