Add custom campaign roll composer
This commit is contained in:
@@ -98,6 +98,38 @@ test("newly rolled log entry auto-expands", async ({ page, context }) => {
|
||||
await expect(expandedEntry.locator(".log-detail .roll-dice-strip")).toBeVisible();
|
||||
});
|
||||
|
||||
test("custom roll composer keeps parse errors inline and records successful rolls", async ({ page, context }) => {
|
||||
const username = `custom-roll-${Date.now()}`;
|
||||
await registerAndLogin(context.request, username, "Custom Roller");
|
||||
|
||||
const campaign = await postJson(context.request, "/api/campaigns", {
|
||||
name: "Custom Roll Campaign",
|
||||
rulesetId: "dnd5e"
|
||||
});
|
||||
await postJson(context.request, "/api/characters", {
|
||||
name: "Improviser",
|
||||
campaignId: campaign.id
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await expect(page.getByText("Campaign Log")).toBeVisible();
|
||||
|
||||
const composer = page.locator(".custom-roll-composer");
|
||||
const input = page.locator("#custom-roll-expression");
|
||||
await input.fill("bad");
|
||||
await composer.getByRole("button", { name: "Roll" }).click();
|
||||
|
||||
await expect(input).toHaveClass(/error/);
|
||||
await expect(input).toHaveAttribute("title", /Expected dnd5e format like 2d12\+2\./);
|
||||
await expect(page.locator(".toast.error")).toHaveCount(0);
|
||||
|
||||
await input.fill("1d20+5");
|
||||
await composer.getByRole("button", { name: "Roll" }).click();
|
||||
|
||||
await expect(input).not.toHaveClass(/error/);
|
||||
await expect(page.locator(".log-panel .log-entry").first()).toContainText("Custom roll");
|
||||
});
|
||||
|
||||
test("Rolemaster UI exposes conditional create and edit fields", async ({ page, context }) => {
|
||||
const username = `rm-ui-${Date.now()}`;
|
||||
await registerAndLogin(context.request, username, "Rolemaster UI");
|
||||
|
||||
Reference in New Issue
Block a user