diff --git a/browser_tests/ComfyPage.ts b/browser_tests/ComfyPage.ts index bb807c955d..2166fbd1ff 100644 --- a/browser_tests/ComfyPage.ts +++ b/browser_tests/ComfyPage.ts @@ -460,6 +460,24 @@ export class ComfyPage { await this.nextFrame() } + async panWithTouch(offset: Position, safeSpot?: Position) { + safeSpot = safeSpot || { x: 10, y: 10 } + const client = await this.page.context().newCDPSession(this.page) + await client.send('Input.dispatchTouchEvent', { + type: 'touchStart', + touchPoints: [safeSpot] + }) + await client.send('Input.dispatchTouchEvent', { + type: 'touchMove', + touchPoints: [{ x: offset.x + safeSpot.x, y: offset.y + safeSpot.y }] + }) + await client.send('Input.dispatchTouchEvent', { + type: 'touchEnd', + touchPoints: [] + }) + await this.nextFrame() + } + async rightClickCanvas() { await this.page.mouse.click(10, 10, { button: 'right' }) await this.nextFrame() diff --git a/browser_tests/interaction.spec.ts b/browser_tests/interaction.spec.ts index 9c3beb7b01..b2b3974c43 100644 --- a/browser_tests/interaction.spec.ts +++ b/browser_tests/interaction.spec.ts @@ -350,6 +350,12 @@ test.describe('Canvas Interaction', () => { await comfyPage.pan({ x: 800, y: 300 }, { x: 1000, y: 10 }) await expect(comfyPage.canvas).toHaveScreenshot('panned-back-to-one.png') }) + + test('@mobile Can pan with touch', async ({ comfyPage }) => { + await comfyPage.closeMenu() + await comfyPage.panWithTouch({ x: 200, y: 200 }) + await expect(comfyPage.canvas).toHaveScreenshot('panned-touch.png') + }) }) test.describe('Widget Interaction', () => { diff --git a/browser_tests/interaction.spec.ts-snapshots/panned-touch-mobile-chrome-linux.png b/browser_tests/interaction.spec.ts-snapshots/panned-touch-mobile-chrome-linux.png new file mode 100644 index 0000000000..ce20e7f1cc Binary files /dev/null and b/browser_tests/interaction.spec.ts-snapshots/panned-touch-mobile-chrome-linux.png differ