import { test } from '../support/browser' import { measureDrag } from '../support/measure-drag' import { PREVIEW_ORIGIN, previewMeasure, startPreview, } from '../support/measure-preview' import { dropLateReplays, FAKE_SUPABASE_ORIGIN, routeToSandbox, } from '../support/sandbox' // U2 Task 8: the hand-run smoothness measure (support/measure-drag.ts). Skipped unless // MEASURE_DRAG=1: a timing figure, never a suite assertion. With MEASURE_BUILD=preview it // runs on a production build (support/measure-preview.ts) instead of the dev server. const preview = previewMeasure() test.describe('drag smoothness measure (hand-run)', () => { test.use({ locale: 'fr-FR', hasTouch: true, viewport: { width: 1180, height: 800 }, ...(preview ? { baseURL: PREVIEW_ORIGIN, allowedOrigins: [PREVIEW_ORIGIN, FAKE_SUPABASE_ORIGIN], } : {}), }) let stopPreview: (() => void) | null = null test.beforeEach(async ({ context }, info) => { test.skip(process.env.MEASURE_DRAG !== '1', 'run by hand: MEASURE_DRAG=1') test.skip(info.project.name !== 'chromium-desktop', 'one run, at 1 180 px') test.setTimeout(600_000) if (preview) stopPreview = await startPreview() await routeToSandbox(context) }) test.afterEach(async ({ context }) => { await dropLateReplays(context) stopPreview?.() stopPreview = null }) test('vertex drag on the equine main view, touch with the loupe and mouse', async ({ page, context, }, info) => { test.setTimeout(600_000) const build = preview ? 'production build (vite preview)' : 'dev server' for (const figures of await measureDrag(page, context)) { const line = JSON.stringify({ build, ...figures }) console.log(`MEASURE ${line}`) info.annotations.push({ type: 'measure', description: line }) } }) })