// Run on an unlocked phone-size localhost preview using Runtime.evaluate with // awaitPromise. Reproduces the visible adjacent screen and centered macro text. (async () => { const checks = {}; const target = document.querySelector('.orb'); const rect = target.getBoundingClientRect(); const x = innerWidth / 2; const y = rect.y + rect.height / 2; const emit = (type, dx, ended = false) => { const touch = new Touch({ identifier: 21, target, clientX: x + dx, clientY: y }); target.dispatchEvent(new TouchEvent(type, { bubbles: true, cancelable: true, touches: ended ? [] : [touch], changedTouches: [touch] })); }; emit('touchstart', 0); emit('touchmove', -70); emit('touchmove', -140); await new Promise(requestAnimationFrame); await new Promise(requestAnimationFrame); const nextHeading = [...document.querySelectorAll('h1')].find(e => e.textContent.includes('Library')); const next = nextHeading?.getBoundingClientRect(); checks.nextScreenVisibleDuringDrag = Boolean(next && next.width > 0 && next.left > 0 && next.left < innerWidth); const current = target.getBoundingClientRect(); checks.followsFingerWithoutDamping = Math.abs((rect.left - current.left) - 140) < 3; emit('touchcancel', -140, true); await new Promise(resolve => setTimeout(resolve, 380)); emit('touchstart', 0); emit('touchmove', -100); await new Promise(requestAnimationFrame); const first = new Touch({ identifier: 21, target, clientX: x - 100, clientY: y }); const second = new Touch({ identifier: 22, target, clientX: x + 10, clientY: y }); target.dispatchEvent(new TouchEvent('touchstart', { bubbles: true, touches: [first, second], changedTouches: [second] })); target.dispatchEvent(new TouchEvent('touchend', { bubbles: true, touches: [], changedTouches: [first, second] })); await new Promise(resolve => setTimeout(resolve, 380)); checks.multitouchDoesNotLeavePartialPage = Math.abs(target.getBoundingClientRect().left - rect.left) < 2; const libraryButton = [...document.querySelectorAll('.bottom-nav button')].find(e => e.textContent.trim() === 'Library'); libraryButton.click(); await new Promise(requestAnimationFrame); const viewport = document.querySelector('main'); const rail = document.querySelector('.page-rail'); const before = new DOMMatrixReadOnly(getComputedStyle(rail).transform).m41; const resumeTouch = (type, dx) => { const touch = new Touch({ identifier: 23, target: viewport, clientX: x + dx, clientY: y }); viewport.dispatchEvent(new TouchEvent(type, { bubbles: true, cancelable: true, touches: type === 'touchcancel' ? [] : [touch], changedTouches: [touch] })); }; resumeTouch('touchstart', 0); resumeTouch('touchmove', 40); await new Promise(requestAnimationFrame); await new Promise(requestAnimationFrame); const after = new DOMMatrixReadOnly(getComputedStyle(rail).transform).m41; const desired = before + 40; const expected = desired > 0 ? desired * .15 : desired; checks.interruptedSettleContinuesWithoutJump = Math.abs(after - expected) < 5; resumeTouch('touchcancel', 40); await new Promise(resolve => setTimeout(resolve, 380)); [...document.querySelectorAll('.bottom-nav button')].find(e => e.textContent.trim() === 'Today').click(); await new Promise(resolve => setTimeout(resolve, 380)); checks.macroNumbersCentered = [...document.querySelectorAll('.macro')].filter(e => e.getBoundingClientRect().width > 0).every(macro => { const value = macro.querySelector('div:not(.progress-track)'); const range = document.createRange(); range.selectNodeContents(value); const text = range.getBoundingClientRect(); const track = macro.querySelector('.progress-track').getBoundingClientRect(); return Math.abs(text.x + text.width / 2 - track.x - track.width / 2) < 2; }); return { pass: Object.values(checks).every(Boolean), checks }; })()