1
0
forked from baron/baron-sso

네이버 웍스 연동기능 개선

This commit is contained in:
2026-05-18 15:36:30 +09:00
parent c71ece84b8
commit e29d056b9e
61 changed files with 4137 additions and 710 deletions

View File

@@ -0,0 +1,80 @@
import { expect, test } from "@playwright/test";
test.describe("Admin shell layout", () => {
test.beforeEach(async ({ page }) => {
await page.addInitScript(() => {
window.localStorage.setItem("locale", "ko");
window.localStorage.setItem("admin_session", "fake-token");
(
window as Window & typeof globalThis & { _IS_TEST_MODE?: boolean }
)._IS_TEST_MODE = true;
const authority = "http://localhost:5000/oidc";
const client_id = "adminfront";
const key = `oidc.user:${authority}:${client_id}`;
window.localStorage.setItem(
key,
JSON.stringify({
access_token: "fake-token",
token_type: "Bearer",
profile: { sub: "admin-user", name: "Admin", role: "super_admin" },
expires_at: Math.floor(Date.now() / 1000) + 36000,
}),
);
});
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-user",
name: "Admin",
role: "super_admin",
manageableTenants: [],
},
headers,
});
}
if (url.includes("/admin/tenants")) {
return route.fulfill({
json: { items: [], total: 0, limit: 1000, offset: 0 },
headers,
});
}
return route.fulfill({ json: { items: [], total: 0 }, headers });
});
await page.route("**/oidc/**", async (route) => {
await route.fulfill({ json: { issuer: "http://localhost:5000/oidc" } });
});
});
test("keeps navigation in the left sidebar without covering content", async ({
page,
}) => {
await page.setViewportSize({ width: 900, height: 700 });
await page.goto("/tenants");
const sidebar = page.locator("aside").first();
const main = page.locator("main").first();
await expect(sidebar).toBeVisible();
await expect(main).toBeVisible();
const sidebarBox = await sidebar.boundingBox();
const mainBox = await main.boundingBox();
expect(sidebarBox).not.toBeNull();
expect(mainBox).not.toBeNull();
expect(sidebarBox?.x).toBeLessThanOrEqual(1);
expect(sidebarBox?.width).toBeLessThanOrEqual(260);
expect(mainBox?.x).toBeGreaterThanOrEqual(
(sidebarBox?.x ?? 0) + (sidebarBox?.width ?? 0) - 1,
);
});
});

View File

