P2-01/02 기본코드 종류 및 세부코드 관리 CRUD 구현

- CodeKindModel + CodeKind 컨트롤러 (목록/등록/수정/삭제)
- CodeDetailModel + CodeDetail 컨트롤러 (종류별 세부코드 CRUD)
- View: code_kind/(index,create,edit), code_detail/(index,create,edit)
- 라우트: /admin/code-kinds/*, /admin/code-details/*
- E2E 테스트 7개 전체 통과
- 스크린샷 2개 추가

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
javamon1174
2026-03-25 16:20:56 +09:00
parent 34cecad2e2
commit 41442c23a1
15 changed files with 620 additions and 2 deletions

View File

@@ -16,8 +16,7 @@ test.describe('관리자 패널 — 지자체관리자', () => {
test('회원 관리 목록 접근', async ({ page }) => {
await page.goto('/admin/users');
await expect(page).toHaveURL(/\/admin\/users/);
const content = await page.content();
expect(content).toContain('tester_');
await expect(page.locator('td:has-text("tester_")')).toBeVisible({ timeout: 10000 });
});
test('로그인 이력 접근', async ({ page }) => {

View File

@@ -0,0 +1,71 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const { login } = require('./helpers/auth');
/** Super Admin 로그인 + 지자체 선택 */
async function loginAsAdmin(page) {
await login(page, 'admin');
const radio = page.locator('input[name="lg_idx"]').first();
await radio.check();
await page.click('button[type="submit"]');
await page.waitForURL(url => !url.pathname.includes('select-local-government'), { timeout: 15000 });
}
test.describe('P2-01: 기본코드 종류 관리', () => {
test.beforeEach(async ({ page }) => {
await loginAsAdmin(page);
});
test('코드 종류 목록 접근', async ({ page }) => {
await page.goto('/admin/code-kinds');
await expect(page).toHaveURL(/\/admin\/code-kinds/);
await expect(page.locator('td:has-text("도/특별시/광역시 구분")').first()).toBeVisible({ timeout: 10000 });
});
test('코드 종류 등록 폼 표시', async ({ page }) => {
await page.goto('/admin/code-kinds/create');
await expect(page.locator('input[name="ck_code"]')).toBeVisible();
await expect(page.locator('input[name="ck_name"]')).toBeVisible();
});
test('코드 종류 수정', async ({ page }) => {
// 기존 코드 A의 수정 테스트
await page.goto('/admin/code-kinds/edit/1');
await expect(page.locator('input[name="ck_name"]')).toBeVisible();
// 값 확인만 (실제 수정은 하지 않음 - 기존 데이터 보존)
});
});
test.describe('P2-02: 세부코드 관리', () => {
test.beforeEach(async ({ page }) => {
await loginAsAdmin(page);
});
test('세부코드 목록 접근 (봉투구분 E)', async ({ page }) => {
await page.goto('/admin/code-details/5');
await expect(page).toHaveURL(/\/admin\/code-details\/5/);
await expect(page.locator('td:has-text("일반용")').first()).toBeVisible({ timeout: 10000 });
});
test('세부코드 등록 폼 표시', async ({ page }) => {
await page.goto('/admin/code-details/5/create');
await expect(page.locator('input[name="cd_code"]')).toBeVisible();
await expect(page.locator('input[name="cd_name"]')).toBeVisible();
});
test('세부코드 수정 폼', async ({ page }) => {
// 기존 세부코드 35(일반용)의 수정 폼 확인
await page.goto('/admin/code-details/edit/35');
await expect(page.locator('input[name="cd_name"]')).toBeVisible();
});
test('코드 종류에서 세부코드 링크 이동', async ({ page }) => {
await page.goto('/admin/code-kinds');
// "세부코드" 링크 클릭
const link = page.locator('a:has-text("세부코드")').first();
await link.click();
await expect(page).toHaveURL(/\/admin\/code-details\/\d+/);
});
});