관리자 빈 화면 진단
This commit is contained in:
parent
0324df7c4d
commit
50524f14ae
6 changed files with 556 additions and 12 deletions
|
|
@ -158,6 +158,9 @@ async function mockAdminSession(
|
|||
super_admin: boolean;
|
||||
onboarding_completed_at: number | null;
|
||||
}> = {},
|
||||
options: {
|
||||
adminUsers?: unknown[];
|
||||
} = {},
|
||||
) {
|
||||
const seenAdminEndpoints = new Set<string>();
|
||||
const json = (body: unknown) => JSON.stringify(body);
|
||||
|
|
@ -210,7 +213,7 @@ async function mockAdminSession(
|
|||
await fulfillJson({
|
||||
source: "database",
|
||||
durable: true,
|
||||
users: [],
|
||||
users: options.adminUsers ?? [],
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
|
@ -659,6 +662,48 @@ test.describe("admin route guards", () => {
|
|||
.toBe(0);
|
||||
await expect(page.getByRole("heading", { name: "역할, 그룹, 접근 범위" })).toBeInViewport();
|
||||
});
|
||||
|
||||
test("shows admin data diagnostics instead of a blank main pane", async ({ page }) => {
|
||||
await mockAdminSession(
|
||||
page,
|
||||
{
|
||||
user_id: "diagnostic-admin",
|
||||
email: "diagnostic-admin@twentyoz.kr",
|
||||
display_name: "Diagnostic Admin",
|
||||
role: "admin",
|
||||
admin_access: true,
|
||||
super_admin: true,
|
||||
onboarding_completed_at: 1_782_900_000,
|
||||
},
|
||||
{
|
||||
adminUsers: [
|
||||
{
|
||||
user_id: "bad-user",
|
||||
email: "bad-user@hs.ac.kr",
|
||||
display_name: "Bad User",
|
||||
role: "learner",
|
||||
admin_access: false,
|
||||
super_admin: false,
|
||||
account_status: "pending",
|
||||
affiliation: null,
|
||||
cohort_ids: null,
|
||||
active_sessions: null,
|
||||
created_at: null,
|
||||
last_seen_at: null,
|
||||
source: "database",
|
||||
},
|
||||
],
|
||||
},
|
||||
);
|
||||
|
||||
await page.goto("/admin/users");
|
||||
|
||||
await expect(page.getByRole("heading", { name: "가입 승인과 권한 관리" })).toBeVisible();
|
||||
await expect(page.locator(".ad-diagnostic")).toContainText("관리자 데이터 진단");
|
||||
await expect(page.locator(".ad-diagnostic")).toContainText("cohort_ids");
|
||||
await expect(page.locator(".ad-diagnostic")).toContainText("active_sessions");
|
||||
await expect(page.getByText("Bad User")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("admin route", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue