세션 평가와 교수자 분석 보강
This commit is contained in:
parent
5c4ac04e06
commit
fe2796f05a
51 changed files with 4928 additions and 240 deletions
|
|
@ -38,6 +38,93 @@ const GATE_WIDTHS = [
|
|||
] as const;
|
||||
|
||||
const SHOT_DIR = path.join(process.cwd(), "node_modules", ".tmp", "layout-gate");
|
||||
const TEACHER_REVIEW_SESSION_ID = "teacher-review-visual";
|
||||
|
||||
function teacherAnalysisFixture() {
|
||||
const learnerId = "visual-analysis-learner";
|
||||
const sessions = Array.from({ length: 5 }, (_unused, index) => {
|
||||
const sessionNo = index + 1;
|
||||
return {
|
||||
session_id: `${learnerId}-session-${sessionNo}`,
|
||||
learner_id: learnerId,
|
||||
learner_label: "분석 검증 학습자",
|
||||
persona_code: sessionNo % 2 === 0 ? "P2" : "P1",
|
||||
persona_name: sessionNo % 2 === 0 ? "민재" : "서연",
|
||||
session_no: sessionNo,
|
||||
status: "ended",
|
||||
stage: sessionNo >= 4 ? "개입" : "탐색",
|
||||
turn_count: 8 + sessionNo,
|
||||
learner_turn_count: 4 + sessionNo,
|
||||
client_turn_count: 4,
|
||||
started_at: `2026-06-${String(10 + sessionNo).padStart(2, "0")}T09:00:00Z`,
|
||||
ended_at: `2026-06-${String(10 + sessionNo).padStart(2, "0")}T09:30:00Z`,
|
||||
review_status: sessionNo === 3 ? "closed" : "pending",
|
||||
review_note: null,
|
||||
reviewed_at: sessionNo === 3 ? "2026-06-13T10:00:00Z" : null,
|
||||
};
|
||||
});
|
||||
const points = sessions.map((session) => ({
|
||||
session_id: session.session_id,
|
||||
session_no: session.session_no,
|
||||
persona_code: session.persona_code,
|
||||
stage: session.stage,
|
||||
started_at: session.started_at,
|
||||
ended_at: session.ended_at,
|
||||
score: session.session_no >= 4 ? 0.88 : 0.52,
|
||||
rapport: Math.min(0.8, session.session_no * 0.12),
|
||||
technique_count: session.session_no + 1,
|
||||
watch_count: session.session_no < 4 ? 1 : 0,
|
||||
}));
|
||||
const summary = {
|
||||
learner_id: learnerId,
|
||||
learner_label: "분석 검증 학습자",
|
||||
sessions: sessions.length,
|
||||
ended_sessions: sessions.length,
|
||||
latest_at: sessions[sessions.length - 1].ended_at ?? "",
|
||||
first_score: points[0].score,
|
||||
latest_score: points[points.length - 1].score,
|
||||
score_delta: (points[points.length - 1].score ?? 0) - (points[0].score ?? 0),
|
||||
avg_score: 0.72,
|
||||
avg_rapport: 0.44,
|
||||
trend: "up",
|
||||
top_techniques: ["reflection", "summary"],
|
||||
points,
|
||||
};
|
||||
|
||||
return {
|
||||
dashboard: {
|
||||
source: "database",
|
||||
cohort_label: "Visual cohort",
|
||||
total_learners: 1,
|
||||
active_sessions: 0,
|
||||
ended_sessions: sessions.length,
|
||||
learner_growth: [{ ...summary, points: points.slice(-4) }],
|
||||
safety_alerts: [],
|
||||
pending_reviews: [],
|
||||
recent_sessions: sessions.slice(-2),
|
||||
message: "학생 분석 시각 검증 fixture.",
|
||||
},
|
||||
analysis: {
|
||||
source: "database",
|
||||
learner_id: learnerId,
|
||||
learner_label: "분석 검증 학습자",
|
||||
total_sessions: sessions.length,
|
||||
ended_sessions: sessions.length,
|
||||
active_sessions: 0,
|
||||
pending_reviews: 2,
|
||||
summary,
|
||||
points,
|
||||
stage_breakdown: [
|
||||
{ stage: "라포", sessions: 0, turns: 0 },
|
||||
{ stage: "탐색", sessions: 3, turns: 31 },
|
||||
{ stage: "개입", sessions: 2, turns: 22 },
|
||||
{ stage: "정리", sessions: 0, turns: 0 },
|
||||
],
|
||||
sessions,
|
||||
message: "분석 검증 학습자 전체 회기 5건",
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function ensureShotDir() {
|
||||
await fs.mkdir(SHOT_DIR, { recursive: true });
|
||||
|
|
@ -284,6 +371,76 @@ async function expectFilledReviewLearnerWorkbench(page: Page) {
|
|||
}
|
||||
}
|
||||
|
||||
async function expectSupervisorReviewNoDeadGaps(page: Page) {
|
||||
const report = await page.evaluate(() => {
|
||||
const cols = document.querySelector<HTMLElement>(".sr-cols--supervisor");
|
||||
const left = document.querySelector<HTMLElement>(".sr-cols--supervisor .sr-left");
|
||||
const right = document.querySelector<HTMLElement>(".sr-cols--supervisor .sr-right");
|
||||
if (!cols || !left || !right) {
|
||||
return {
|
||||
present: false,
|
||||
viewportWidth: window.innerWidth,
|
||||
columnCount: 0,
|
||||
leftDisplay: "",
|
||||
rightDisplay: "",
|
||||
maxMainGap: 0,
|
||||
maxSideGap: 0,
|
||||
};
|
||||
}
|
||||
|
||||
function maxVerticalGap(container: HTMLElement) {
|
||||
const intervals = Array.from(container.children)
|
||||
.map((child) => child.getBoundingClientRect())
|
||||
.filter((rect) => rect.width > 0 && rect.height > 0)
|
||||
.map((rect) => ({ top: rect.top, bottom: rect.bottom }))
|
||||
.sort((a, b) => a.top - b.top || a.bottom - b.bottom);
|
||||
if (intervals.length < 2) return 0;
|
||||
|
||||
let maxGap = 0;
|
||||
let currentBottom = intervals[0].bottom;
|
||||
for (let index = 1; index < intervals.length; index += 1) {
|
||||
const next = intervals[index];
|
||||
if (next.top <= currentBottom) {
|
||||
currentBottom = Math.max(currentBottom, next.bottom);
|
||||
continue;
|
||||
}
|
||||
const gap = next.top - currentBottom;
|
||||
if (gap > maxGap) maxGap = gap;
|
||||
currentBottom = next.bottom;
|
||||
}
|
||||
return Math.round(maxGap);
|
||||
}
|
||||
|
||||
const colsStyle = getComputedStyle(cols);
|
||||
const leftStyle = getComputedStyle(left);
|
||||
const rightStyle = getComputedStyle(right);
|
||||
return {
|
||||
present: true,
|
||||
viewportWidth: window.innerWidth,
|
||||
columnCount: colsStyle.gridTemplateColumns.split(" ").filter(Boolean).length,
|
||||
leftDisplay: leftStyle.display,
|
||||
rightDisplay: rightStyle.display,
|
||||
maxMainGap: maxVerticalGap(left),
|
||||
maxSideGap: maxVerticalGap(right),
|
||||
};
|
||||
});
|
||||
|
||||
expect(report.present, "supervisor review layout should be mounted").toBe(true);
|
||||
if (report.viewportWidth > 1180) {
|
||||
expect(report.columnCount, "desktop supervisor review should use main + review rail").toBe(2);
|
||||
expect(report.leftDisplay).toBe("grid");
|
||||
expect(report.rightDisplay).toBe("grid");
|
||||
expect(
|
||||
report.maxMainGap,
|
||||
"desktop supervisor review main column should not leave a dead vertical void",
|
||||
).toBeLessThanOrEqual(40);
|
||||
expect(
|
||||
report.maxSideGap,
|
||||
"desktop supervisor review side rail should not leave a dead vertical void",
|
||||
).toBeLessThanOrEqual(40);
|
||||
}
|
||||
}
|
||||
|
||||
test.describe("layout visual gate @single-run", () => {
|
||||
test.describe.configure({ mode: "serial" });
|
||||
|
||||
|
|
@ -367,6 +524,18 @@ test.describe("layout visual gate @single-run", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("professor session review avoids dead vertical gaps across all widths", async ({ page }) => {
|
||||
await signInAsTeacher(page);
|
||||
await routeFilledSessionReview(page, TEACHER_REVIEW_SESSION_ID);
|
||||
await page.goto(`/teach/session/${TEACHER_REVIEW_SESSION_ID}/review`);
|
||||
await gateScreen(page, "session-review-professor", async () => {
|
||||
await expect(page.locator(".sr-cols--supervisor")).toBeVisible({ timeout: 15_000 });
|
||||
await expect(page.getByText("교수자 검토", { exact: true })).toBeVisible();
|
||||
await expect(page.getByText("세션 트랜스크립트")).toBeVisible();
|
||||
await expectSupervisorReviewNoDeadGaps(page);
|
||||
});
|
||||
});
|
||||
|
||||
test("empty session review avoids sparse column gaps across all widths", async ({ page }) => {
|
||||
await signInAsLearner(page);
|
||||
await routeEmptySessionReview(page);
|
||||
|
|
@ -390,6 +559,33 @@ test.describe("layout visual gate @single-run", () => {
|
|||
});
|
||||
});
|
||||
|
||||
test("professor student analysis stays contained across all widths", async ({ page }) => {
|
||||
const fixture = teacherAnalysisFixture();
|
||||
await page.route("**/api/teacher/dashboard", (route) =>
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(fixture.dashboard),
|
||||
}),
|
||||
);
|
||||
await page.route("**/api/teacher/learners/*/analysis", (route) =>
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
contentType: "application/json",
|
||||
body: JSON.stringify(fixture.analysis),
|
||||
}),
|
||||
);
|
||||
await signInAsTeacher(page);
|
||||
await page.goto("/teach/analysis");
|
||||
await gateScreen(page, "professor-analysis", async () => {
|
||||
await expect(page.locator(".pf-analysis-shell")).toBeVisible({ timeout: 15_000 });
|
||||
await expect(page.locator('[data-learner-analysis-panel="true"]')).toBeVisible({
|
||||
timeout: 15_000,
|
||||
});
|
||||
await expect(page.locator('[data-learner-session-row="true"]')).toHaveCount(5);
|
||||
});
|
||||
});
|
||||
|
||||
test("persona studio stays contained across all widths", async ({ page }) => {
|
||||
await signInAsTeacher(page);
|
||||
await page.goto("/teach/personas");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue