a8be5e0134
Unify lighting and line-colour controls across robots, replace the football with a shared layout of draggable physical props, and import the supplied RP1 GLBs without changing trained physics or policies. Include reproducible visual import/provenance, regression coverage and verification records. Verified 66 unit tests, 55 browser tests and production-build checks.
40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
import { expect } from "@playwright/test";
|
|
export async function bootDuck(page, { legacyPhysics = false } = {}) {
|
|
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${legacyPhysics ? "&oracle=legacy" : ""}`);
|
|
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()),
|
|
};
|
|
});
|
|
}
|