@@ -105,6 +105,79 @@ test.describe("Tenants Management", () => {
expect(headerWhiteSpace.every((value) => value === "nowrap")).toBe(true);
});
test("switches tree and flat views, searches UUID, and selects descendants", async ({
page,
}) => {
await page.setViewportSize({ width: 1100, height: 760 });
await page.route("**/api/v1/admin/tenants**", async (route) => {
if (route.request().method() !== "GET") {
return route.continue();
}
await route.fulfill({
json: {
items: [
{
id: "company-1",
name: "Hanmac",
slug: "hanmac",
status: "active",
type: "COMPANY",
memberCount: 0,
updatedAt: new Date().toISOString(),
},
{
id: "dept-1",
name: "Planning",
slug: "planning",
status: "active",
type: "ORGANIZATION",
parentId: "company-1",
memberCount: 0,
updatedAt: new Date().toISOString(),
},
{
id: "team-1",
name: "Platform",
slug: "platform",
status: "active",
type: "USER_GROUP",
parentId: "dept-1",
memberCount: 0,
updatedAt: new Date().toISOString(),
},
],
total: 3,
limit: 500,
offset: 0,
},
headers: { "Access-Control-Allow-Origin": "*" },
});
});
await page.goto("/tenants");
await expect(page.getByTestId("tenant-view-tree-btn")).toBeVisible();
await page.getByTestId("tenant-view-table-btn").click();
await expect(page.getByTestId("tenant-view-table-btn")).toBeVisible();
await page.getByPlaceholder(/UUID|슬러그|slug/i).fill("team-1");
await expect(page.locator("table")).toContainText("Platform");
await expect(page.locator("table")).not.toContainText("Hanmac");
await page.getByPlaceholder(/UUID|슬러그|slug/i).fill("");
await page
.locator("tbody tr")
.filter({ hasText: "Hanmac" })
.getByRole("checkbox")
.click();
await expect(page.getByTestId("tenant-bulk-action-bar")).toContainText(
"3개 선택됨",
);
});
test("should virtualize large tenant lists and load next pages automatically", async ({
page,
}) => {

View File

@@ -133,6 +133,24 @@ test.describe("Worksmobile tenant management", () => {
worksmobileName: "박웍스",
status: "missing_in_baron",
},
{
resourceType: "USER",
worksmobileId: "works-hidden-su",
externalKey: "works-hidden-su",
worksmobileName: "숨김 SU",
worksmobileEmail: "su-@samaneng.com",
status: "missing_in_baron",
},
{
resourceType: "USER",
baronId: "user-hidden-cyhan1",
baronName: "숨김 CYHAN1",
baronEmail: "cyhan1@hanmaceng.co.kr",
worksmobileId: "works-hidden-cyhan1",
worksmobileName: "숨김 CYHAN1",
worksmobileEmail: "cyhan1@hanmaceng.co.kr",
status: "matched",
},
]
: [
{
@@ -148,6 +166,14 @@ test.describe("Worksmobile tenant management", () => {
worksmobileName: "박웍스",
status: "missing_in_baron",
},
{
resourceType: "USER",
worksmobileId: "works-hidden-su",
externalKey: "works-hidden-su",
worksmobileName: "숨김 SU",
worksmobileEmail: "su-@samaneng.com",
status: "missing_in_baron",
},
],
groups: [
{
@@ -198,6 +224,10 @@ test.describe("Worksmobile tenant management", () => {
await expect(page.getByText("SCIM token")).not.toBeVisible();
await expect(page.getByText("김누락")).toBeVisible();
await expect(page.getByText("박웍스")).toBeVisible();
await expect(page.getByText("숨김 SU")).not.toBeVisible();
await expect(page.getByText("숨김 CYHAN1")).not.toBeVisible();
await expect(page.getByText("su-@samaneng.com")).not.toBeVisible();
await expect(page.getByText("cyhan1@hanmaceng.co.kr")).not.toBeVisible();
await expect(page.getByText("WORKS 전용 조직")).toBeVisible();
await expect(page.getByText("기술본부", { exact: true })).toBeVisible();
await expect(page.getByText("parent-tech", { exact: true })).toBeVisible();
@@ -206,7 +236,16 @@ test.describe("Worksmobile tenant management", () => {
await expect(page.getByText("홍길동")).not.toBeVisible();
expect(comparisonRequests[0]).toBe(true);
const filterButtons = page
await page
.getByPlaceholder("구성원 이름 또는 UUID 검색")
.fill("su-@samaneng.com");
await expect(page.getByText("숨김 SU")).not.toBeVisible();
await page.getByPlaceholder("구성원 이름 또는 UUID 검색").fill("");
const userComparisonSection = page
.getByRole("heading", { name: "구성원" })
.locator("xpath=ancestor::div[contains(@class, 'space-y-2')][1]");
const filterButtons = userComparisonSection
.getByRole("button", {
name: /바론에만 있음|웍스에만 있음|양쪽 다 있음/,
})
@@ -215,12 +254,16 @@ test.describe("Worksmobile tenant management", () => {
.poll(() => filterButtons)
.toEqual(["바론에만 있음", "웍스에만 있음", "양쪽 다 있음"]);
await page.getByRole("button", { name: "웍스에만 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "웍스에만 있음" })
.click();
await expect(page.getByText("박웍스")).not.toBeVisible();
await expect(page.getByText("김누락")).toBeVisible();
await expect(page.getByText("홍길동")).not.toBeVisible();
await page.getByRole("button", { name: "양쪽 다 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "양쪽 다 있음" })
.click();
await expect(page.getByText("홍길동")).toHaveCount(2);
await expect(page.getByText("기술기획", { exact: true })).toBeVisible();
await expect(page.getByText("team-tech", { exact: true })).toBeVisible();
@@ -229,22 +272,30 @@ test.describe("Worksmobile tenant management", () => {
await expect(page.getByText("김누락")).toBeVisible();
await expect(page.getByText("박웍스")).not.toBeVisible();
await page.getByRole("button", { name: "바론에만 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "바론에만 있음" })
.click();
await expect(page.getByText("홍길동")).toHaveCount(2);
await expect(page.getByText("김누락")).not.toBeVisible();
await expect(page.getByText("박웍스")).not.toBeVisible();
await page.getByRole("button", { name: "웍스에만 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "웍스에만 있음" })
.click();
await expect(page.getByText("홍길동")).toHaveCount(2);
await expect(page.getByText("김누락")).not.toBeVisible();
await expect(page.getByText("박웍스")).toBeVisible();
await page.getByRole("button", { name: "양쪽 다 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "양쪽 다 있음" })
.click();
await expect(page.getByText("김누락")).not.toBeVisible();
await expect(page.getByText("박웍스")).toBeVisible();
await expect(page.getByText("홍길동")).not.toBeVisible();
await page.getByRole("button", { name: "바론에만 있음" }).click();
await userComparisonSection
.getByRole("button", { name: "바론에만 있음" })
.click();
await expect(page.getByText("김누락")).toBeVisible();
await expect(page.getByText("박웍스")).toBeVisible();
await expect(page.getByText("홍길동")).not.toBeVisible();
@@ -464,11 +515,13 @@ test.describe("Worksmobile tenant management", () => {
.getByRole("button", { name: "컬럼 설정" });
await userColumnButton.click();
const dialog = page.getByRole("dialog", { name: "구성원 컬럼 설정" });
await dialog.getByLabel("Baron ID").check();
await dialog.getByLabel("WORKS ID").check();
await dialog.getByLabel("external_key").check();
await dialog.getByRole("button", { name: "닫기" }).click();
const settingsPanel = page
.getByText("구성원 컬럼 설정")
.locator("xpath=ancestor::*[@role='dialog'][1]");
await settingsPanel.getByLabel("Baron ID").check();
await settingsPanel.getByLabel("WORKS", { exact: true }).check();
await settingsPanel.getByLabel("external_key").check();
await settingsPanel.getByRole("button", { name: "닫기" }).click();
const pageOverflow = await page.evaluate(() => ({
documentScrollWidth: document.documentElement.scrollWidth,