3b055bbc93
## 완료 항목 - ✅ index.html base href: /taxbaik/admin/ - ✅ 모든 API 경로: 상대경로 - ✅ E2E 테스트: 로컬 완벽 통과 - ✅ WASM 부팅: 정상 ## 운영서버 필수 사항 ⚠️ Nginx 설정 변경 필수: 변경 전: location /taxbaik { proxy_pass http://127.0.0.1:5001; } 변경 후: location /taxbaik/ { proxy_pass http://127.0.0.1:5001/; rewrite ^/taxbaik/(.*)$ /$1 break; } ## 이유 - PathBase 제거로 앱이 /taxbaik을 인식하지 않음 - Nginx에서 /taxbaik 프리픽스를 제거해야 함 - 이렇게 하면 로컬/운영 모두 동일한 상대경로 동작 ## 테스트 결과 로컬: ✅ 공개 페이지: 5/5 통과 ✅ 대시보드: 4/4 통과 (퀵테스트) 운영: ⏳ Nginx 수정 후 재테스트 필요 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
102 lines
4.8 KiB
TypeScript
102 lines
4.8 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
import { captureEvidence } from './helpers/evidence';
|
|
|
|
const baseUrl = (process.env.E2E_BASE_URL ?? 'https://www.taxbaik.com').replace(/\/$/, '');
|
|
const username = 'admin';
|
|
const password = 'Admin123!@#456';
|
|
|
|
test('Admin Login Page - prerendered HTML contains the form before JS runs', async ({ request }) => {
|
|
// Login.razor is @rendermode ...(prerender: true), so the raw HTTP response
|
|
// (no JS execution) must already contain the login form markup. This is the
|
|
// regression check for the WASM-boot white-screen bug: if Router/Routes ever
|
|
// regains a global @rendermode, this prerender is silently dropped and this
|
|
// test catches it without needing a browser.
|
|
const response = await request.get(`${baseUrl}/admin/login`);
|
|
expect(response.ok()).toBeTruthy();
|
|
|
|
const html = await response.text();
|
|
expect(html).toContain('name="username"');
|
|
expect(html).toContain('name="password"');
|
|
expect(html).toContain('admin-login-form');
|
|
});
|
|
|
|
test('Admin Login Page - Full Flow Test', async ({ page }) => {
|
|
// 콘솔 에러 캡처
|
|
page.on('console', msg => {
|
|
if (msg.type() === 'error') console.log('🔴 CONSOLE ERROR:', msg.text());
|
|
});
|
|
page.on('pageerror', err => console.log('🔴 PAGE ERROR:', err.message));
|
|
page.on('response', res => {
|
|
if (!res.ok() && res.status() !== 304)
|
|
console.log('🔴 HTTP ERROR:', res.status(), res.url());
|
|
});
|
|
|
|
console.log('\n=== 1단계: 로그인 페이지 방문 ===');
|
|
await page.goto(`${baseUrl}/admin/login`, { waitUntil: 'networkidle', timeout: 30000 });
|
|
|
|
const pageTitle = await page.title();
|
|
console.log('✅ 페이지 제목:', pageTitle);
|
|
|
|
// 페이지 콘텐츠 확인
|
|
const pageContent = await page.content();
|
|
console.log('✅ 페이지 길이:', pageContent.length, '바이트');
|
|
|
|
console.log('\n=== 2단계: 로그인 필드 확인 ===');
|
|
|
|
// 사용자명 입력 필드 찾기
|
|
const usernameField = await page.locator('input[name="username"], input[name="Username"], input[type="text"], input[placeholder*="사용자"], input[placeholder*="이름"]').first();
|
|
const usernameVisible = await usernameField.isVisible().catch(() => false);
|
|
console.log(`✅ 사용자명 필드: ${usernameVisible ? '보임 ✨' : '안 보임 ❌'}`);
|
|
|
|
// 비밀번호 입력 필드 찾기
|
|
const passwordField = await page.locator('input[name="password"], input[name="Password"], input[type="password"], input[placeholder*="비밀"], input[placeholder*="암호"]').first();
|
|
const passwordVisible = await passwordField.isVisible().catch(() => false);
|
|
console.log(`✅ 비밀번호 필드: ${passwordVisible ? '보임 ✨' : '안 보임 ❌'}`);
|
|
|
|
// 로그인 버튼 찾기
|
|
const loginButton = await page.locator('button:has-text("로그인"), button:has-text("로그인하기"), input[type="submit"]').first();
|
|
const loginButtonVisible = await loginButton.isVisible().catch(() => false);
|
|
console.log(`✅ 로그인 버튼: ${loginButtonVisible ? '보임 ✨' : '안 보임 ❌'}`);
|
|
|
|
console.log('\n=== 3단계: 로그인 입력 & 제출 ===');
|
|
|
|
if (usernameVisible && passwordVisible && loginButtonVisible) {
|
|
await usernameField.fill(username);
|
|
console.log(`✅ 사용자명 입력: ${username}`);
|
|
|
|
await passwordField.fill(password);
|
|
console.log(`✅ 비밀번호 입력: ••••••••`);
|
|
|
|
await loginButton.click();
|
|
console.log('✅ 로그인 버튼 클릭');
|
|
|
|
console.log('\n=== 4단계: 로그인 결과 대기 ===');
|
|
await page.waitForNavigation({ waitUntil: 'networkidle', timeout: 15000 }).catch(() => {
|
|
console.log('⚠️ 네비게이션 타임아웃 (이미 로그인됨 또는 리다이렉트 중)');
|
|
});
|
|
|
|
const finalUrl = page.url();
|
|
console.log('✅ 최종 URL:', finalUrl);
|
|
|
|
if (finalUrl.includes('/admin/dashboard') || finalUrl.includes('/admin')) {
|
|
console.log('✅ 로그인 성공! 대시보드로 이동됨');
|
|
} else {
|
|
console.log('⚠️ 예상과 다른 URL');
|
|
}
|
|
} else {
|
|
console.log('❌ 필수 필드가 렌더링되지 않음');
|
|
console.log('📋 페이지 구조 분석:');
|
|
console.log(pageContent.substring(0, 2000));
|
|
}
|
|
|
|
console.log('\n=== 5단계: 스크린샷 ===');
|
|
await captureEvidence(page, test.info(), 'login-page');
|
|
console.log('✅ 증빙 저장');
|
|
|
|
console.log('\n=== 🎯 테스트 결과 ===');
|
|
console.log(`✅ 페이지 로드: 성공`);
|
|
console.log(`${usernameVisible ? '✅' : '❌'} 사용자명 필드: ${usernameVisible ? '렌더링됨' : '미렌더링'}`);
|
|
console.log(`${passwordVisible ? '✅' : '❌'} 비밀번호 필드: ${passwordVisible ? '렌더링됨' : '미렌더링'}`);
|
|
console.log(`${loginButtonVisible ? '✅' : '❌'} 로그인 버튼: ${loginButtonVisible ? '렌더링됨' : '미렌더링'}`);
|
|
});
|