test(tests): probe mode entry and exit for shifts at three widths

Criterion 5: « Déplacer le point », « Déplacer la zone », « Valider la
position », and « Redessiner » entered then cancelled, each under
expectNoShift at 1 024, 1 180 and 1 280 px (seeded point and zone, the
existing multi-width pattern). The editor-touch « Déplacer la zone » entry
joins the probe; its button is centred first, since below xl the sticky top
bar can cover the strip and Playwright would scroll inside the probe.

No assertion removed. No product shift found.
This commit is contained in:
bchanot committed 2026-11-18 14:13:53 +01:00
1 parent b6aa2819ea
commit 9522eb72aa
2 files changed
+76 -3

No files matched your search

+64 -2
View File
@@ -372,14 +372,20 @@ test.describe('editor annotations (A3)', () => {
page.getByRole('button', { name: dict[key], exact: true })
const line = (page: Page) => page.getByTestId('gesture-line')
async function openWithPoint(page: Page, width: number) {
async function openWithPoint(
page: Page,
width: number,
...others: unknown[]
) {
await page.setViewportSize({ width, height: 800 })
// Installed before any timer: the message's 6 s run on this clock (fast-forwarded below).
await keepNativeFrames(page)
await page.clock.install()
const actor = await editorActor('fr')
const point = pointOf('p-a', 'main', { cx: 500, cy: 300, r: 40 }, 'Pt A')
const seed = await seedDraft(actor, { shape: shapeWith(point) })
const seed = await seedDraft(actor, {
shape: shapeWith(point, ...others),
})
await openEditor(page, dict, actor, seed.sheetId)
await expect(tool(page, 'point')).toBeEnabled()
return actor
@@ -568,6 +574,62 @@ test.describe('editor annotations (A3)', () => {
})
}
const zoneA = {
...pointOf('z-a', 'main', { cx: 0, cy: 0, r: 1 }, 'Zone A'),
kind: 'zone',
geometry: {
type: 'polygon',
points: [
[650, 150],
[850, 150],
[850, 350],
[650, 350],
],
},
}
/** A « Déplacer … » mode entered, one step, left by « Valider la position »: nothing moves. */
async function moveRoundTrip(page: Page, entry: string) {
const right = button(page, 'editor.annotations.move.right')
await expectNoShift(page, async () => {
await button(page, entry).click()
await expect(right).toBeVisible()
})
await expectNoShift(page, () => right.click())
await expectNoShift(page, async () => {
await button(page, 'editor.annotations.move.confirm').click()
await expect(right).toHaveCount(0)
})
await expect(button(page, entry)).toBeFocused()
}
for (const width of [1024, 1180, 1280]) {
test(`at ${width} px: the move modes and « Redessiner », entered and left`, async ({
page,
requests,
}) => {
const actor = await openWithPoint(page, width, zoneA)
requests.forbid(actor.account.email, actor.account.password)
await clickDrawing(page, 500, 300)
await expect(selectionTag(page)).toContainText('Pt A')
await moveRoundTrip(page, 'editor.annotations.move.point')
await clickDrawing(page, 750, 250)
await expect(selectionTag(page)).toContainText('Zone A')
await moveRoundTrip(page, 'editor.annotations.move.zone')
const redraw = button(page, 'editor.annotations.redraw')
const cancel = button(page, 'editor.annotations.trace_cancel')
await expectNoShift(page, async () => {
await redraw.click()
await expect(cancel).toBeVisible()
})
await expectNoShift(page, async () => {
await cancel.click()
await expect(cancel).toHaveCount(0)
})
await expect(redraw).toBeFocused()
})
}
test('the point (U2 Task 4): handle drag, size by a track click, the move mode', async ({
page,
requests,
+12 -1
View File
@@ -373,7 +373,18 @@ for (const width of WIDTHS) {
await select(page, ZONE)
// « Déplacer la zone »: a finger anywhere moves it, « Valider la position » commits.
await button(page, 'editor.annotations.move.zone').click()
// Its entry moves nothing around the drawing (A14). The button is centred first: below
// xl the sticky top bar may cover it, and Playwright would scroll inside the probe.
const entry = button(page, 'editor.annotations.move.zone')
await entry.evaluate((element) =>
element.scrollIntoView({ block: 'center' }),
)
await expectNoShift(page, async () => {
await entry.click()
await expect(
button(page, 'editor.annotations.move.confirm'),
).toBeVisible()
})
await canvas(page).scrollIntoViewIfNeeded()
const empty = await clientOf(page, EMPTY.x, EMPTY.y)
await drag(cdp, empty, { x: empty.x + 40, y: empty.y + 40 })