forked from baron/baron-sso
chore: consolidate local integration changes
This commit is contained in:
@@ -315,6 +315,185 @@ test.describe("User Management", () => {
|
||||
await expect(page.getByText(/저장/i).first()).toBeVisible();
|
||||
});
|
||||
|
||||
test("should manage global custom claim permissions in user detail", async ({
|
||||
page,
|
||||
}) => {
|
||||
let updatePayload: Record<string, unknown> | undefined;
|
||||
|
||||
await page.route(/\/admin\/users\/u-1$/, async (route) => {
|
||||
const method = route.request().method();
|
||||
|
||||
if (method === "GET") {
|
||||
return route.fulfill({
|
||||
json: {
|
||||
id: "u-1",
|
||||
name: "John Doe",
|
||||
email: "john@test.com",
|
||||
loginId: "johndoe",
|
||||
tenantSlug: "test-tenant",
|
||||
tenant: { id: "t-1", name: "Test Tenant", slug: "test-tenant" },
|
||||
role: "user",
|
||||
status: "active",
|
||||
metadata: {
|
||||
"t-1": { loginId: "johndoe" },
|
||||
global_custom_claims: {
|
||||
contract_date: "2026-06-09",
|
||||
},
|
||||
global_custom_claim_types: {
|
||||
contract_date: "date",
|
||||
},
|
||||
global_custom_claim_permissions: {
|
||||
contract_date: {
|
||||
readPermission: "user_and_admin",
|
||||
writePermission: "admin_only",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (method === "PUT") {
|
||||
updatePayload = route.request().postDataJSON();
|
||||
return route.fulfill({
|
||||
json: {
|
||||
id: "u-1",
|
||||
name: "John Doe",
|
||||
email: "john@test.com",
|
||||
loginId: "johndoe",
|
||||
status: "active",
|
||||
metadata: updatePayload?.metadata,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return route.fallback();
|
||||
});
|
||||
|
||||
await page.goto("/users/u-1");
|
||||
await page
|
||||
.getByRole("tab", { name: /전역 Custom Claims|Custom Claims/i })
|
||||
.click();
|
||||
|
||||
await expect(
|
||||
page.getByTestId("global-custom-claim-key-contract_date"),
|
||||
).toHaveValue("contract_date");
|
||||
await expect(
|
||||
page.getByTestId("global-custom-claim-read-permission-contract_date"),
|
||||
).toHaveValue("user_and_admin");
|
||||
await expect(
|
||||
page.getByTestId("global-custom-claim-write-permission-contract_date"),
|
||||
).toHaveValue("admin_only");
|
||||
|
||||
await page
|
||||
.getByTestId("global-custom-claim-write-permission-contract_date")
|
||||
.selectOption("user_and_admin");
|
||||
|
||||
await page.screenshot({
|
||||
path: "test-results/adminfront-global-custom-claim-permissions.png",
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await page
|
||||
.getByRole("button", { name: /전역 Claim 저장|Save Global Claim/i })
|
||||
.click();
|
||||
|
||||
await expect
|
||||
.poll(() => updatePayload)
|
||||
.toMatchObject({
|
||||
metadata: {
|
||||
global_custom_claims: {
|
||||
contract_date: "2026-06-09",
|
||||
},
|
||||
global_custom_claim_types: {
|
||||
contract_date: "date",
|
||||
},
|
||||
global_custom_claim_permissions: {
|
||||
contract_date: {
|
||||
readPermission: "user_and_admin",
|
||||
writePermission: "user_and_admin",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
test("should configure global custom claim definitions", async ({ page }) => {
|
||||
let updatePayload:
|
||||
| {
|
||||
items?: Array<Record<string, unknown>>;
|
||||
}
|
||||
| undefined;
|
||||
|
||||
await page.route(/\/admin\/global-custom-claims$/, async (route) => {
|
||||
const method = route.request().method();
|
||||
|
||||
if (method === "GET") {
|
||||
return route.fulfill({
|
||||
json: {
|
||||
items: [
|
||||
{
|
||||
key: "contract_date",
|
||||
label: "Contract date",
|
||||
valueType: "date",
|
||||
readPermission: "user_and_admin",
|
||||
writePermission: "admin_only",
|
||||
description: "전체 RP에 공통 제공되는 계약일",
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if (method === "PUT") {
|
||||
updatePayload = route.request().postDataJSON();
|
||||
return route.fulfill({ json: updatePayload });
|
||||
}
|
||||
|
||||
return route.fallback();
|
||||
});
|
||||
|
||||
await page.goto("/users/custom-claims");
|
||||
|
||||
await expect(page.getByText("전역 Claim 설정")).toBeVisible();
|
||||
await expect(
|
||||
page.getByTestId("global-claim-definition-key-contract_date"),
|
||||
).toHaveValue("contract_date");
|
||||
await expect(
|
||||
page.getByTestId("global-claim-definition-read-permission-contract_date"),
|
||||
).toHaveValue("user_and_admin");
|
||||
await expect(
|
||||
page.getByTestId(
|
||||
"global-claim-definition-write-permission-contract_date",
|
||||
),
|
||||
).toHaveValue("admin_only");
|
||||
|
||||
await page
|
||||
.getByTestId("global-claim-definition-write-permission-contract_date")
|
||||
.selectOption("user_and_admin");
|
||||
|
||||
await page.screenshot({
|
||||
path: "test-results/adminfront-global-custom-claim-definition-settings.png",
|
||||
fullPage: true,
|
||||
});
|
||||
|
||||
await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
|
||||
|
||||
await expect
|
||||
.poll(() => updatePayload)
|
||||
.toMatchObject({
|
||||
items: [
|
||||
{
|
||||
key: "contract_date",
|
||||
label: "Contract date",
|
||||
valueType: "date",
|
||||
readPermission: "user_and_admin",
|
||||
writePermission: "user_and_admin",
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
test("should show conflict error when updating to an existing Login ID", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user