Files
jongryangje/e2e/code-management.spec.js
javamon1174 a0103eb95d 사이트 메뉴 /bag/* 10개 페이지 구현 + E2E 테스트 timeout 보강
- Bag 컨트롤러 신규 (기본정보/발주입고/불출/재고/판매/판매현황/수불/통계/창/도움말)
- 사이트 공통 레이아웃 bag/layout/main.php 추출
- /bag/* 라우트 10개 등록 (Routes.php)
- bag-site.spec.js E2E 테스트 11개 추가
- Playwright timeout 30s→60s, waitForURL 15s→30s
- P4 지자체관리자 접근 테스트 3개로 분리

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 14:30:45 +09:00

72 lines
2.7 KiB
JavaScript

// @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: 30000 });
}
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+/);
});
});