운영 안정화와 화면 회귀 검증을 반영
Some checks failed
API contract / OpenAPI type drift (push) Failing after 6m2s

This commit is contained in:
Yun Chan 2026-10-20 16:33:48 +09:00
parent 6e3123091a
commit aeddaa6972
69 changed files with 3178 additions and 424 deletions

View file

@ -177,6 +177,83 @@ interface AdminTicketsResponse {
};
}
interface NavigationExpectation {
path: string;
label: string;
mobilePrimary: boolean;
}
const ADMIN_NAVIGATION_ITEMS: NavigationExpectation[] = [
{ path: "/admin", label: "운영 홈", mobilePrimary: true },
{ path: "/admin/ai", label: "AI 운영", mobilePrimary: true },
{ path: "/admin/emotions", label: "감정 관측", mobilePrimary: false },
{ path: "/admin/continuous-improvement", label: "지속 개선", mobilePrimary: false },
{ path: "/admin/users", label: "사용자 관리", mobilePrimary: true },
{ path: "/admin/access", label: "접근 관리", mobilePrimary: false },
{ path: "/admin/tickets", label: "지원 요청", mobilePrimary: false },
];
const ADMIN_WORKSPACE_NAVIGATION_ITEMS: NavigationExpectation[] = [
...ADMIN_NAVIGATION_ITEMS,
{ path: "/teach", label: "교수자 홈", mobilePrimary: false },
{ path: "/teach/analysis", label: "학생 분석", mobilePrimary: false },
{ path: "/teach/supervision", label: "감독·연구", mobilePrimary: false },
{ path: "/teach/personas", label: "내담자 설정", mobilePrimary: false },
{ path: "/learn", label: "학습자 홈", mobilePrimary: false },
{ path: "/learn/practice", label: "상담 연습", mobilePrimary: false },
{ path: "/learn/history", label: "학습 기록", mobilePrimary: false },
{ path: "/settings", label: "설정", mobilePrimary: false },
];
const LEARNER_HOME_NAVIGATION: NavigationExpectation = {
path: "/learn",
label: "학습자 홈",
mobilePrimary: false,
};
const LEARNER_ADMIN_ENTRY_NAVIGATION: NavigationExpectation = {
path: "/admin",
label: "운영 홈",
mobilePrimary: false,
};
async function expectNavigationTarget(
page: Page,
target: NavigationExpectation,
options: { navigate?: boolean } = {},
) {
const navigate = options.navigate ?? true;
const originalUrl = page.url();
const nav = page.locator(".vg-nav");
const directLink = nav.getByRole("link", { name: target.label, exact: true });
const mobile = await page.evaluate(() => window.matchMedia("(max-width: 720px)").matches);
if (!mobile || target.mobilePrimary) {
await expect(directLink).toBeVisible();
await expect(directLink).toHaveAttribute("href", target.path);
if (navigate) await directLink.click();
} else {
await expect(directLink).not.toBeVisible();
const menuButton = nav.getByRole("button", { name: "전체 메뉴", exact: true });
await expect(menuButton).toBeVisible();
await menuButton.click();
const menuDialog = page.locator("#vg-all-menu-dialog");
await expect(menuDialog).toHaveAttribute("open", "");
const menuLink = menuDialog.getByRole("link", { name: target.label, exact: true });
await expect(menuLink).toBeVisible();
await expect(menuLink).toHaveAttribute("href", target.path);
if (navigate) {
await menuLink.click();
} else {
await menuDialog.getByRole("button", { name: "전체 메뉴 닫기", exact: true }).click();
}
await expect(menuDialog).not.toHaveAttribute("open", "");
}
await expect(page).toHaveURL(navigate ? new RegExp(`${target.path}$`) : originalUrl);
}
async function expectResponseOk(response: APIResponse | Response) {
if (!response.ok()) {
expect(response.ok(), await response.text()).toBeTruthy();
@ -864,11 +941,11 @@ test.describe("admin route guards", () => {
await page.goto(route.path);
await expect(page).toHaveURL(new RegExp(`${route.path.replace("/", "\\/")}$`));
await expect(page.getByRole("heading", { name: route.heading })).toBeVisible();
await expect(page.locator(".vg-nav").getByRole("link", { name: "운영 홈" })).toBeVisible();
await expect(page.locator(".vg-nav").getByRole("link", { name: "AI 운영" })).toBeVisible();
await expect(page.locator(".vg-nav").getByRole("link", { name: "사용자" })).toBeVisible();
await expect(page.locator(".vg-nav").getByRole("link", { name: "권한" })).toBeVisible();
await expect(page.locator(".vg-nav").getByRole("link", { name: "티켓" })).toBeVisible();
for (const target of ADMIN_NAVIGATION_ITEMS.filter((item) =>
["/admin", "/admin/ai", "/admin/users", "/admin/access", "/admin/tickets"].includes(item.path),
)) {
await expectNavigationTarget(page, target, { navigate: false });
}
}
}
});
@ -888,12 +965,10 @@ test.describe("admin route guards", () => {
await page.goto("/admin");
await expect(page.getByRole("heading", { name: "현재 서비스 상태" })).toBeVisible();
await page.locator(".vg-nav").getByRole("link", { name: "학습자 홈" }).click();
await expectNavigationTarget(page, LEARNER_HOME_NAVIGATION);
await expect(page).toHaveURL(/\/learn$/);
await expect(page.locator(".vg-nav").getByRole("link", { name: "운영 콘솔" })).toBeVisible();
await page.locator(".vg-nav").getByRole("link", { name: "운영 콘솔" }).click();
await expectNavigationTarget(page, LEARNER_ADMIN_ENTRY_NAVIGATION);
await expect(page).toHaveURL(/\/admin$/);
await expect(page.getByRole("heading", { name: "현재 서비스 상태" })).toBeVisible();
});
@ -1271,7 +1346,11 @@ test.describe("admin route guards", () => {
});
expect(scrolled).toBeGreaterThan(0);
await page.locator(".vg-nav").getByRole("link", { name: "권한" }).click();
await expectNavigationTarget(page, {
path: "/admin/access",
label: "접근 관리",
mobilePrimary: false,
});
await expect(page).toHaveURL(/\/admin\/access$/);
await expect
@ -1532,26 +1611,28 @@ test.describe("admin route", () => {
await signInAsAdmin(page);
await page.goto("/admin");
const nav = page.locator(".vg-nav");
await expect(nav.getByRole("link", { name: "운영 홈" })).toBeVisible();
await expect(nav.getByRole("link", { name: "AI 운영" })).toBeVisible();
await expect(nav.getByRole("link", { name: "사용자" })).toBeVisible();
await expect(nav.getByRole("link", { name: "권한" })).toBeVisible();
await expect(nav.getByRole("link", { name: "티켓" })).toBeVisible();
await expect(nav.getByRole("link", { name: "교수 콘솔" })).toBeVisible();
await expect(nav.getByRole("link", { name: "페르소나" })).toBeVisible();
await expect(nav.getByRole("link", { name: "학습자 홈" })).toBeVisible();
await expect(nav.getByRole("link", { name: "학습", exact: true })).toBeVisible();
await expect(nav.getByRole("link", { name: "기록" })).toBeVisible();
for (const target of ADMIN_WORKSPACE_NAVIGATION_ITEMS) {
await page.goto("/admin");
await expectNavigationTarget(page, target);
}
await nav.getByRole("link", { name: "교수 콘솔" }).click();
await page.goto("/admin");
await expectNavigationTarget(page, {
path: "/teach",
label: "교수자 홈",
mobilePrimary: false,
});
await expect(page).toHaveURL(/\/teach$/);
await expect(page.locator(".pf-root")).toBeVisible();
await page.goto("/admin");
await page.locator(".vg-nav").getByRole("link", { name: "학습자 홈" }).click();
await expectNavigationTarget(page, {
path: "/learn",
label: "학습자 홈",
mobilePrimary: false,
});
await expect(page).toHaveURL(/\/learn$/);
await expect(page.getByRole("heading", { name: "오늘 이어갈 회기를 먼저 봅니다." })).toBeVisible();
await expect(page.getByRole("heading", { name: "오늘의 상담 연습" })).toBeVisible();
await expectNoHorizontalOverflow(page);
});
@ -1560,7 +1641,7 @@ test.describe("admin route", () => {
await signInAsAdmin(page);
const slug = `${testInfo.project.name}.${testInfo.workerIndex}.${testInfo.retry}.${Date.now()}`;
const email = `admin-users.${slug}@hs.ac.kr`.toLowerCase();
const email = `admin-users.${slug}@example.net`.toLowerCase();
const displayName = `관리 대상 ${testInfo.project.name}`;
const users = await openAdminAndReadUsers(page);
expect(users.source).toBe("database");
@ -1575,9 +1656,10 @@ test.describe("admin route", () => {
const userTable = page.getByRole("table");
await expect(userTable).toBeVisible();
const sessionHeader = page.getByRole("columnheader", { name: /활성 회기/ });
const sessionColumn = await sessionHeader.evaluate((header) => (header as HTMLTableCellElement).cellIndex + 1);
await sessionHeader.getByRole("button").click();
await expect(sessionHeader).toHaveAttribute("aria-sort", "ascending");
const ascendingSessions = await userTable.locator("tbody tr td:nth-child(7)").allTextContents();
const ascendingSessions = await userTable.locator(`tbody tr td:nth-child(${sessionColumn})`).allTextContents();
expect(ascendingSessions.map(Number)).toEqual(
ascendingSessions.map(Number).slice().sort((a, b) => a - b),
);
@ -1761,7 +1843,7 @@ test.describe("admin route", () => {
const card = page.locator(".vgops-ticket").filter({ hasText: subject });
await expect(card).toBeVisible();
await expect(card).toContainText("높음");
await expect(card).toContainText("미해결");
await expect(card.getByText("접수", { exact: true })).toBeVisible();
const patchPromise = page.waitForResponse(isAdminTicketPatch(created.ticket_id));
await card.getByRole("button", { name: "해결" }).click();