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.
65 lines
2.4 KiB
JavaScript
65 lines
2.4 KiB
JavaScript
import { test, expect } from "@playwright/test";
|
|
async function ready(page) {
|
|
await page.goto("/");
|
|
await expect(
|
|
page.getByRole("button", { name: "Pause", exact: true }),
|
|
).toBeEnabled();
|
|
}
|
|
test("Microduck → Microban → Microduck restores theme, colours and locomotion", async ({
|
|
page,
|
|
}) => {
|
|
const errors = [];
|
|
page.on("pageerror", (e) => errors.push(e.message));
|
|
await ready(page);
|
|
await page.getByRole("button", { name: "Lavender scene lines" }).click();
|
|
await page.getByRole("button", { name: "Rollers", exact: true }).click();
|
|
await page.waitForFunction(() => window.rl?.loco === "rollers");
|
|
await page.getByLabel("Robot", { exact: true }).selectOption("microban");
|
|
await page.waitForFunction(
|
|
() =>
|
|
window.__store.getState().robotId === "microban" ||
|
|
window.__store.getState().runtimeError,
|
|
);
|
|
expect(
|
|
await page.evaluate(() => window.__store.getState().runtimeError),
|
|
).toBeNull();
|
|
await expect(
|
|
page.getByText("Toggle head rotation", { exact: false }),
|
|
).toBeVisible();
|
|
await expect(
|
|
page.getByRole("group", { name: "Scene line colours" }),
|
|
).toBeVisible();
|
|
expect(await page.evaluate(() => window.rl.buildObs().length)).toBe(63);
|
|
await page.getByLabel("Robot", { exact: true }).selectOption("microduck");
|
|
await page.waitForFunction(
|
|
() =>
|
|
window.__store.getState().presentationTheme === "comic" &&
|
|
window.rl?.loco === "rollers",
|
|
);
|
|
await expect(
|
|
page.getByRole("button", { name: "Lavender scene lines" }),
|
|
).toHaveAttribute("aria-pressed", "true");
|
|
expect(await page.evaluate(() => window.rl.data.time)).toBeLessThan(3);
|
|
expect(errors).toEqual([]);
|
|
});
|
|
test("failed switch rolls back and retry does not reload the page", async ({
|
|
page,
|
|
}) => {
|
|
await ready(page);
|
|
let fail = true;
|
|
await page.route("**/robots/microban/policies/walk.onnx", (route) =>
|
|
fail ? route.fulfill({ status: 404, body: "missing" }) : route.continue(),
|
|
);
|
|
await page.getByLabel("Robot", { exact: true }).selectOption("microban");
|
|
await expect(page.getByRole("alert")).toContainText("404");
|
|
expect(await page.evaluate(() => window.__store.getState().robotId)).toBe(
|
|
"microduck-legs",
|
|
);
|
|
expect(await page.evaluate(() => window.rl.running)).toBe(true);
|
|
fail = false;
|
|
await page.getByRole("button", { name: "Retry", exact: true }).click();
|
|
await expect
|
|
.poll(() => page.evaluate(() => window.__store.getState().robotId))
|
|
.toBe("microban");
|
|
});
|