- 개발/테스트 스크립트를 dev_scripts/ 폴더로 이동 - 스크린샷을 screenshots/ 폴더로 이동 - 백업 파일 보존 (.backup) - 처방 관련 추가 스크립트 포함 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
간단한 프론트엔드 확인
|
|
"""
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
import time
|
|
|
|
def test_purchase_display():
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True)
|
|
page = browser.new_page()
|
|
|
|
print("페이지 로드 중...")
|
|
page.goto("http://localhost:5001", wait_until="networkidle")
|
|
|
|
# 입고 관리 화면으로 직접 이동
|
|
print("\n입고 관리 화면 확인...")
|
|
page.goto("http://localhost:5001/#purchase", wait_until="networkidle")
|
|
time.sleep(2) # JavaScript 렌더링 대기
|
|
|
|
# API 데이터와 실제 렌더링 비교
|
|
print("\n=== API 데이터 vs 화면 렌더링 확인 ===")
|
|
|
|
# API 응답 확인
|
|
api_data = page.evaluate("""
|
|
fetch('/api/purchase-receipts')
|
|
.then(response => response.json())
|
|
.then(data => data)
|
|
""")
|
|
time.sleep(1)
|
|
|
|
# 테이블 확인
|
|
table_html = page.evaluate("document.querySelector('#purchaseReceiptsList').innerHTML")
|
|
|
|
print(f"\nAPI 응답 총금액: {api_data.get('data', [{}])[0].get('total_amount', 0)}")
|
|
|
|
# 화면에 표시된 총금액 찾기
|
|
try:
|
|
total_amount_cell = page.query_selector('.fw-bold.text-primary')
|
|
if total_amount_cell:
|
|
print(f"화면 표시 총금액: {total_amount_cell.text_content()}")
|
|
else:
|
|
print("총금액 셀을 찾을 수 없습니다.")
|
|
except:
|
|
pass
|
|
|
|
# 테이블 전체 내용
|
|
print("\n테이블 HTML (처음 200자):")
|
|
print(table_html[:200] if table_html else "테이블이 비어있음")
|
|
|
|
# 스크린샷
|
|
page.screenshot(path="/root/kdrug/purchase_test.png")
|
|
print("\n스크린샷 저장: /root/kdrug/purchase_test.png")
|
|
|
|
browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
test_purchase_display() |