fa089d5f0c
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.
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
import { expect } from "@playwright/test";
|
|
export async function bootDuck(page) {
|
|
const errors = [];
|
|
page.on("pageerror", (e) => errors.push(e.message));
|
|
await page.addInitScript(() => {
|
|
let seed = 123456789;
|
|
Math.random = () =>
|
|
(seed = (1664525 * seed + 1013904223) >>> 0) / 4294967296;
|
|
});
|
|
await page.goto("/?boot=1&test=1");
|
|
await page.waitForFunction(
|
|
() => window.rl?.prepareTest || window.__store?.getState().bootFailed,
|
|
);
|
|
const failed = await page.evaluate(
|
|
() => window.__store.getState().bootFailed,
|
|
);
|
|
expect(
|
|
failed,
|
|
JSON.stringify(await page.evaluate(() => window.__store.getState())),
|
|
).toBe(false);
|
|
await page.evaluate(() => window.rl.prepareTest());
|
|
expect(errors).toEqual([]);
|
|
return errors;
|
|
}
|
|
export async function snapshot(page) {
|
|
return page.evaluate(() => {
|
|
const r = window.rl;
|
|
return {
|
|
time: r.data.time,
|
|
mode: r.mode,
|
|
recovery: r.recovery,
|
|
qpos: Array.from(r.data.qpos),
|
|
qvel: Array.from(r.data.qvel),
|
|
ctrl: Array.from(r.data.ctrl),
|
|
lastAction: Array.from(r.lastAction),
|
|
obs: Array.from(r.buildObs()),
|
|
};
|
|
});
|
|
}
|