Files
archie/e2e/checks/chat-dock-drag-cancel.cjs
T
sam 3f092c0704
ci/woodpecker/pr/quality Pipeline was successful
Quality / check (pull_request) Canceled after 0s
test(e2e): chat dock browser checks (#1886)
2026-11-12 23:08:02 +11:00

28 lines
1.2 KiB
JavaScript

// A drag the browser cancels (a touch turned into a scroll, a lost pointer)
// leaves the dock where it was: nothing pins, nothing stays offset, and the
// next drag still works.
const assert = require('node:assert/strict');
const h = require('./helpers/chat-dock.cjs');
module.exports = async ({ page, go }) => {
await h.load(page, go);
await h.expand(page);
const dock = h.dockOf(page);
const before = await dock.boundingBox();
const header = dock.locator('div.cursor-grab');
await h.dragTo(page, 1430);
const dragging = await dock.getAttribute('style');
assert.ok(/translate/.test(dragging || ''), 'the drag never started, so cancelling it proves nothing');
await header.dispatchEvent('pointercancel');
await page.mouse.up();
await h.until(async () => !/translate/.test((await dock.getAttribute('style')) || ''), 'the dock stayed offset after the drag was cancelled');
assert.deepEqual(await dock.boundingBox(), before, 'cancelling the drag moved the dock');
assert.equal((await h.saved(page)).side, null, 'a cancelled drag pinned the dock');
await h.dragTo(page, 1430);
await page.mouse.up();
await h.until(async () => (await h.saved(page)).side === 'right', 'a drag after a cancelled one did not pin');
};