Skip to content

Commit 12dc638

Browse files
committed
test(e2e): 테이블 빈 상태 및 URL 쿼리 파라미터 지속성 테스트 추가
- 검색 결과 없을 때 빈 상태 메시지 표시 테스트 - 검색 초기화 시 테이블 복원 테스트 - 탭 전환 시 URL 쿼리 파라미터 업데이트 테스트 - 페이지 새로고침 후 탭 선택 유지 테스트
1 parent b7b0371 commit 12dc638

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

e2e/empty-state.spec.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
test.describe("Table Empty State", () => {
4+
test.use({ storageState: { cookies: [], origins: [] } });
5+
6+
test.beforeEach(async ({ page }) => {
7+
await page.goto("/");
8+
await page.locator("table tbody tr").first().waitFor();
9+
});
10+
11+
test("should show empty state message when search has no results", async ({
12+
page,
13+
}) => {
14+
const searchInput = page.getByRole("textbox", { name: "검색..." });
15+
16+
await searchInput.fill("NonExistentContent123456789");
17+
await searchInput.press("Enter");
18+
19+
await expect(page.getByText("조회된 데이터가 없습니다")).toBeVisible();
20+
21+
const rowCount = await page.locator("table tbody tr").count();
22+
expect(rowCount).toBe(1);
23+
});
24+
25+
test("should restore table when clearing search after empty state", async ({
26+
page,
27+
}) => {
28+
const searchInput = page.getByRole("textbox", { name: "검색..." });
29+
30+
// Search non-existent content
31+
await searchInput.fill("NonExistentContent123456789");
32+
await searchInput.press("Enter");
33+
await expect(page.getByText("조회된 데이터가 없습니다")).toBeVisible();
34+
35+
// Clear search
36+
await searchInput.clear();
37+
await searchInput.press("Enter");
38+
39+
// Table should be restored
40+
await expect(async () => {
41+
const rowCount = await page.locator("table tbody tr").count();
42+
expect(rowCount).toBeGreaterThan(1);
43+
}).toPass({ timeout: 5000 });
44+
});
45+
});

e2e/url-query-persistence.spec.ts

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { expect, test } from "@playwright/test";
2+
3+
test.describe("URL Query Parameter Persistence", () => {
4+
test.use({ storageState: { cookies: [], origins: [] } });
5+
6+
test("should update URL when switching tabs on item price list", async ({
7+
page,
8+
}) => {
9+
await page.goto("/item-price-list");
10+
await page.locator("table tbody tr").first().waitFor();
11+
12+
// Initial URL should not have tab parameter (default tab)
13+
expect(page.url()).not.toContain("tab=");
14+
15+
// Click auction item tab
16+
await page.getByRole("tab", { name: "경매장 아이템" }).click();
17+
await page.locator("table tbody tr").first().waitFor();
18+
19+
// URL should now contain tab=auction-item
20+
expect(page.url()).toContain("tab=auction-item");
21+
});
22+
23+
test("should persist tab selection after page refresh", async ({ page }) => {
24+
// Navigate directly to auction item tab
25+
await page.goto("/item-price-list?tab=auction-item");
26+
await page.locator("table tbody tr").first().waitFor();
27+
28+
// Verify auction item tab is selected
29+
await expect(
30+
page.getByRole("tab", { name: "경매장 아이템" })
31+
).toHaveAttribute("aria-selected", "true");
32+
33+
// Refresh page
34+
await page.reload();
35+
await page.locator("table tbody tr").first().waitFor();
36+
37+
// Tab should still be selected after refresh
38+
await expect(
39+
page.getByRole("tab", { name: "경매장 아이템" })
40+
).toHaveAttribute("aria-selected", "true");
41+
expect(page.url()).toContain("tab=auction-item");
42+
});
43+
44+
test("should persist extra item tab selection", async ({ page }) => {
45+
await page.goto("/item-price-list");
46+
await page.locator("table tbody tr").first().waitFor();
47+
48+
// Click extra item tab
49+
await page.getByRole("tab", { name: "기타 아이템" }).click();
50+
51+
// URL should contain tab=extra-item
52+
await expect(async () => {
53+
expect(page.url()).toContain("tab=extra-item");
54+
}).toPass({ timeout: 5000 });
55+
56+
// Verify extra item tab is selected
57+
await expect(
58+
page.getByRole("tab", { name: "기타 아이템" })
59+
).toHaveAttribute("aria-selected", "true");
60+
});
61+
});

0 commit comments

Comments
 (0)