1
0
forked from baron/baron-sso

test(adminfront): fix Playwright E2E tests for user and schema management

This commit is contained in:
2026-04-03 14:48:04 +09:00
parent bae35dd8a5
commit 94520db699
2 changed files with 93 additions and 40 deletions

View File

@@ -63,7 +63,7 @@ test.describe("User Schema Dynamic Form", () => {
});
}
if (url.includes("/admin/tenants/t-1")) {
if (url.match(/\/admin\/tenants\/t-1$/)) {
console.log("Mocking /admin/tenants/t-1");
return route.fulfill({
json: {
@@ -76,7 +76,13 @@ test.describe("User Schema Dynamic Form", () => {
key: "emp_id",
label: "Employee ID",
required: true,
validation: "^E[0-9]{3}$",
validation: "^E[0-9]{3}$"
},
{
key: "loginId",
label: "Login ID",
required: true,
isLoginId: true,
},
{
key: "salary",
@@ -102,7 +108,7 @@ test.describe("User Schema Dynamic Form", () => {
joinedTenants: [
{ id: "t-1", name: "Test Tenant", slug: "test-tenant" },
],
metadata: { "t-1": { emp_id: "E123", salary: 1000 } },
metadata: { "t-1": { emp_id: "E123", salary: 1000, loginId: "johndoe" } },
},
});
}
@@ -127,7 +133,7 @@ test.describe("User Schema Dynamic Form", () => {
});
}
if (url.includes("/admin/tenants")) {
if (url.match(/\/admin\/tenants(\?.*)?$/)) {
console.log("Mocking /admin/tenants");
return route.fulfill({
json: {
@@ -142,7 +148,13 @@ test.describe("User Schema Dynamic Form", () => {
key: "emp_id",
label: "Employee ID",
required: true,
validation: "^E[0-9]{3}$",
validation: "^E[0-9]{3}$"
},
{
key: "loginId",
label: "Login ID",
required: true,
isLoginId: true,
},
{
key: "salary",
@@ -169,6 +181,11 @@ test.describe("User Schema Dynamic Form", () => {
}) => {
await page.goto("/users/u-1");
// "테넌트 프로필" 탭 클릭
await page
.getByRole("tab", { name: /테넌트 프로필|Tenants|Tenant Profile/i })
.click();
// 섹션 헤더 확인
const header = page
.getByText(/테넌트별 프로필 관리|Per-tenant Profile/i)
@@ -193,17 +210,20 @@ test.describe("User Schema Dynamic Form", () => {
}) => {
await page.goto("/users/u-1");
// "테넌트 프로필" 탭 클릭
await page
.getByRole("tab", { name: /테넌트 프로필|Tenants|Tenant Profile/i })
.click();
const empIdInput = page.locator('input[id*="emp_id"]');
await empIdInput.waitFor({ state: "visible" });
await empIdInput.fill("invalid");
// 포커스 해제하여 유효성 검사 트리거
await page.getByLabel(/이름|Name/i).click();
// Press Enter to trigger form submission and validation
await empIdInput.press("Enter");
// 에러 메시지 확인
const errorMsg = page
.locator("form")
.getByText(/Employee ID|필수|invalid|format/i);
const errorMsg = page.getByText(/형식이 올바르지 않습니다|Invalid format/i).first();
await expect(errorMsg).toBeVisible();
});
});