e2e: character spec — extra attunement slot, AC persistence
- drop the player-card test (components removed) - new: '+ слот' grows attunements to 4+ and a new slot binds an item - new: armor class starts at 16 (mock) and persists through a reload
This commit is contained in:
parent
294bf430fd
commit
f26f3bdf50
@ -14,18 +14,6 @@ function trackErrors(page: Page): string[] {
|
||||
}
|
||||
|
||||
test.describe("character page", () => {
|
||||
test("player card shows the campaign character", async ({ page }) => {
|
||||
const errors = trackErrors(page);
|
||||
await page.goto(`${BASE}/`);
|
||||
|
||||
await expect(page.locator(".player-name")).toHaveText("Абоба «Такелажник» Амогус");
|
||||
await expect(page.locator(".player-class")).toHaveText("Чувствительный молодой человек");
|
||||
await expect(page.locator(".player-level")).toHaveText("уровень 8");
|
||||
await expect(page.locator(".player-xp")).toHaveText("3231 XP");
|
||||
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("add a spell, undo it, redo it", async ({ page }) => {
|
||||
const errors = trackErrors(page);
|
||||
await page.goto(`${BASE}/`);
|
||||
@ -97,4 +85,36 @@ test.describe("character page", () => {
|
||||
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
test("more attunement slots can be added for custom campaigns", async ({ page }) => {
|
||||
const errors = trackErrors(page);
|
||||
await page.goto(`${BASE}/`);
|
||||
|
||||
await expect(page.locator(".attunement-slot")).toHaveCount(3);
|
||||
await page.locator("button[title='Добавить слот привязки']").click();
|
||||
await expect(page.locator(".attunement-slot")).toHaveCount(4);
|
||||
|
||||
const fourth = page.locator(".attunement-slot").nth(3);
|
||||
await fourth.locator("input").fill("Волшебный рог");
|
||||
await fourth.locator("button[title='Привязать предмет']").click();
|
||||
await expect(page.locator(".attuned-item")).toHaveText("Волшебный рог");
|
||||
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("armor class is set manually and persists", async ({ page }) => {
|
||||
const errors = trackErrors(page);
|
||||
await page.goto(`${BASE}/`);
|
||||
|
||||
const ac = page.locator("#ac");
|
||||
await expect(ac).toHaveValue("16");
|
||||
await ac.fill("18");
|
||||
|
||||
// Autosave is debounced by 500 ms; give it time before reloading.
|
||||
await page.waitForTimeout(700);
|
||||
await page.reload();
|
||||
await expect(page.locator("#ac")).toHaveValue("18");
|
||||
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user