- 개발/테스트 스크립트를 dev_scripts/ 폴더로 이동 - 스크린샷을 screenshots/ 폴더로 이동 - 백업 파일 보존 (.backup) - 처방 관련 추가 스크립트 포함 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
68 lines
2.5 KiB
Python
68 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
직접 JavaScript 함수 호출 테스트
|
|
"""
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
import time
|
|
|
|
def test_direct_load():
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch(headless=True)
|
|
page = browser.new_page()
|
|
|
|
print("페이지 로드 중...")
|
|
page.goto("http://localhost:5001")
|
|
page.wait_for_load_state("networkidle")
|
|
time.sleep(2)
|
|
|
|
# 직접 입고 관리 탭 활성화 및 함수 호출
|
|
print("\n입고 데이터 직접 로드...")
|
|
page.evaluate("""
|
|
// 입고 탭 표시
|
|
document.querySelectorAll('.tab-pane').forEach(pane => pane.classList.remove('show', 'active'));
|
|
document.querySelector('#purchase').classList.add('show', 'active');
|
|
|
|
// 직접 함수 호출
|
|
if (typeof loadPurchaseReceipts === 'function') {
|
|
loadPurchaseReceipts();
|
|
} else {
|
|
console.error('loadPurchaseReceipts 함수를 찾을 수 없습니다');
|
|
}
|
|
""")
|
|
time.sleep(2)
|
|
|
|
# 테이블 내용 확인
|
|
table_html = page.inner_html('#purchaseReceiptsList')
|
|
print(f"\n테이블 내용 (처음 500자):\n{table_html[:500]}")
|
|
|
|
# 테이블 행 수 확인
|
|
row_count = page.evaluate("document.querySelectorAll('#purchaseReceiptsList tr').length")
|
|
print(f"\n테이블 행 수: {row_count}")
|
|
|
|
# 첫 번째 행 내용 확인
|
|
if row_count > 0:
|
|
first_row = page.evaluate("""
|
|
const row = document.querySelector('#purchaseReceiptsList tr');
|
|
if (row) {
|
|
const cells = row.querySelectorAll('td');
|
|
return Array.from(cells).map(cell => cell.textContent.trim());
|
|
}
|
|
return null;
|
|
""")
|
|
if first_row:
|
|
print(f"\n첫 번째 행 데이터:")
|
|
headers = ['입고일', '공급업체', '품목 수', '총 금액', '총 수량', '파일명', '작업']
|
|
for i, value in enumerate(first_row[:-1]): # 마지막 '작업' 열 제외
|
|
if i < len(headers):
|
|
print(f" {headers[i]}: {value}")
|
|
|
|
# 스크린샷
|
|
page.screenshot(path="/root/kdrug/direct_test.png")
|
|
print("\n스크린샷 저장: /root/kdrug/direct_test.png")
|
|
|
|
browser.close()
|
|
|
|
if __name__ == "__main__":
|
|
test_direct_load() |