Files

41 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

import { test, expect, type Page } from "@playwright/test";
async function createBoard(page: Page, title: string) {
await page.goto("/");
await page.getByTestId("board-title").fill(title);
await page.getByTestId("template").selectOption("mad-sad-glad");
await page.getByTestId("create").click();
await page.waitForURL(/\/b\/.+/);
}
async function joinAs(page: Page, name: string) {
await page.getByTestId("name").fill(name);
await page.getByTestId("join").click();
await expect(page.getByTestId("column").first()).toBeVisible();
}
test("añadir y eliminar columnas", async ({ page }) => {
await createBoard(page, "Retro columnas");
await joinAs(page, "Ana");
await expect(page.getByTestId("column")).toHaveCount(3);
await page.getByTestId("add-column").click();
await expect(page.getByTestId("column")).toHaveCount(4);
// eliminar la última vía menú ⋯
await page.getByTestId("column").last().getByTestId("col-menu").click();
await page.getByTestId("col-delete").click();
await expect(page.getByTestId("column")).toHaveCount(3);
});
test("fases Lluvia/Votación/Discusión", async ({ page }) => {
await createBoard(page, "Retro fases");
await joinAs(page, "Ana");
// por defecto Lluvia (writing) activa
await expect(page.getByTestId("phase-writing")).toHaveClass(/on/);
await page.getByTestId("phase-voting").click();
await expect(page.getByTestId("phase-voting")).toHaveClass(/on/);
await expect(page.getByTestId("phase-writing")).not.toHaveClass(/on/);
});