- app.py: /api/sales-detail에서 product_images.db 조회하여 thumbnail 반환
- admin_sales_pos.html: 거래별/목록 뷰에 36x36 썸네일 표시
- 이미지 없는 제품은 📦 플레이스홀더 표시
- barcode 우선, drug_code 폴백으로 이미지 매칭
40 lines
1.4 KiB
JavaScript
40 lines
1.4 KiB
JavaScript
const { chromium } = require('playwright');
|
|
|
|
(async () => {
|
|
const browser = await chromium.launch({ headless: true });
|
|
const page = await browser.newPage();
|
|
|
|
// API 응답 캡처
|
|
let apiResponse = null;
|
|
page.on('response', async (response) => {
|
|
if (response.url().includes('/api/print/cusetc')) {
|
|
apiResponse = await response.json();
|
|
}
|
|
});
|
|
|
|
await page.goto('http://localhost:7001/admin');
|
|
console.log('✅ 관리자 페이지');
|
|
|
|
await page.click('td:has-text("김영빈")');
|
|
await page.waitForSelector('text=특이사항', { timeout: 5000 });
|
|
console.log('✅ 모달 열림');
|
|
|
|
// 인쇄 버튼 클릭
|
|
const printBtn = await page.$('button[onclick*="doPrintCusetc"]');
|
|
if (printBtn) {
|
|
await printBtn.click();
|
|
console.log('✅ 인쇄 버튼 클릭');
|
|
|
|
// 즉시 토스트 확인 (API 응답 전)
|
|
await page.waitForTimeout(100);
|
|
const toast = await page.$eval('.toast', el => el?.textContent).catch(() => null);
|
|
console.log('📢 즉시 피드백:', toast || '(토스트 없음)');
|
|
|
|
// API 응답 대기
|
|
await page.waitForTimeout(2000);
|
|
console.log('📡 API 응답:', apiResponse?.success ? '✅ ' + apiResponse.message : '❌ ' + (apiResponse?.error || 'no response'));
|
|
}
|
|
|
|
await browser.close();
|
|
})();
|