feat(editor): resumed trace edits the closed shape with its handles
« Reprendre le tracé » keeps the pending shape closed; the zone handles (vertex, « + », « − », vertex keys) edit it through the same press path and useZoneEdit, the target generalised to points + drop. A drop on PENDING_ID patches creation.pending only: document, history and unsaved count untouched, message without « Défaire ». Strip: « Tracé repris, saisie gardée » with « Revenir aux propriétés » and « Abandonner ». Handle names fall back to « la nouvelle zone » / « le nouvel accès ». Removed (resumed branch of popVertex, backToProperties -> closeTrace, CreationCommands tracedCount and its « Retirer le dernier sommet »). Removed assertions, editor-creation-dialog.test.tsx, « keeps the vertices and the form; a new vertex, then the dialog again »: - strip « Tracé repris, saisie gardée » -> kept in « keeps the shape closed and the form, shows its handles; two strip commands » - « Retirer le dernier sommet » enabled -> absent; commands are exactly « Revenir aux propriétés », « Abandonner » (same test) - a click on the drawing adds a 4th vertex -> « a click off the handles adds and selects nothing; a double « + » inserts once » - dialog again with Nom (FR) « Tibia » -> « « Revenir aux propriétés » shows the edited shape; « Créer » inserts it » - « Zone tracée, 4 sommets » -> « Zone tracée, 5 sommets » after « + » (same test)
This commit is contained in:
1 parent
816d0f4f9a
commit
a5896710e5
17 files changed
+679
-118
No files matched your search
@@ -3,6 +3,7 @@ import type { CDPSession, Page, TestInfo } from '@playwright/test'
|
||||
import { expect, test } from '../support/browser'
|
||||
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
||||
import {
|
||||
annotationList,
|
||||
clientOf,
|
||||
creationPanel,
|
||||
editorActor,
|
||||
@@ -438,3 +439,115 @@ for (const width of WIDTHS) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Rev 4 point 3 (board 04 C, criterion 27): a resumed trace edited by finger at 1 180 px.
|
||||
test.describe('a resumed trace by finger at 1 180 px (rev 4)', () => {
|
||||
test.use({
|
||||
locale: 'fr-FR',
|
||||
actionTimeout: 15_000,
|
||||
hasTouch: true,
|
||||
viewport: { width: 1180, height: 800 },
|
||||
})
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(isPhone(info), 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
||||
await routeToSandbox(context)
|
||||
})
|
||||
test.afterEach(async ({ context }) => {
|
||||
await dropLateReplays(context)
|
||||
})
|
||||
|
||||
const ghostPoints = async (page: Page) =>
|
||||
(
|
||||
(await page
|
||||
.getByTestId('overlay-ghost')
|
||||
.locator('polygon')
|
||||
.first()
|
||||
.getAttribute('points')) ?? ''
|
||||
)
|
||||
.trim()
|
||||
.split(/\s+/)
|
||||
.map((pair) => pair.split(',').map(Number))
|
||||
const centreOf = async (page: Page, name: string) => {
|
||||
const hit = page
|
||||
.getByRole('button', { name, exact: true })
|
||||
.locator('[data-handle]')
|
||||
const box = (await hit.boundingBox())!
|
||||
return { x: box.x + box.width / 2, y: box.y + box.height / 2 }
|
||||
}
|
||||
|
||||
test('drag with the loupe, « + », « − », back, « Créer »: one undo removes it', async ({
|
||||
page,
|
||||
context,
|
||||
requests,
|
||||
}) => {
|
||||
const { actor } = await open(page)
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
const cdp = await context.newCDPSession(page)
|
||||
await toolButton(page, dict, 'zone').click()
|
||||
await canvas(page).scrollIntoViewIfNeeded()
|
||||
// Quick taps, each within the absorber's 400 ms of the last: each one places.
|
||||
for (const [x, y] of [
|
||||
[100, 100],
|
||||
[260, 90],
|
||||
[270, 250],
|
||||
[180, 300],
|
||||
[80, 230],
|
||||
])
|
||||
await tap(cdp, await clientOf(page, x, y))
|
||||
await button(page, 'editor.annotations.trace_close').click()
|
||||
await expect(creationPanel(page)).toBeVisible()
|
||||
await creationPanel(page)
|
||||
.getByLabel(dict['editor.annotations.name_fr'])
|
||||
.fill('Tibia')
|
||||
await expectNoShift(page, async () => {
|
||||
await button(page, 'editor.annotations.creation.resume').click()
|
||||
await expect(creationPanel(page)).toHaveCount(0)
|
||||
})
|
||||
await expectFingerSizedHandles(page)
|
||||
const undoHeld = historyButton(page, dict, 'undo')
|
||||
await expect(undoHeld).toHaveAttribute('aria-disabled', 'true')
|
||||
|
||||
await canvas(page).scrollIntoViewIfNeeded()
|
||||
const from = await clientOf(page, 260, 90)
|
||||
await dragWithLoupe(page, cdp, from, { x: from.x + 30, y: from.y + 30 })
|
||||
await expect(message(page)).toContainText(
|
||||
dict['editor.annotations.message.vertex_moved'],
|
||||
)
|
||||
expect((await ghostPoints(page))[1]).not.toEqual([260, 90])
|
||||
|
||||
await tap(
|
||||
cdp,
|
||||
await centreOf(page, 'Ajouter un sommet après le sommet 1 de Tibia'),
|
||||
)
|
||||
await expect.poll(async () => (await ghostPoints(page)).length).toBe(6)
|
||||
await tap(cdp, await centreOf(page, 'Sommet 4 de Tibia'))
|
||||
await tap(cdp, await centreOf(page, 'Retirer le sommet 4 de Tibia'))
|
||||
await expect.poll(async () => (await ghostPoints(page)).length).toBe(5)
|
||||
await expect(undoHeld).toHaveAttribute('aria-disabled', 'true')
|
||||
const edited = await ghostPoints(page)
|
||||
|
||||
await expectNoShift(page, async () => {
|
||||
await button(page, 'editor.annotations.back_to_properties').click()
|
||||
await expect(creationPanel(page)).toBeVisible()
|
||||
})
|
||||
const panel = creationPanel(page)
|
||||
await expect(
|
||||
panel.getByLabel(dict['editor.annotations.name_fr']),
|
||||
).toHaveValue('Tibia')
|
||||
await panel.getByLabel(dict['editor.annotations.name_en']).fill('Tibia')
|
||||
await panel
|
||||
.getByLabel(dict['editor.annotations.laterality'])
|
||||
.selectOption('unpaired')
|
||||
await panel
|
||||
.getByRole('button', { name: dict['editor.annotations.create'] })
|
||||
.click()
|
||||
await expect(creationPanel(page)).toHaveCount(0)
|
||||
await expect(selectionTag(page)).toContainText('Tibia')
|
||||
expect(await shownPoints(page)).toEqual(edited)
|
||||
// One step: a single undo removes the whole new zone.
|
||||
const rows = annotationList(page, dict).getByRole('button')
|
||||
await expect(rows.filter({ hasText: 'Tibia' })).toHaveCount(1)
|
||||
await historyButton(page, dict, 'undo').click()
|
||||
await expect(rows.filter({ hasText: 'Tibia' })).toHaveCount(0)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user