forked from baron/baron-sso
린트 적용용
This commit is contained in:
@@ -98,13 +98,13 @@ test.describe("User Management", () => {
|
||||
// Parse request payload to simulate validation checks
|
||||
const postData = route.request().postDataJSON();
|
||||
if (postData && postData.loginId === "existing_user") {
|
||||
// Simulate a backend conflict error (409) for an existing loginId
|
||||
return route.fulfill({
|
||||
status: 409,
|
||||
json: {
|
||||
error: "이미 존재하는 로그인 ID 입니다.",
|
||||
},
|
||||
});
|
||||
// Simulate a backend conflict error (409) for an existing loginId
|
||||
return route.fulfill({
|
||||
status: 409,
|
||||
json: {
|
||||
error: "이미 존재하는 로그인 ID 입니다.",
|
||||
},
|
||||
});
|
||||
}
|
||||
// Mock successful user creation
|
||||
return route.fulfill({
|
||||
@@ -121,13 +121,13 @@ test.describe("User Management", () => {
|
||||
// Parse request payload
|
||||
const postData = route.request().postDataJSON();
|
||||
if (postData && postData.loginId === "existing_user") {
|
||||
// Simulate a backend conflict error (409) for an existing loginId
|
||||
return route.fulfill({
|
||||
status: 409,
|
||||
json: {
|
||||
error: "이미 존재하는 로그인 ID 입니다.",
|
||||
},
|
||||
});
|
||||
// Simulate a backend conflict error (409) for an existing loginId
|
||||
return route.fulfill({
|
||||
status: 409,
|
||||
json: {
|
||||
error: "이미 존재하는 로그인 ID 입니다.",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Mock successful user update
|
||||
@@ -142,17 +142,17 @@ test.describe("User Management", () => {
|
||||
}
|
||||
|
||||
if (url.includes("/admin/users") && method === "GET") {
|
||||
return route.fulfill({
|
||||
return route.fulfill({
|
||||
json: {
|
||||
items: [
|
||||
{
|
||||
id: "u-1",
|
||||
name: "John Doe",
|
||||
email: "john@test.com",
|
||||
loginId: "johndoe",
|
||||
role: "user",
|
||||
status: "active",
|
||||
}
|
||||
{
|
||||
id: "u-1",
|
||||
name: "John Doe",
|
||||
email: "john@test.com",
|
||||
loginId: "johndoe",
|
||||
role: "user",
|
||||
status: "active",
|
||||
},
|
||||
],
|
||||
total: 1,
|
||||
limit: 50,
|
||||
@@ -177,14 +177,20 @@ test.describe("User Management", () => {
|
||||
await loginIdInput.fill("johndoe_updated");
|
||||
|
||||
// Submit the form
|
||||
const saveButton = page.getByRole("button", { name: /변경사항 저장|Save/i });
|
||||
const saveButton = page.getByRole("button", {
|
||||
name: /변경사항 저장|Save/i,
|
||||
});
|
||||
await saveButton.click();
|
||||
|
||||
// Check for success message
|
||||
await expect(page.getByText(/사용자 정보가 수정되었습니다/i).first()).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/사용자 정보가 수정되었습니다/i).first(),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should show conflict error when updating to an existing Login ID", async ({ page }) => {
|
||||
test("should show conflict error when updating to an existing Login ID", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/users/u-1");
|
||||
|
||||
const loginIdInput = page.locator('input[id="loginId"]');
|
||||
@@ -193,14 +199,20 @@ test.describe("User Management", () => {
|
||||
// Enter a login ID that triggers our mock conflict error
|
||||
await loginIdInput.fill("existing_user");
|
||||
|
||||
const saveButton = page.getByRole("button", { name: /변경사항 저장|Save/i });
|
||||
const saveButton = page.getByRole("button", {
|
||||
name: /변경사항 저장|Save/i,
|
||||
});
|
||||
await saveButton.click();
|
||||
|
||||
// Check for the specific conflict error message from the backend mock
|
||||
await expect(page.getByText(/이미 존재하는 로그인 ID 입니다/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/이미 존재하는 로그인 ID 입니다/i),
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test("should successfully create a new user with a Login ID", async ({ page }) => {
|
||||
test("should successfully create a new user with a Login ID", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/users/new");
|
||||
|
||||
// Ensure the page title is loaded
|
||||
@@ -222,7 +234,9 @@ test.describe("User Management", () => {
|
||||
await expect(page).toHaveURL(/.*\/users$/, { timeout: 10000 });
|
||||
});
|
||||
|
||||
test("should show conflict error when creating with an existing Login ID", async ({ page }) => {
|
||||
test("should show conflict error when creating with an existing Login ID", async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto("/users/new");
|
||||
|
||||
await expect(page.getByText(/사용자 추가/i).first()).toBeVisible();
|
||||
@@ -240,6 +254,8 @@ test.describe("User Management", () => {
|
||||
await createButton.click();
|
||||
|
||||
// Check for the specific conflict error message from the backend mock
|
||||
await expect(page.getByText(/이미 존재하는 로그인 ID 입니다/i)).toBeVisible();
|
||||
await expect(
|
||||
page.getByText(/이미 존재하는 로그인 ID 입니다/i),
|
||||
).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user