feat: expand sudoku analysis and interoperability

This commit is contained in:
2026-08-30 23:21:56 +02:00
parent 4a9869baa0
commit 8ca9300ab3
73 changed files with 12482 additions and 384 deletions
+111
View File
@@ -116,6 +116,12 @@ test("replaces setter cages and generates a rated variant", async ({
test("uses distinct numbered sum badges and directional inequalities", async ({
page,
}) => {
const runtimeErrors: string[] = [];
page.on("pageerror", (error) => runtimeErrors.push(error.message));
page.on("console", (message) => {
if (message.type() === "error") runtimeErrors.push(message.text());
});
await page.goto("/deep/nested/sudoku/");
const examples = page.getByLabel("Open built-in puzzle");
@@ -136,4 +142,109 @@ test("uses distinct numbered sum badges and directional inequalities", async ({
await expect(
page.locator(".constraint-inequality-tip").first(),
).toBeVisible();
await examples.selectOption("truth-and-lies");
await expect(
page.getByRole("heading", { name: "Truth and lies" }),
).toBeVisible();
await expect(page.locator(".constraint-outside")).toHaveCount(4);
await expect(page.locator(".constraint-quadruple")).toHaveCount(2);
await expect(page.locator(".constraint-maximum")).toHaveCount(2);
await expect(page.locator(".constraint-outside.is-negated")).toHaveCount(2);
await page.setViewportSize({ width: 390, height: 844 });
const outsideBox = await page
.locator(".constraint-outside")
.first()
.boundingBox();
const maximumBox = await page
.locator(".constraint-maximum")
.first()
.boundingBox();
expect(outsideBox?.width ?? 0).toBeGreaterThan(18);
expect(outsideBox?.height ?? 0).toBeGreaterThan(12);
expect(maximumBox?.width ?? 0).toBeGreaterThan(12);
expect(maximumBox?.height ?? 0).toBeGreaterThan(12);
await expect(
page.locator(".constraint-thermo .constraint-false-mark").first(),
).toBeVisible();
expect(runtimeErrors).toEqual([]);
});
test("keeps navigation, scratch work, branches and analysis tools local", async ({
page,
}) => {
const runtimeErrors: string[] = [];
page.on("pageerror", (error) => runtimeErrors.push(error.message));
page.on("console", (message) => {
if (message.type() === "error") runtimeErrors.push(message.text());
});
await page.goto("/deep/nested/sudoku/");
const grid = page.getByRole("grid", { name: "9 by 9 Sudoku grid" });
const first = grid.getByRole("gridcell", {
name: "Row 1, column 1, 4",
});
await first.focus();
await first.press("End");
await expect(
grid.getByRole("gridcell", { name: /Row 1, column 9,/u }),
).toBeFocused();
await page.keyboard.press("PageDown");
await expect(
grid.getByRole("gridcell", { name: /Row 9, column 9,/u }),
).toBeFocused();
await page.keyboard.press("Control+Home");
await expect(first).toBeFocused();
await page.getByLabel("Show aid-mémoire scratch cells").check();
const scratch = page.getByRole("grid", {
name: "9 aid-mémoire scratch cells",
});
const scratchCell = scratch.getByRole("gridcell").first();
await scratchCell.click();
await page
.getByRole("group", { name: "Digits" })
.getByRole("button", { name: "2", exact: true })
.click();
await expect(scratch.getByRole("gridcell").first()).toHaveAccessibleName(
/value 2/u,
);
await page.getByRole("button", { name: "History & branches" }).click();
await page.getByLabel("Savepoint name").fill("Before test branch");
await page.getByRole("button", { name: "Save current grid" }).click();
await expect(
page.getByText("Before test branch", { exact: true }),
).toBeVisible();
await page.getByLabel("Hypothesis name").fill("Try a two");
await page.getByRole("button", { name: "Start hypothesis" }).click();
const empty = grid.getByRole("gridcell", {
name: "Row 1, column 3, empty",
});
await empty.click();
await page
.getByRole("group", { name: "Digits" })
.getByRole("button", { name: "2", exact: true })
.click();
await expect(
grid.getByRole("gridcell", { name: "Row 1, column 3, 2" }),
).toBeVisible();
await page.getByRole("button", { name: "Hypothesis: Try a two" }).click();
await page.getByRole("button", { name: "Discard and return" }).click();
await expect(empty).toBeVisible();
await page.getByRole("button", { name: "Helpers" }).click();
await page.getByRole("tab", { name: "Sum Lab" }).click();
await expect(
page.getByRole("heading", { name: "Generalized Sum Lab" }),
).toBeVisible();
await page.getByRole("tab", { name: "Candidate links" }).click();
await expect(
page.getByRole("heading", { name: "Links and houses" }),
).toBeVisible();
expect(runtimeErrors).toEqual([]);
});