You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
2.3 KiB
TypeScript
55 lines
2.3 KiB
TypeScript
// frontend/playwright/proactive.spec.ts — 능동 배너(대시보드 상단) + 수락/닫기 + a11y
|
|
import AxeBuilder from "@axe-core/playwright";
|
|
import { expect, test } from "@playwright/test";
|
|
|
|
import { resetSeed } from "./fixtures/seed-reset";
|
|
|
|
test.describe.configure({ mode: "serial" });
|
|
|
|
test.beforeEach(async () => {
|
|
await resetSeed();
|
|
});
|
|
|
|
test("대시보드 상단 능동 배너 2장 + aria-live", async ({ page }) => {
|
|
await page.goto("/dashboard");
|
|
const banner = page.locator(".proactive");
|
|
await expect(banner).toBeVisible();
|
|
await expect(banner).toHaveAttribute("aria-live", "polite");
|
|
await expect(banner.locator(".pc")).toHaveCount(2);
|
|
await expect(page.getByText("내일 미팅 3연속 — 점심 비워뒀어요")).toBeVisible();
|
|
await expect(page.getByText(/ChatGPT Plus 청구서가 평소보다/)).toBeVisible();
|
|
});
|
|
|
|
test("능동 카드 수락 → 사라짐(실체화)", async ({ page }) => {
|
|
await page.goto("/dashboard");
|
|
const meeting = page.locator(".pc", { hasText: "내일 미팅 3연속" });
|
|
await meeting.getByRole("button", { name: "그대로 둘게요" }).click();
|
|
await expect(page.getByText("내일 미팅 3연속 — 점심 비워뒀어요")).toHaveCount(0);
|
|
});
|
|
|
|
test("능동 카드 닫기 → 사라짐", async ({ page }) => {
|
|
await page.goto("/dashboard");
|
|
const bill = page.locator(".pc", { hasText: "ChatGPT Plus" });
|
|
await bill.getByRole("button", { name: "이 제안 닫기" }).click();
|
|
await expect(page.getByText(/ChatGPT Plus 청구서가 평소보다/)).toHaveCount(0);
|
|
});
|
|
|
|
test("주간 리뷰 카드 — 딥워크/회의 + 패턴 제안", async ({ page }) => {
|
|
await page.goto("/dashboard");
|
|
const weekly = page.locator("section.weekly");
|
|
await expect(weekly).toBeVisible();
|
|
await expect(weekly).toContainText("8");
|
|
await expect(weekly).toContainText("12");
|
|
await expect(weekly).toContainText("보호할까요");
|
|
});
|
|
|
|
test("a11y: 능동 배너 있는 대시보드 — 위반 0건", async ({ page }) => {
|
|
await page.goto("/dashboard");
|
|
await page.locator(".proactive").waitFor();
|
|
const r = await new AxeBuilder({ page })
|
|
.withTags(["wcag2a", "wcag2aa", "wcag21aa"])
|
|
.disableRules(["color-contrast"])
|
|
.analyze();
|
|
expect(r.violations, JSON.stringify(r.violations, null, 2)).toEqual([]);
|
|
});
|