import {chromium} from 'playwright'; const url = process.argv[2] || 'http://localhost/s/stay'; const mode = process.argv[3] || 'idle'; const b = await chromium.launch({channel: 'chrome'}); const page = await b.newPage({viewport: {width: 1280, height: 900}}); const w4 = []; page.on('console', (m) => { if (m.text().includes('[w4d]')) w4.push(m.text().slice(0, 80)); }); await page.goto(url, {waitUntil: 'domcontentloaded'}); await page.waitForTimeout(5000); await page.evaluate(() => document.querySelector('#itinerary').scrollIntoView({block: 'center'})); await page.waitForTimeout(9000); // scrollIntoView 쿨타임 7초를 넘긴다 const setup = await page.evaluate(() => { const rail = document.querySelector('#itinerary .slider-viewport'); window.__rail = rail; window.__pos = () => { const c = rail.firstElementChild; let m = 0; try { m = new DOMMatrix(getComputedStyle(c).transform).m41; } catch {} return Math.round(rail.scrollLeft + m); }; const r = rail.getBoundingClientRect(); return {pos: window.__pos(), rect: {top: Math.round(r.top), h: Math.round(r.height)}, vh: innerHeight}; }); if (mode === 'wheel') { await page.mouse.move(640, 450); await page.mouse.wheel(0, 200); } const marks = []; for (let i = 1; i <= 16; i++) { await page.waitForTimeout(1000); marks.push(await page.evaluate((p0) => window.__pos() - p0, setup.pos)); } console.log(mode, JSON.stringify(setup), marks.join(' ')); console.log(w4.join(' | ')); await b.close();