vignette/apps/web/e2e/avatar-expression-lab.spec.ts
Yun Chan 085460b5e0 대시보드 폴드아웃/드릴다운 정리 + 페르소나 역린·misconduct 반응 + 게이트웨이 격리·RAG 비차단 수정
SSOT 대시보드:
- 한신대 기술분석 PDF(19쪽) 정합성 분석 + 이번 세션 발견 섹션 추가
- 섹션 폴드아웃(접기)·상단 목차(드릴다운)·모두 펼치기/접기 — 내용 보존, 레이아웃만 정리

페르소나 반응 강화('저항·반응 조절' 핵심 차별):
- PersonaCard.triggers(역린) 필드 + CCD 핵심상처 파생 역린 블록
- L0에 무례·모욕·조롱 시 현실적 동맹 균열 반응 지침

버그·성능 수정(라이브/E2E로 포착):
- 게이트웨이 페르소나 격리: --append-system-prompt를 --system-prompt(교체)로 + --exclude-dynamic-system-prompt-sections (내담자 캐릭터 붕괴·개발맥락 누출 차단)
- RAG: 임베더 동기 로드(약 7-13초)를 _warm_rag_caches 백그라운드 warm으로(세션 생성 블로킹 회귀 수정)
- voice TTS RMS 데드힌트 제거, init_state OpennessParams 파라미터객체화
- 한국어 PII(날짜·금액·주소) 마스킹 보강
- 레이아웃 시각 게이트: 폼 컨트롤 값 스크롤 오탐 제외(7/7)

검증: 백엔드 84/84, E2E 42(데스크톱 27·모바일 11·아바타 4), 시각 게이트 7/7
2026-06-27 02:30:46 +09:00

117 lines
4.8 KiB
TypeScript

import { expect, test } from "@playwright/test";
const PERSONAS = [
{ code: "P4", model: "vignette-p4-live2d", defaultExpression: "anxious" },
{ code: "P5", model: "vignette-p5-live2d", defaultExpression: "guarded" },
{ code: "P6", model: "vignette-p6-live2d", defaultExpression: "conflicted" },
{ code: "P7", model: "vignette-p7-live2d", defaultExpression: "tired" },
] as const;
const REQUIRED_EXPRESSIONS = ["joy", "sad", "angry", "rage"] as const;
test.describe("avatar expression lab", () => {
test.beforeEach(async ({ page }) => {
await page.route("**/api/auth/me", (route) =>
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
user_id: "avatar-lab-learner",
email: "learner@hs.ac.kr",
display_name: "Avatar Lab Learner",
role: "learner",
cohort_ids: [],
}),
}),
);
});
test("renders every P4-P7 expression motion as a visible first-party avatar preview", async ({
page,
}) => {
await page.emulateMedia({ reducedMotion: "reduce" });
await page.goto("/learn/avatar-expressions");
const lab = page.locator('[data-avatar-expression-lab="true"]');
await expect(lab).toBeVisible();
await expect(lab).toHaveAttribute("data-persona-count", "4");
await expect(lab).toHaveAttribute("data-expression-count", "28");
await expect(lab).toHaveAttribute("data-rendered-avatar-count", "112");
for (const persona of PERSONAS) {
const panel = page.locator(
`[data-persona-expression-panel="true"][data-persona-code="${persona.code}"]`,
);
const code = persona.code.toLowerCase();
await expect(panel).toHaveAttribute("data-expression-count", "28");
await expect(panel).toHaveAttribute("data-live2d-model", persona.model);
await expect(panel).toHaveAttribute(
"data-live2d-model-url",
`/live2d/personas/${code}/${code}.model3.json`,
);
await expect(panel.locator('[data-expression-card="true"]')).toHaveCount(28);
const sectionMetrics = await panel.evaluate((el) => {
const avatars = Array.from(el.querySelectorAll<HTMLElement>(".axl__card .vg-avatar"));
const invalid = avatars
.map((avatar) => {
const neck = avatar.querySelector<SVGGraphicsElement>('[data-avatar-neck="true"]');
const svg = avatar.querySelector("svg");
return {
affect: avatar.getAttribute("data-affect"),
primitives: avatar.querySelectorAll("svg path, svg ellipse, svg circle, svg line, svg rect")
.length,
neckBox: neck?.getBoundingClientRect().toJSON(),
svgBox: svg?.getBoundingClientRect().toJSON(),
};
})
.filter((item) => {
return (
item.primitives < 12 ||
!item.neckBox ||
item.neckBox.width <= 8 ||
item.neckBox.height <= 14 ||
!item.svgBox ||
item.svgBox.width <= 0 ||
item.svgBox.height <= 0
);
});
return {
avatarCount: avatars.length,
animatedCount: avatars.filter((avatar) => avatar.getAttribute("data-avatar-animated") === "true")
.length,
invalid,
};
});
expect(sectionMetrics.avatarCount, `${persona.code} rendered expression avatars`).toBe(28);
expect(sectionMetrics.animatedCount, `${persona.code} QA avatars should be static`).toBe(0);
expect(sectionMetrics.invalid, `${persona.code} visible avatar geometry`).toEqual([]);
const defaultAvatar = panel.locator(".axl__persona-head .vg-avatar").first();
await expect(defaultAvatar).toHaveAttribute("data-affect", persona.defaultExpression);
await expect(defaultAvatar).toHaveAttribute("data-live2d-model", persona.model);
await expect(defaultAvatar).toHaveAttribute("data-live2d-expression-count", "28");
for (const expression of REQUIRED_EXPRESSIONS) {
const card = panel.locator(
`[data-expression-card="true"][data-expression="${expression}"]`,
);
await expect(card).toHaveAttribute("data-motion-file", `expressions/${expression}.exp3.json`);
await expect(card).toHaveAttribute("data-fade-in-ms", "260");
const avatar = card.locator(".vg-avatar").first();
await expect(avatar).toHaveAttribute("data-affect", expression);
await expect(avatar).toHaveAttribute("data-live2d-motion", expression);
await expect(avatar).toHaveAttribute(
"data-live2d-motion-file",
`expressions/${expression}.exp3.json`,
);
await expect(avatar).toHaveAttribute("data-live2d-expression-count", "28");
await expect(avatar).toHaveAttribute("data-avatar-animated", "false");
}
}
});
});