Files
taxbaik/tests/e2e/dashboard-check.spec.ts
T
kjh2064 3b055bbc93 경로 최적화 완료: 상대경로 + Nginx rewrite 준비
## 완료 항목
-  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>
2026-07-08 16:27:48 +09:00

50 lines
2.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loginThroughAdminUi } from './helpers/admin-auth';
test('check dashboard metrics', async ({ page }) => {
const baseUrl = (process.env.E2E_BASE_URL || 'https://www.taxbaik.com').replace(/\/$/, '');
const username = process.env.E2E_ADMIN_USERNAME || 'admin';
const password = process.env.E2E_ADMIN_PASSWORD || 'Admin123!@#456';
await loginThroughAdminUi(page, baseUrl, username, password);
await expect(page).toHaveURL(/\/taxbaik\/admin\/dashboard$/);
// Wait for page load
await page.waitForSelector('.admin-page-hero', { timeout: 5000 });
await page.waitForTimeout(2000);
// Check for metric cards
const metrics = page.locator('.admin-metric-card');
const metricCount = await metrics.count();
console.log(`\nFound ${metricCount} metric cards`);
// Log each metric value
for (let i = 0; i < Math.min(metricCount, 4); i++) {
const metric = metrics.nth(i);
const text = await metric.textContent();
console.log(` Metric ${i + 1}: ${text?.trim().slice(0, 100)}`);
}
// Check for data in main content area
const contentText = await page.locator('body').textContent();
const has총문의 = contentText?.includes('총 문의') || false;
const has신규문의 = contentText?.includes('신규 문의') || false;
const has활성공지 = contentText?.includes('활성 공지') || false;
const has예정세무신고 = contentText?.includes('예정 세무신고') || false;
console.log(`\nDashboard content check:`);
console.log(` - 총 문의: ${has총문의}`);
console.log(` - 신규 문의: ${has신규문의}`);
console.log(` - 활성 공지: ${has활성공지}`);
console.log(` - 예정 세무신고: ${has예정세무신고}`);
// Try to get text content from specific areas
const dashContent = await page.locator('.admin-content').textContent();
if (dashContent) {
console.log(`\nDashboard content length: ${dashContent.length}`);
// Check if there are numbers
const numbers = dashContent.match(/\d+/g) || [];
console.log(`Numbers found: ${numbers.slice(0, 10).join(', ')}`);
}
});