import {chromium} from 'playwright'; const b = await chromium.launch({channel: 'chrome'}); const page = await b.newPage({viewport: {width: 1280, height: 900}}); await page.goto('http://localhost/s/stay', {waitUntil: 'domcontentloaded'}); await page.waitForTimeout(6000); await page.evaluate(() => { window.__rails = []; document.querySelectorAll('#root .slider-viewport').forEach((el) => window.__rails.push(el)); document.querySelectorAll('#root *').forEach((el) => { if (el.classList.contains('slider-viewport')) return; const f = getComputedStyle(el).overflowX; if ((f === 'auto' || f === 'scroll') && el.scrollWidth - el.clientWidth > 40) window.__rails.push(el); }); window.__st = (i) => { const r = window.__rails[i]; const c = r.firstElementChild; let m = 0; try { m = new DOMMatrix(getComputedStyle(c).transform).m41; } catch {} const bb = r.getBoundingClientRect(); return {pos: Math.round(r.scrollLeft + m), max: Math.round(r.scrollWidth - r.clientWidth), label: r.getAttribute('aria-label') || '?', cx: Math.round(bb.left + bb.width/2), cy: Math.round(bb.top + bb.height/2), top: Math.round(bb.top), h: Math.round(bb.height), vh: innerHeight}; }; }); for (const i of [4, 12]) { await page.mouse.move(5, 5); await page.evaluate((k) => window.__rails[k].scrollIntoView({block: 'center'}), i); await page.waitForTimeout(9000); let s = await page.evaluate((k) => window.__st(k), i); console.log(`\n[${s.label}] max=${s.max} pos=${s.pos} 화면 top=${s.top} h=${s.h} vh=${s.vh}`); await page.waitForTimeout(6000); // 진행 중인 애니메이션까지 가라앉힌다 s = await page.evaluate((k) => window.__st(k), i); const y = Math.min(Math.max(s.cy, 100), 800); const p1 = s.pos; await page.mouse.move(s.cx, y); await page.mouse.wheel(0, 150); await page.mouse.move(5, 5); const marks = []; for (let t = 1; t <= 14; t++) { await page.waitForTimeout(1000); const q = await page.evaluate((k) => window.__st(k), i); marks.push(`${t}s:${q.pos - p1}`); } const f = await page.evaluate((k) => window.__st(k), i); console.log('휠 뒤 14초:', marks.join(' '), `| 끝까지=${f.max} 현재=${f.pos} 화면top=${f.top}`); } await b.close();