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(); })();