Playwright E2E 테스트 환경 구성 및 테스터 계정 생성
- Playwright + Chromium 브라우저 테스트 환경 세팅 - 테스터 계정 4개 생성 (admin/local/shop/user, pw: test1234!) - seed SQL + Node.js 시더 스크립트 포함 - E2E 테스트 23개 작성 (전체 통과): - auth: 로그인/로그아웃/실패/회원가입 (9개) - admin: 지자체관리자/Super Admin 패널 접근 (10개) - public: 홈/로그인/회원가입/404 (4개) - CLAUDE.md: 테스트 섹션을 Playwright 기반으로 업데이트 - jobs.md: 테스트 작업 완료 기록 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
35
e2e/helpers/auth.js
Normal file
35
e2e/helpers/auth.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 공통 인증 헬퍼
|
||||
*/
|
||||
|
||||
const TEST_ACCOUNTS = {
|
||||
admin: { id: 'tester_admin', password: 'test1234!', level: 4 },
|
||||
local: { id: 'tester_local', password: 'test1234!', level: 3 },
|
||||
shop: { id: 'tester_shop', password: 'test1234!', level: 2 },
|
||||
user: { id: 'tester_user', password: 'test1234!', level: 1 },
|
||||
};
|
||||
|
||||
/**
|
||||
* 로그인 수행
|
||||
* @param {import('@playwright/test').Page} page
|
||||
* @param {'admin'|'local'|'shop'|'user'} role
|
||||
*/
|
||||
async function login(page, role = 'admin') {
|
||||
const acct = TEST_ACCOUNTS[role];
|
||||
await page.goto('/login');
|
||||
await page.fill('input[name="login_id"]', acct.id);
|
||||
await page.fill('input[name="password"]', acct.password);
|
||||
await page.click('button[type="submit"]');
|
||||
// 로그인 후 리다이렉트 대기
|
||||
await page.waitForURL(url => !url.pathname.includes('/login'), { timeout: 10000 });
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그아웃 수행
|
||||
* @param {import('@playwright/test').Page} page
|
||||
*/
|
||||
async function logout(page) {
|
||||
await page.goto('/logout');
|
||||
}
|
||||
|
||||
module.exports = { TEST_ACCOUNTS, login, logout };
|
||||
Reference in New Issue
Block a user