diff --git a/apps/app/e2e/shell/editor-deselect.spec.ts b/apps/app/e2e/shell/editor-deselect.spec.ts index a07e7c9a..99dd6ac6 100644 --- a/apps/app/e2e/shell/editor-deselect.spec.ts +++ b/apps/app/e2e/shell/editor-deselect.spec.ts @@ -20,6 +20,7 @@ import { reloadAccepting, revisionText, saveLine, + scrollToTop, seedDraft, selectionTag, selectTab, @@ -140,6 +141,18 @@ async function expectDeselected(page: Page) { await expect(overview(page)).toBeVisible() } +/** The client point hits the canvas box, not the sticky strip or bar over it. */ +async function expectOnDrawing(page: Page, at: { x: number; y: number }) { + const hit = await page.evaluate( + ({ x, y }) => + document + .elementFromPoint(x, y) + ?.closest('[data-testid="annotation-canvas"]') != null, + at, + ) + expect(hit, `${at.x}, ${at.y} lands on the drawing`).toBe(true) +} + /** A negative check: the state is still there after two animation frames. */ async function expectKept(page: Page, name: string) { await frames(page) @@ -292,6 +305,9 @@ test.describe('deselect and D6b (editor, mouse and keyboard)', () => { requests.forbid(actor.account.email, actor.account.password) await select(page, POINT) for (const at of [IN_CIRCLE, IN_RECT, IN_ROOT]) { + // The row click scrolled the page: the drawing's top band is under the sticky strip. + await scrollToTop(page) + await expectOnDrawing(page, await clientOf(page, at.x, at.y)) await clickAt(page, at) await expectDeselected(page) await select(page, POINT) @@ -624,9 +640,11 @@ test.describe('deselect and D6b (touch, editor at 1 280 px)', () => { // b. Empty drawing, a zone about 40 px below the tap. await select(page, POINT) + await scrollToTop(page) await takeRecord(page) const top = await clientOf(page, 175, 100) const above = { x: top.x, y: top.y - 40 } + await expectOnDrawing(page, above) expect(await annotationUnder(page, above)).toBeNull() await tap(cdp, above) await expectDeselected(page) diff --git a/apps/app/e2e/shell/editor-journey.spec.ts b/apps/app/e2e/shell/editor-journey.spec.ts index beb07605..b251bc97 100644 --- a/apps/app/e2e/shell/editor-journey.spec.ts +++ b/apps/app/e2e/shell/editor-journey.spec.ts @@ -26,6 +26,7 @@ import { savedLine, saveDraft, saveLine, + scrollToTop, closeSecondSession, secondSession, selectionTag, @@ -255,6 +256,8 @@ async function modifyAnnotations(page: Page) { */ async function repairGeometry(page: Page) { await toolButton(page, dict, 'point').click() + // The last row click scrolled the page: the drawing's top edge is under the sticky strip. + await scrollToTop(page) // On this 200 x 150 drawing the core keeps a shrunk marker at 1 unit from the edge: the // proposal of a corrected position needs a click on the edge itself (editor-geometry // covers it on a 1 000-unit drawing). Here the click is placed at once. @@ -334,6 +337,8 @@ test.describe('editor journey (owner trial steps)', () => { await historyButton(page, dict, 'undo').click() await historyButton(page, dict, 'redo').click() const modified = await modifyAnnotations(page) + // At rest: scrolled, the stuck strip covers part of the aside's targets (axe target-size). + await scrollToTop(page) await expectAccessible(page, 'the editor with annotations') await saveDraft(page, dict, 1) const draftId = await sql(