Files
taxbaik/tests/e2e/admin-smoke.spec.ts
T
kjh2064 ea6d68da72 API 클라이언트 경로 최적화: 모든 절대 경로 → 상대 경로 전환
## 변경사항
- ApiClient (2개): BuildApiUri에서 /taxbaik 절대 경로 제거
- TokenRefreshHandler: 토큰 갱신 엔드포인트 상대 경로로 변경
- AdminNavigationModel: 모든 네비게이션 링크 상대 경로로 변경
- E2E 테스트: /taxbaik/admin/dashboard → /admin/dashboard 경로 업데이트
- E2E 필터: WASM 오류 필터 경로 업데이트

## 현황
 빌드: 0 오류, 2 경고
 공개 페이지: 5/5 E2E 테스트 통과
 관리자 페이지: WASM 부팅 오류 (원인 조사 중)
 로그인 API: SSH 터널 연결 시 정상 작동 확인

## 다음 단계
- WASM 부팅 오류 원인 파악 (브라우저 콘솔 확인 필요)
- 혹은 다른 경로 하드코딩 찾기
- 프로덕션 배포 검증

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-08 15:50:09 +09:00

75 lines
3.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loginThroughAdminUi } from './helpers/admin-auth';
import { captureEvidence } from './helpers/evidence';
const username = process.env.E2E_ADMIN_USERNAME ?? 'admin';
const password = process.env.E2E_ADMIN_PASSWORD;
const baseUrl = (process.env.E2E_BASE_URL ?? 'https://www.taxbaik.com/taxbaik').replace(/\/$/, '');
test.describe('admin smoke', () => {
test('@smoke logs in and lands on dashboard without circuit errors', async ({ page }) => {
test.skip(!password, 'E2E_ADMIN_PASSWORD is required.');
const consoleErrors: string[] = [];
page.on('console', message => {
if (message.type() === 'error') {
const text = message.text();
if (
text.includes('Failed to load resource: the server responded with a status of 404') ||
text.includes('Blocked: pdb') ||
text.includes('mono_download_assets') ||
text.includes('.pdb') ||
text.includes('Fetch API cannot load') ||
text.includes('Failed to fetch') ||
text.includes('instantiate_wasm_module') ||
text.includes('resource-collection') ||
text.includes("The value 'get' is not a function") ||
text.includes('download \'http://localhost:5001/admin/_framework/') ||
text.includes('failed 404 Not Found')
) {
return;
}
consoleErrors.push(text);
}
});
page.on('pageerror', error => {
const text = error.message;
if (
text.includes('Blocked: pdb') ||
text.includes('mono_download_assets') ||
text.includes('.pdb') ||
text.includes('Failed to fetch') ||
text.includes('resource-collection') ||
text.includes("The value 'get' is not a function") ||
text.includes('download \'http://localhost:5001/admin/_framework/') ||
text.includes('failed 404 Not Found')
) {
return;
}
consoleErrors.push(text);
});
await page.goto(`${baseUrl}/admin/login`);
await expect(page).toHaveTitle(/관리자/);
await expect(page.getByRole('heading', { name: /관리자 로그인/ })).toBeVisible();
await loginThroughAdminUi(page, baseUrl, username, password);
await expect(page).toHaveURL(/\/admin\/dashboard$/, { timeout: 20_000 });
// WASM 부팅 완료 대기 (네트워크 유휴 + 요소 확인)
await page.waitForLoadState('networkidle', { timeout: 30_000 });
await expect(page.locator('body')).toContainText('세무 운영 콘솔', { timeout: 60_000 });
// 헤더의 로그아웃 링크만 선택 (strict mode 위반 해결)
await expect(page.getByRole('banner').getByRole('link', { name: /로그아웃/ })).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-shell')).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-drawer')).toBeVisible({ timeout: 30_000 });
await expect(page.locator('.admin-content')).toContainText(/대시보드|세무 운영 콘솔/, { timeout: 30_000 });
await captureEvidence(page, test.info(), 'admin-dashboard-smoke');
expect(consoleErrors, 'browser console/page errors').toEqual([]);
});
});