1
0
forked from baron/baron-sso

권한부여 및 정합성 검사 추가

This commit is contained in:
2026-05-14 08:45:48 +09:00
parent f6f8e88342
commit 9ca73e8774
36 changed files with 1772 additions and 105 deletions

View File

@@ -143,9 +143,10 @@ test.describe("Bulk Actions and Tree Search", () => {
const selectionBar = page.getByTestId("bulk-action-bar");
await expect(selectionBar).toBeVisible({ timeout: 15000 });
// 활성화 버튼 확인
const activeBtn = page.getByTestId("bulk-active-btn");
await expect(activeBtn).toBeVisible({ timeout: 10000 });
await expect(page.getByTestId("bulk-status-select")).toBeVisible({
timeout: 10000,
});
await expect(page.getByTestId("bulk-apply-status-btn")).toBeVisible();
// 전체 선택
await page.locator('table input[type="checkbox"]').first().click();
@@ -158,7 +159,7 @@ test.describe("Bulk Actions and Tree Search", () => {
await expect(selectionBar).not.toBeVisible({ timeout: 10000 });
});
test("should let super admins promote selected users to super admin", async ({
test("should apply selected bulk status to selected users", async ({
page,
}) => {
let capturedPayload: unknown = null;
@@ -182,7 +183,48 @@ test.describe("Bulk Actions and Tree Search", () => {
const selectionBar = page.getByTestId("bulk-action-bar");
await expect(selectionBar).toBeVisible({ timeout: 15000 });
await page.getByTestId("bulk-promote-super-admin-btn").click();
await page.getByTestId("bulk-status-select").click();
await page.getByRole("option", { name: /정지|Suspended/i }).click();
await page.getByTestId("bulk-apply-status-btn").click();
await expect
.poll(() => capturedPayload)
.toEqual({
userIds: ["u-1"],
status: "suspended",
});
await expect(selectionBar).not.toBeVisible({ timeout: 10000 });
});
test("should let super admins apply selected admin permission to selected users", async ({
page,
}) => {
let capturedPayload: unknown = null;
await page.route("**/api/v1/admin/users/bulk", async (route) => {
if (route.request().method() === "PUT") {
capturedPayload = route.request().postDataJSON();
return route.fulfill({
json: { results: [{ id: "u-1", success: true }] },
headers: { "Access-Control-Allow-Origin": "*" },
});
}
return route.fallback();
});
await page.goto("/users");
await expect(page.locator("table")).toContainText("User One", {
timeout: 20000,
});
await page.locator('table input[type="checkbox"]').nth(1).click();
const selectionBar = page.getByTestId("bulk-action-bar");
await expect(selectionBar).toBeVisible({ timeout: 15000 });
await page.getByTestId("bulk-permission-select").click();
await page
.getByRole("option", { name: /시스템 관리자|Super Admin/i })
.click();
await page.getByTestId("bulk-apply-permission-btn").click();
await expect
.poll(() => capturedPayload)
@@ -193,6 +235,65 @@ test.describe("Bulk Actions and Tree Search", () => {
await expect(selectionBar).not.toBeVisible({ timeout: 10000 });
});
test("should let canonical super admin aliases promote selected users", async ({
page,
}) => {
await page.unroute("**/api/v1/**");
await page.route("**/api/v1/**", async (route) => {
const url = route.request().url();
const headers = { "Access-Control-Allow-Origin": "*" };
if (url.includes("/user/me")) {
return route.fulfill({
json: {
id: "admin",
role: "super-admin",
name: "Admin",
manageableTenants: [],
},
headers,
});
}
if (url.includes("/admin/users")) {
return route.fulfill({
json: {
items: [
{
id: "u-1",
name: "User One",
email: "u1@test.com",
status: "active",
role: "user",
createdAt: new Date().toISOString(),
},
],
total: 1,
},
headers,
});
}
if (url.includes("/admin/tenants")) {
return route.fulfill({
json: { items: [], total: 0 },
headers,
});
}
return route.fulfill({ json: { items: [], total: 0 }, headers });
});
await page.goto("/users");
await expect(page.locator("table")).toContainText("User One", {
timeout: 20000,
});
await page.locator('table input[type="checkbox"]').nth(1).click();
const selectionBar = page.getByTestId("bulk-action-bar");
await expect(selectionBar).toBeVisible({ timeout: 15000 });
await expect(page.getByTestId("bulk-permission-select")).toBeVisible();
await expect(page.getByTestId("bulk-apply-permission-btn")).toBeVisible();
});
test("should filter and highlight nodes in organization tree", async ({
page,
}) => {