1
0
forked from baron/baron-sso

code-check 오류 수정

This commit is contained in:
2026-03-25 17:51:29 +09:00
parent ced369cdbc
commit 31b4e6b5f3
10 changed files with 864 additions and 868 deletions

View File

@@ -1,38 +1,23 @@
import { expect, test } from "@playwright/test";
import { seedAuth } from "./helpers/devfront-fixtures";
import {
type Consent,
installDevApiMock,
makeClient,
seedAuth,
} from "./helpers/devfront-fixtures";
test("clients page loads correctly", async ({ page }) => {
await seedAuth(page);
await page.route("**/api/v1/dev/clients**", async (route) => {
if (route.request().method() !== "GET") {
await route.fulfill({
status: 404,
contentType: "application/json",
body: JSON.stringify({ error: "Not found" }),
});
return;
}
await route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify({
items: [
{
id: "client-playwright",
name: "Playwright Client",
type: "private",
status: "active",
createdAt: new Date().toISOString(),
redirectUris: ["http://localhost:5174/callback"],
scopes: ["openid", "profile", "email"],
},
],
limit: 50,
offset: 0,
await installDevApiMock(page, {
clients: [
makeClient("client-playwright", {
name: "Playwright Client",
createdAt: new Date().toISOString(),
redirectUris: ["http://localhost:5174/callback"],
}),
});
],
consents: [] as Consent[],
auditLogsByCursor: undefined,
});
await page.goto("/clients");
@@ -46,9 +31,9 @@ test("clients page loads correctly", async ({ page }) => {
// 테이블 헤더 확인
await expect(
page.getByRole("columnheader", { name: "애플리케이션" }),
page.locator("th").filter({ hasText: "애플리케이션" }),
).toBeVisible();
await expect(
page.getByRole("columnheader", { name: "Client ID" }),
page.locator("th").filter({ hasText: /클라이언트 ID|Client ID/i }),
).toBeVisible();
});

View File

@@ -7,6 +7,8 @@ import {
seedAuth,
} from "./helpers/devfront-fixtures";
const appNamePlaceholder = /My Awesome Application|예: 멋진 애플리케이션/i;
test.describe("DevFront audit logs", () => {
test.beforeEach(async ({ page }) => {
page.on("dialog", async (dialog) => {
@@ -87,19 +89,18 @@ test.describe("DevFront audit logs", () => {
await installDevApiMock(page, state);
await page.goto("/clients/new");
await page
.getByPlaceholder("My Awesome Application")
.fill("Realtime New App");
await page.getByPlaceholder(appNamePlaceholder).fill("Realtime New App");
await page
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
.fill("https://realtime.example.com/callback");
await page.getByRole("button", { name: /앱 생성|Create/i }).click();
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(1);
await expect.poll(() => state.clients.at(-1)?.id).toMatch(/^client-/);
const createdClientId = state.clients.at(-1)?.id;
expect(createdClientId).toBeTruthy();
await page.goto("/clients/client-realtime/settings");
await page
.getByPlaceholder("My Awesome Application")
.fill("Realtime Updated");
await page.goto(`/clients/${createdClientId}/settings`);
await page.getByPlaceholder(appNamePlaceholder).fill("Realtime Updated");
await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
await expect.poll(() => state.auditLogs.length).toBeGreaterThanOrEqual(2);

View File

@@ -7,6 +7,8 @@ import {
seedAuth,
} from "./helpers/devfront-fixtures";
const appNamePlaceholder = /My Awesome Application|예: 멋진 애플리케이션/i;
test.describe("DevFront clients lifecycle", () => {
test.beforeEach(async ({ page }) => {
page.on("dialog", async (dialog) => {
@@ -36,7 +38,7 @@ test.describe("DevFront clients lifecycle", () => {
await expect(page).toHaveURL(/\/clients\/new$/);
await page
.getByPlaceholder("My Awesome Application")
.getByPlaceholder(appNamePlaceholder)
.fill("Playwright Created App");
await page
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
@@ -45,7 +47,7 @@ test.describe("DevFront clients lifecycle", () => {
.getByRole("button", { name: /앱 생성|클라이언트 생성|Create/i })
.click();
await expect(page).toHaveURL(/\/clients\/client-2\/settings$/);
await expect(page).toHaveURL(/\/clients\/client-\d+\/settings$/);
await expect(
page.getByRole("heading", {
name: /연동 앱 설정|클라이언트 설정|Client Settings/i,
@@ -97,7 +99,7 @@ test.describe("DevFront clients lifecycle", () => {
await installDevApiMock(page, state);
await page.goto("/clients/client-edit/settings");
await page.getByPlaceholder("My Awesome Application").fill("After Name");
await page.getByPlaceholder(appNamePlaceholder).fill("After Name");
await page.getByRole("button", { name: /^저장$|^Save$/i }).click();
await expect.poll(() => state.clients[0]?.name).toBe("After Name");

View File

@@ -39,7 +39,7 @@ test.describe("DevFront consents", () => {
await expect(page.getByText("Alice")).toBeVisible();
await expect(page.getByText("Tenant A")).toBeVisible();
await page.getByRole("button", { name: /권한 철회|Revoke/i }).click();
await page.getByRole("button", { name: /권한 철회|철회|Revoke/i }).click();
await expect(page.getByText(/Revoked|철회/i).first()).toBeVisible();
});
});

View File

@@ -8,6 +8,8 @@ import {
} from "./helpers/devfront-fixtures";
import { captureEvidence } from "./helpers/evidence";
const appNamePlaceholder = /My Awesome Application|예: 멋진 애플리케이션/i;
test.describe("DevFront role report", () => {
test.beforeEach(async ({ page }) => {
page.on("dialog", async (dialog) => {
@@ -91,7 +93,7 @@ test.describe("DevFront role report", () => {
await page.goto("/clients/tenant-a-app-1/settings");
await page
.getByPlaceholder("My Awesome Application")
.getByPlaceholder(appNamePlaceholder)
.fill("Tenant A CRM Updated");
const updatePromise = page.waitForResponse(
@@ -132,7 +134,7 @@ test.describe("DevFront role report", () => {
await page.goto("/clients/new");
await page
.getByPlaceholder("My Awesome Application")
.getByPlaceholder(appNamePlaceholder)
.fill("Super Admin Created App");
await page
.getByPlaceholder(/https:\/\/app\.example\.com\/callback/i)
@@ -145,6 +147,17 @@ test.describe("DevFront role report", () => {
);
await page.getByRole("button", { name: /앱 생성|Create/i }).click();
await createPromise;
await expect
.poll(() =>
state.auditLogs.some((item) => {
try {
return JSON.parse(item.details)?.action === "CREATE_CLIENT";
} catch {
return false;
}
}),
)
.toBe(true);
await page.goto("/audit-logs");
await expect(page.getByText("CREATE_CLIENT")).toBeVisible({

View File

@@ -25,7 +25,11 @@ test.describe("DevFront security and isolation", () => {
await installDevApiMock(page, state);
await page.goto("/clients/tenant-b-client");
await expect(page.getByText(/Error loading client|조회/i)).toBeVisible();
await expect(
page.getByText(
/Error loading (app|client)|앱 정보를 불러오지 못했습니다|클라이언트 정보를 불러오지 못했습니다/i,
),
).toBeVisible();
});
test("RBAC: non-AppManager user should not see private apps", async ({