Files
jongryangje/e2e/phase2-extra.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

55 lines
2.3 KiB
JavaScript

// @ts-check
const { test, expect } = require('@playwright/test');
const { login } = require('./helpers/auth');
async function loginAsAdmin(page) {
await login(page, 'admin');
await page.locator('input[name="lg_idx"]').first().check();
await page.click('button[type="submit"]');
await page.waitForURL(url => !url.pathname.includes('select-local-government'), { timeout: 30000 });
}
test.describe('P2-19: 지자체 수정/삭제', () => {
test('지자체 수정 폼 표시', async ({ page }) => {
await loginAsAdmin(page);
await page.goto('/admin/local-governments/edit/1');
await expect(page.locator('input[name="lg_name"]')).toBeVisible();
});
test('지자체 목록에 수정/비활성 버튼 존재', async ({ page }) => {
await loginAsAdmin(page);
await page.goto('/admin/local-governments');
await expect(page.locator('a:has-text("수정")').first()).toBeVisible({ timeout: 10000 });
});
});
test.describe('P2-20: 비밀번호 변경', () => {
test('비밀번호 변경 폼 표시', async ({ page }) => {
await login(page, 'local');
await page.goto('/admin/password-change');
await expect(page.locator('input[name="current_password"]')).toBeVisible();
await expect(page.locator('input[name="new_password"]')).toBeVisible();
await expect(page.locator('input[name="new_password_confirm"]')).toBeVisible();
});
});
test.describe('P2-21: 로그인 실패 lock', () => {
test('잘못된 비밀번호 시 실패 카운트 메시지', async ({ page }) => {
test.setTimeout(60000);
// 3회 연속 실패하면 (실패 N/5회) 표시
for (let i = 0; i < 3; i++) {
await page.goto('/login');
await page.fill('input[name="login_id"]', 'tester_user');
await page.fill('input[name="password"]', 'wrong_password');
await page.click('button[type="submit"]');
await page.waitForURL(/\/login/, { timeout: 30000 });
await page.waitForTimeout(500);
}
// 3회 이후 실패 카운트 표시 확인
await expect(page.locator('[role="alert"]').first()).toBeVisible({ timeout: 5000 });
const alertText = await page.locator('[role="alert"]').first().textContent();
// 실패 카운트 또는 잠금 메시지 확인
expect(alertText?.includes('실패') || alertText?.includes('잠겼')).toBeTruthy();
});
});