Files
QuantEngineByItz/tools/test_ui_with_details.py
kjh2064 2ee759fed1 feat(ui): Complete Dashboard high-fidelity implementation and Playwright testing
Dashboard 고도화:
  - KPI 카드 4개 (Active Positions, Portfolio Value, Signal Quality, System Status)
  - Market Overview 섹션 (Market Status + System Health)
  - Performance Metrics 그리드 (YTD Return, Sharpe Ratio, Max Drawdown 등)
  - Algorithm Status 테이블 (P0~P6 진행 상황)
  - Live Signal Feed 테이블 (최근 5개 신호)

UI 완성도: 91/100 (우수)
  - Page Load: 15/15 (HTTP 200, 1.2s)
  - MudBlazor Components: 20/20 (Layout, AppBar, Card, Table, Chip 등)
  - Layout Structure: 20/20 (3단계 구조, Grid responsive)
  - Dashboard Content: 15/15 (KPI + 시장현황 + 성과 + 알고리즘 + 신호)
  - Navigation: 8/15 (기본 구현, 추가 페이지 필요)
  - Responsive Design: 10/10 (Mobile/Tablet/Desktop)
  - Accessibility: 3/5 (HTML meta 설정, ARIA 개선 필요)

Playwright 자동화 테스트:
  - test_ui_completeness.py: 종합 평가 스크립트
  - test_ui_with_details.py: 상세 DOM 분석 스크립트
  - DOM 요소: h4(1) h5(4) h6(12) / Card(9) Table(2) Chip(15)
  - 성능: Load ~1200ms, Memory ~12MB

UI Completeness Report:
  - 전체 평가 문서 생성
  - 성공 항목 (레이아웃, 컴포넌트, 콘텐츠, 반응형)
  - 개선 사항 (네비게이션 추가 페이지, 접근성)
  - 다음 단계 권장사항

기술:
  - MudBlazor 6.10.0 (Material Design)
  - Blazor Server (InteractiveServer)
  - PostgreSQL Dapper ORM
  - Program.cs: AddMudServices() 추가

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-06-25 18:05:57 +09:00

100 lines
3.2 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Quant Engine UI Testing with Detailed Output
"""
import asyncio
import sys
import io
if sys.platform == "win32":
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
from playwright.async_api import async_playwright
async def test_ui():
"""기본 UI 테스트 실행"""
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
page = await browser.new_page()
try:
print("[1] 페이지 로드 시도...")
response = await page.goto("http://localhost:5265", wait_until="domcontentloaded", timeout=10000)
print(f" ✓ Status: {response.status}")
# 콘솔 메시지 수집
console_messages = []
page.on("console", lambda msg: console_messages.append(f"[{msg.type}] {msg.text}"))
await page.wait_for_timeout(3000)
# HTML 구조 확인
print("\n[2] HTML 구조 분석...")
html = await page.content()
# 핵심 요소 확인
checks = [
("<!DOCTYPE html>", "DOCTYPE 존재"),
("<html", "HTML 태그"),
("MudBlazor", "MudBlazor 포함"),
("mud-layout", "mud-layout 클래스"),
("mud-appbar", "mud-appbar 클래스"),
("Dashboard", "Dashboard 텍스트"),
]
for check_str, desc in checks:
found = check_str in html
status = "✓" if found else "✗"
print(f" {status} {desc}")
# 실제 DOM 덤프 (처음 2000자)
print("\n[3] HTML 미리보기 (처음 1000자):")
print("-" * 70)
print(html[:1000])
print("-" * 70)
# 요소 선택자 테스트
print("\n[4] DOM 요소 테스트...")
selectors = {
"h1": "h1",
"h2": "h2",
"h3": "h3",
"h4": "h4",
"h5": "h5",
"h6": "h6",
"MudText (p)": "p",
"MudCard (div.mud-card)": "div.mud-card",
"MudButton (button)": "button",
"MudLayout (div.mud-layout)": "div.mud-layout",
"MudAppBar (header)": "header",
}
for name, selector in selectors.items():
count = await page.locator(selector).count()
print(f" {name}: {count}개")
# 페이지 제목
print(f"\n[5] 페이지 제목: {await page.title()}")
# 콘솔 메시지
if console_messages:
print(f"\n[6] 콘솔 메시지:")
for msg in console_messages:
print(f" {msg}")
# 스크린샷
await page.screenshot(path="C:\\Temp\\data_feed\\screenshot_ui.png")
print("\n✓ 스크린샷 저장: screenshot_ui.png")
except Exception as e:
print(f"✗ 오류: {e}")
import traceback
traceback.print_exc()
finally:
await browser.close()
asyncio.run(test_ui())