feat(ai-character): 커뮤니티 댓글 첫 답글 작성 지원

This commit is contained in:
Yu Sung
2026-08-06 17:43:43 +09:00
parent e82e209300
commit 00f06b992f
7 changed files with 785 additions and 7 deletions

View File

@@ -87,6 +87,13 @@ test("Audio comments create reply edit AI rows and delete fan or AI rows through
test("Community sheet comments keep two-level controls usable at 320px", async ({ page }) => {
// Given
const commentRequests: { readonly body: string | null; readonly method: string; readonly path: string; readonly search: string }[] = [];
page.on("request", (request) => {
const url = new URL(request.url());
if (url.pathname.includes("/community-posts/7001/comments")) {
commentRequests.push({ body: request.postData(), method: request.method(), path: url.pathname, search: url.search });
}
});
await page.setViewportSize({ width: 320, height: 640 });
await loginThroughMockMode(page);
@@ -99,18 +106,48 @@ test("Community sheet comments keep two-level controls usable at 320px", async (
await expect(dialog.getByRole("heading", { name: "댓글 관리" })).toBeVisible();
await expect(dialog.getByLabel("새 댓글")).toBeInViewport();
await expect(dialog.getByText("커뮤니티 팬 루트 댓글", { exact: true })).toBeVisible();
await expect(dialog.getByRole("button", { name: "커뮤니티 AI 루트 댓글 답글 작성" })).toHaveCount(0);
await expect(dialog.getByRole("button", { name: "커뮤니티 AI 루트 댓글 답글 작성" })).toBeVisible();
await expectNoHorizontalOverflow(page);
// When
await dialog.getByLabel("새 댓글").fill("커뮤니티 루트 생성");
await dialog.getByRole("button", { name: "댓글 등록" }).click();
await expect(dialog.getByText("커뮤니티 루트 생성", { exact: true })).toBeVisible();
await dialog.getByRole("button", { name: "커뮤니티 AI 루트 댓글 답글 작성" }).click();
const emptyReplies = dialog.getByRole("region", { name: "커뮤니티 AI 루트 댓글 답글" });
const emptyReplyInput = emptyReplies.getByLabel("커뮤니티 AI 루트 댓글에 답글");
await expect(emptyReplyInput).toBeVisible();
await expect(emptyReplies.getByText("커뮤니티 팬 루트 댓글", { exact: true })).toHaveCount(0);
await expect.poll(() => commentRequests.filter((request) => request.method === "GET" && request.path.endsWith("/2102/replies") && request.search === "?page=0&size=20")).toHaveLength(1);
await emptyReplyInput.fill(" 커뮤니티 첫 답글 생성 ");
await emptyReplies.getByRole("button", { name: "답글 등록" }).click();
await expect(emptyReplyInput).toHaveValue("");
await emptyReplyInput.fill("커뮤니티 두 번째 답글 생성");
await emptyReplies.getByRole("button", { name: "답글 등록" }).click();
await expect(emptyReplyInput).toHaveValue("");
await expect.poll(() => commentRequests.filter((request) => request.method === "POST")).toEqual([
{ body: JSON.stringify({ comment: "커뮤니티 루트 생성", parentId: null, isSecret: false }), method: "POST", path: "/api/v2/admin/ai-characters/101/community-posts/7001/comments", search: "" },
{ body: JSON.stringify({ comment: "커뮤니티 첫 답글 생성", parentId: 2102, isSecret: false }), method: "POST", path: "/api/v2/admin/ai-characters/101/community-posts/7001/comments", search: "" },
{ body: JSON.stringify({ comment: "커뮤니티 두 번째 답글 생성", parentId: 2102, isSecret: false }), method: "POST", path: "/api/v2/admin/ai-characters/101/community-posts/7001/comments", search: "" },
]);
await dialog.getByRole("button", { name: "닫기" }).click();
await expect(dialog).toBeHidden();
await page.getByRole("button", { name: "오늘의 상담 기록입니다. 게시글 열기" }).click();
await expect(dialog).toBeVisible();
await dialog.getByRole("button", { name: /^커뮤니티 AI 루트 댓글 답글 (작성|보기)$/ }).click();
await expect(emptyReplies).toBeVisible();
await expect(emptyReplies.getByText("커뮤니티 첫 답글 생성", { exact: true })).toBeVisible();
await expect(emptyReplies.getByText("커뮤니티 두 번째 답글 생성", { exact: true })).toBeVisible();
await expect(dialog.getByText("커뮤니티 첫 답글 생성", { exact: true })).toHaveCount(1);
await expect(dialog.getByText("커뮤니티 두 번째 답글 생성", { exact: true })).toHaveCount(1);
await expect(emptyReplies.getByRole("button", { name: /^(커뮤니티 첫 답글 생성|커뮤니티 두 번째 답글 생성) 답글 (작성|보기)$/ })).toHaveCount(0);
const showReplies = dialog.getByRole("button", { name: "커뮤니티 팬 루트 댓글 답글 보기" });
await expect(showReplies).toBeEnabled();
await showReplies.click();
const replies = dialog.getByRole("region", { name: "커뮤니티 팬 루트 댓글 답글" });
await expect(replies).toBeVisible();
await expect(replies.getByText("커뮤니티 AI 답글", { exact: true })).toBeVisible();
await expect(replies.getByRole("button", { name: /^커뮤니티 AI 답글 답글 (작성|보기)$/ })).toHaveCount(0);
await replies.getByLabel("커뮤니티 팬 루트 댓글에 답글").fill("커뮤니티 답글 생성");
await replies.getByRole("button", { name: "답글 등록" }).click();
await replies.getByRole("button", { name: "커뮤니티 AI 답글 수정" }).click();