import {chromium} from 'playwright'; const b = await chromium.launch({channel: 'chrome'}); const p = await b.newPage({viewport: {width: 390, height: 780}, isMobile: true, hasTouch: true}); await p.goto('http://localhost/s/stay', {waitUntil: 'domcontentloaded'}); await p.waitForTimeout(5000); await p.evaluate(() => document.querySelector('#itinerary').scrollIntoView({block: 'center'})); await p.waitForTimeout(1200); const pos = () => p.evaluate(() => { const t = document.querySelector('#itinerary .slider-track'); const m = /matrix.*?,\s*(-?[\d.]+),\s*-?[\d.]+\)$/.exec(getComputedStyle(t).transform); return m ? Math.round(parseFloat(m[1])) : 0; }); // ① 손 안 대고 둔다 — 자동 넘김이 살아 있는지 const idle = []; for (let i = 0; i < 6; i++) { await p.waitForTimeout(1000); idle.push(await pos()); } console.log('① 손 안 댐 ', JSON.stringify(idle)); // ② 페이지를 세로로 스크롤(일정 읽으려고) → 그 뒤 자동으로 넘어가는지 await p.mouse.wheel(0, 200); await p.waitForTimeout(300); const afterScroll = await pos(); const scrolled = []; for (let i = 0; i < 6; i++) { await p.waitForTimeout(1000); scrolled.push(await pos()); } console.log('② 세로 스크롤 후', afterScroll, '→', JSON.stringify(scrolled), '· 이동', scrolled[5] - afterScroll); // ③ 쿨타임(7초)이 지나면 다시 도는지 await p.waitForTimeout(4000); const resumed = await pos(); console.log('③ 10초 더 기다림', resumed, '· 쿨타임 뒤 이동', resumed - scrolled[5]); // ④ 손으로 드래그가 여전히 되는지 const box = await p.evaluate(() => { const v = document.querySelector('#itinerary .slider-viewport').getBoundingClientRect(); return {x: Math.round(v.x + v.width / 2), y: Math.round(v.y + v.height / 2)}; }); const before = await pos(); await p.mouse.move(box.x + 100, box.y); await p.mouse.down(); await p.mouse.move(box.x - 110, box.y, {steps: 14}); await p.mouse.up(); await p.waitForTimeout(900); const dragged = await pos(); console.log('④ 손 드래그 ', before, '→', dragged, '· 이동', dragged - before); // ⑤ 드래그한 레일은 이후 자동으로 안 넘어가는지 (10초) await p.waitForTimeout(10000); console.log('⑤ 드래그 후 10초', await pos(), '· 추가 이동', (await pos()) - dragged); await b.close();