import {chromium, devices} from 'playwright'; const url = process.argv[2] || 'http://localhost/s/stay'; const b = await chromium.launch({channel: 'chrome'}); const ctx = await b.newContext({...devices['iPhone 13'], hasTouch: true, isMobile: true}); const page = await ctx.newPage(); const ev = []; await page.goto(url, {waitUntil: 'domcontentloaded'}); await page.waitForTimeout(6000); await page.evaluate(() => document.querySelector('#itinerary').scrollIntoView({block: 'center'})); await page.waitForTimeout(9000); await page.evaluate(() => { const r = document.querySelector('#itinerary .slider-viewport'); window.__r = r; window.__pos = () => { const c = r.firstElementChild; let m = 0; try { m = new DOMMatrix(getComputedStyle(c).transform).m41; } catch {} return Math.round(r.scrollLeft + m); }; window.__ev = []; ['pointerdown','pointerup','pointercancel','touchstart','touchmove','touchend'].forEach((t) => { window.addEventListener(t, (e) => { if (e.isTrusted) window.__ev.push(`${((Date.now()-window.__t0)/1000).toFixed(1)} ${t}`); }, true); }); window.__t0 = Date.now(); }); const box = await page.evaluate(() => { const b = window.__r.getBoundingClientRect(); return {x: Math.round(b.left + b.width/2), y: Math.round(Math.min(Math.max(b.top + b.height/2, 120), 600))}; }); const p0 = await page.evaluate(() => window.__pos()); // 손가락을 대고 천천히 세로로 끌면서 10초 유지 (CDP 로 직접 터치) const cdp = await ctx.newCDPSession(page); const pt = (type, y) => cdp.send('Input.dispatchTouchEvent', {type, touchPoints: type === 'touchEnd' ? [] : [{x: box.x, y}]}); await pt('touchStart', box.y); const marks = []; for (let i = 0; i < 12; i++) { await page.waitForTimeout(900); await pt('touchMove', box.y - (i + 1) * 2); // 아주 조금씩 — 손가락 올린 채 유지 marks.push(await page.evaluate((p) => window.__pos() - p, p0)); } await pt('touchEnd', box.y); console.log('손가락 올린 채 11초:', marks.join(' ')); await page.waitForTimeout(11000); console.log('뗀 뒤 11초:', await page.evaluate((p) => window.__pos() - p, p0)); console.log('이벤트:', (await page.evaluate(() => window.__ev)).slice(0, 14).join(' | ')); await b.close();