feat(editor): four tabs, Annotations sections, references from the header

U1 Lot B1. Four tabs (Général, Annotations, Constats, Vérification); views,
categories and regions become full-width Annotations sections opened from the
overview panel; references move to a header-toggled panel (minimal, Lot D
completes it); « Aller à » goes through EditorTarget and the navigation hook.
EditorWorkspace owns the navigation; DraftHeader split in HeaderActions and
SaveLine; EditorTabs split in TabList and MoreTabs.

R-24, assertions removed or rewritten (file: old -> new):
unit
- editor-route.test: seven tab names -> four; « Plus » at 800 px with
  Références clicked -> no « Plus »; below 640 px five others -> Général,
  Constats, and Constats opens the findings tab; + references panel cases
- editor-route-recovery.test: tab Références + editor-tab-references label ->
  header button + editor-references-panel labelled by its heading
- editor-mode.test: small tier `more` of five -> [general, findings]
- editor-focus-request.test: {key,serial} -> {target,serial}; ReferencesTab and
  VertebraeTab -> ReferencesPanel and RegionsSection; issueTarget tab/key ->
  target place/section/key (vertebrae tab -> annotations/regions); consumed
  context (serial) -> (serial, outcome); annotation case adds heading focus
- editor-verification.test: onGoTo('annotations', key) -> navigate(targetOfKey
  (key), opener); props onSelectTab/onGoTo -> navigate
- editor-annotations-tab.test: props onSelectTab -> navigate + section props;
  no_category text « (onglet Général) » -> « (Annotations, section
  Catégories) »
- editor-tabs-general.test: categories cases render GeneralTab ->
  CategoriesSection(doc); + Général holds no categories editor
- editor-tabs-lists.test: tab imports -> panel and section; read-only
  references « no button » -> only « Fermer les références »
- editor-tabs-views, editor-drawing-upload, editor-repair.test: ViewsTab ->
  ViewsSection import, assertions kept; editor-findings.test: navigate prop
e2e
- support/editor selectTab: exact name -> pattern (error badge in the name);
  + place, openSection, showDrawing, backToDrawing, openReferences, TABS
- support/warm-up: seven tabs -> four + sections + references panel
- editor-access: seven-tab axe loops -> four tabs + three sections + panel
  (edit and read-only); narrow widths add panel overflow and axe
- editor-drawings: tab Vues -> openSection views; tab Annotations ->
  showDrawing
- editor-structures: tab Général (categories) -> openSection categories, axe
  label « general tab » -> « categories section »; tab Références ->
  openReferences/closeReferences; tab Vertèbres -> openSection regions; tab
  Annotations -> showDrawing
- editor-geometry: three tab Vues -> openSection views
- editor-equine: tab Général (categories add) -> openSection categories; five
  tabs loop -> two tabs + sections + panel; tab Annotations -> showDrawing
- editor-journey: tab Vues, tab Général (category), tab Annotations ->
  openSection views/categories, showDrawing; frozen axe scrolls to the header
- lan/trial-lan (not run): tab Vues -> Annotations tab + views entry

Verified: typecheck, lint, vitest 107 files / 1125 tests, whole shell suite on
the sandbox 151 passed, 49 skipped, 0 failed.
This commit is contained in:
bchanot committed 2026-11-06 20:25:35 +01:00
1 parent 95b1b7e461
commit bc2dba7c14
56 files changed
+2419 -699

No files matched your search

+30 -9
View File
@@ -9,15 +9,21 @@ import {
import { stepUpAdmin } from '../support/admin'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
SECTIONS,
TABS,
closeReferences,
draftPath,
draftTitle,
editorActor,
makeActor,
openEditor,
openReferences,
openSection,
pointOf,
seedDraft,
selectTab,
shapeWith,
showDrawing,
type Actor,
} from '../support/editor'
import { signIn } from '../support/shell'
@@ -31,15 +37,6 @@ import { signIn } from '../support/shell'
const dict = fr
const isPhone = (info: TestInfo) => info.project.name === 'chromium-375'
const TABS = [
'general',
'views',
'annotations',
'findings',
'references',
'vertebrae',
'verification',
] as const
const seedShape = shapeWith(
pointOf('p1', 'main', { cx: 500, cy: 400, r: 40 }, 'Point un'),
@@ -150,6 +147,9 @@ test.describe('editor access, narrow screens and axe', () => {
).toHaveCount(0)
await expectNoHorizontalOverflow(page, `the draft at ${width} px`)
await expectAccessible(page, `the draft at ${width} px`)
await openReferences(page, dict)
await expectNoHorizontalOverflow(page, `the panel at ${width} px`)
await expectAccessible(page, `the references panel at ${width} px`)
})
}
@@ -178,6 +178,20 @@ test.describe('editor access, narrow screens and axe', () => {
await expectNoHorizontalOverflow(page, `the ${tab} tab at 1 024 px`)
await expectAccessible(page, `the ${tab} tab (edit)`)
}
for (const section of SECTIONS) {
await openSection(page, dict, section)
await page.waitForLoadState('networkidle')
await expectNoHorizontalOverflow(
page,
`the ${section} section at 1 024 px`,
)
await expectAccessible(page, `the ${section} section (edit)`)
}
await showDrawing(page, dict)
await openReferences(page, dict)
await expectNoHorizontalOverflow(page, 'the references panel at 1 024 px')
await expectAccessible(page, 'the references panel (edit)')
await closeReferences(page, dict)
})
test('axe on every tab of a read-only draft', async ({ page, requests }) => {
@@ -197,5 +211,12 @@ test.describe('editor access, narrow screens and axe', () => {
await page.waitForLoadState('networkidle')
await expectAccessible(page, `the ${tab} tab (read-only)`)
}
for (const section of SECTIONS) {
await openSection(page, dict, section)
await expectAccessible(page, `the ${section} section (read-only)`)
}
await showDrawing(page, dict)
await openReferences(page, dict)
await expectAccessible(page, 'the references panel (read-only)')
})
})
+10 -9
View File
@@ -4,14 +4,15 @@ import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
DRAWING_SVG,
INKSCAPE_EXPORT,
editorActor,
INKSCAPE_EXPORT,
openEditor,
seedDraft,
selectTab,
standardShape,
serverDocument,
openSection,
saveDraft,
seedDraft,
serverDocument,
showDrawing,
standardShape,
} from '../support/editor'
// V1-2.6 A2 (contract C16, C20): a drawing imported into a view. A hostile file is
@@ -54,7 +55,7 @@ test.describe('editor drawings (A2)', () => {
requests.forbid(actor.account.email, actor.account.password)
const seed = await seedDraft(actor, { drawing: null })
await openEditor(page, dict, actor, seed.sheetId)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
await expect(
mainDrawing(page).getByText(dict['editor.views.drawing.none']),
).toBeVisible()
@@ -81,7 +82,7 @@ test.describe('editor drawings (A2)', () => {
requests.forbid(actor.account.email, actor.account.password)
const seed = await seedDraft(actor, { drawing: null })
await openEditor(page, dict, actor, seed.sheetId)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
await mainFile(page).setInputFiles(
file(INKSCAPE_EXPORT, 'inkscape-1.4.3.svg'),
@@ -130,7 +131,7 @@ test.describe('editor drawings (A2)', () => {
requests.forbid(actor.account.email, actor.account.password)
const seed = await seedDraft(actor, { drawing: null, shape: standardShape })
await openEditor(page, dict, actor, seed.sheetId)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
await mainFile(page).setInputFiles(file(DRAWING_SVG, 'valide.svg'))
await expect(page.getByText(dict['editor.upload.done'])).toBeVisible()
@@ -164,7 +165,7 @@ test.describe('editor drawings (A2)', () => {
detail.getByText(dict['editor.views.drawing.inherited']),
).toBeVisible()
await selectTab(page, dict, 'annotations')
await showDrawing(page, dict)
await page
.getByRole('group', { name: dict['editor.annotations.views'] })
.getByRole('button', { name: 'Détail A' })
+12 -10
View File
@@ -11,14 +11,19 @@ import { stepUpAdmin } from '../support/admin'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
type Actor,
closeReferences,
editorActor,
openEditor,
openReferences,
openSection,
SECTIONS,
seedDraft,
selectTab,
serverDocument,
showDrawing,
standardShape,
toolButton,
type Actor,
} from '../support/editor'
import { signIn } from '../support/shell'
@@ -121,7 +126,7 @@ async function measureRenames(page: Page, label: string) {
}
async function measureAdditions(page: Page, label: string) {
await selectTab(page, dict, 'general')
await openSection(page, dict, 'categories')
await startProbe(page)
for (let round = 0; round <= SAMPLES; round++) {
await page.locator('#category-new-fr').fill(`Catégorie ${round}`)
@@ -287,14 +292,11 @@ test.describe('equine working copy and commit latency', () => {
// once blanked the page on nodes that omit their defaulted fields).
await selectTab(page, dict, 'findings')
await expect(page.getByTestId('finding-item').first()).toBeVisible()
for (const tab of [
'general',
'views',
'references',
'vertebrae',
'verification',
])
for (const tab of ['general', 'verification'])
await selectTab(page, dict, tab)
for (const section of SECTIONS) await openSection(page, dict, section)
await openReferences(page, dict)
await closeReferences(page, dict)
expect(errors, 'page errors on the equine copy').toEqual([])
})
@@ -314,7 +316,7 @@ test.describe('equine working copy and commit latency', () => {
'equine: add category (insert)',
)
// A geometry edit: the first annotation's centre, through the geometry group.
await selectTab(page, dict, 'annotations')
await showDrawing(page, dict)
await page
.getByRole('list', { name: dict['editor.annotations.list'] })
.getByRole('button')
+5 -4
View File
@@ -8,11 +8,12 @@ import {
editorActor,
geometryField,
openEditor,
openSection,
pointOf,
saveDraft,
seedDraft,
serverDocument,
selectTab,
serverDocument,
shapeWith,
standardShape,
} from '../support/editor'
@@ -201,7 +202,7 @@ test.describe('editor geometry (adversarial)', () => {
),
)
requests.forbid(actor.account.email, actor.account.password)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
const detail = page.getByRole('listitem', { name: 'Détail A' })
await detail
.getByRole('button', { name: dict['editor.views.crop.toggle'] })
@@ -257,7 +258,7 @@ test.describe('editor geometry (adversarial)', () => {
},
})
await openEditor(page, dict, actor, seed.sheetId)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
await page.getByTestId('view-main-file').setInputFiles({
name: 'petit.svg',
mimeType: 'image/svg+xml',
@@ -344,7 +345,7 @@ test.describe('editor geometry (adversarial)', () => {
},
})
await openEditor(page, dict, actor, seed.sheetId)
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
await page.getByTestId('view-main-file').setInputFiles({
name: 'petit.svg',
mimeType: 'image/svg+xml',
+13 -6
View File
@@ -9,16 +9,18 @@ import {
clickDrawing,
createFromPanel,
creationPanel,
INKSCAPE_EXPORT,
editorActor,
fillCreation,
geometryField,
INKSCAPE_EXPORT,
openDraft,
openSection,
saveDraft,
serverDocument,
secondSession,
selectTab,
serverDocument,
showDrawing,
toolButton,
openDraft,
} from '../support/editor'
import { signIn } from '../support/shell'
@@ -79,7 +81,7 @@ async function createSheetFromAdmin(page: Page, tag: string): Promise<string> {
}
async function importDrawing(page: Page) {
await selectTab(page, dict, 'views')
await openSection(page, dict, 'views')
// The real Inkscape 1.4.3 export, cleaned by the core in the page (viewBox 0 0 200 150).
await page.getByTestId('view-view-main-file').setInputFiles({
name: 'inkscape-1.4.3.svg',
@@ -105,7 +107,7 @@ async function importDrawing(page: Page) {
}
async function createFindings(page: Page) {
await selectTab(page, dict, 'general')
await openSection(page, dict, 'categories')
await page.locator('#category-new-fr').fill('Catégorie essai')
await page.locator('#category-new-en').fill('Trial category')
await clickButton(page, dict['editor.general.category_add'])
@@ -132,7 +134,7 @@ async function createFindings(page: Page) {
}
async function createAnnotations(page: Page) {
await selectTab(page, dict, 'annotations')
await showDrawing(page, dict)
const trace = async (points: number[][]) => {
for (const [x, y] of points) await clickDrawing(page, x, y)
await clickButton(page, dict['editor.annotations.trace_close'])
@@ -420,6 +422,11 @@ test.describe('editor journey (owner trial steps)', () => {
`select status from public.anatomical_sheet_reviews where version_id = '${draftId}'`,
),
).toBe('verifying')
// The submit button sits at the page's end: back at the header, whose « Références »
// button the sticky top bar covers while the page is scrolled.
await page
.getByRole('heading', { level: 1, name: 'Brouillon, version 1' })
.evaluate((heading) => heading.scrollIntoView({ block: 'center' }))
await expectAccessible(page, 'the frozen draft')
})
})
+11 -6
View File
@@ -4,8 +4,11 @@ import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
bareShape,
closeReferences,
editorActor,
openEditor,
openReferences,
openSection,
pointOf,
saveDraft,
seedDraft,
@@ -13,6 +16,7 @@ import {
serverDocument,
serverRevision,
shapeWith,
showDrawing,
} from '../support/editor'
// V1-2.6 A4 (contract C9 to C12, C19): the structures around the drawing. Annotation
@@ -56,7 +60,7 @@ test.describe('editor structures (A4)', () => {
requests.forbid(actor.account.email, actor.account.password)
// A category added, then renamed in place.
await selectTab(page, dict, 'general')
await openSection(page, dict, 'categories')
await page.locator('#category-new-fr').fill('Catégorie B')
await page.locator('#category-new-en').fill('Category B')
await page
@@ -67,10 +71,10 @@ test.describe('editor structures (A4)', () => {
await expect(names).toHaveCount(2)
await commitText(names.nth(1), 'Catégorie B bis')
await expect(names.nth(1)).toHaveValue('Catégorie B bis')
await expectAccessible(page, 'the general tab')
await expectAccessible(page, 'the categories section')
// Two references, the second moved up.
await selectTab(page, dict, 'references')
await openReferences(page, dict)
for (const citation of ['Première référence', 'Seconde référence']) {
await page.locator('#reference-new-type').selectOption('book')
await page.locator('#reference-new-citation').fill(citation)
@@ -100,7 +104,8 @@ test.describe('editor structures (A4)', () => {
await expect(citations).toHaveCount(1)
// A region with its count.
await selectTab(page, dict, 'vertebrae')
await closeReferences(page, dict)
await openSection(page, dict, 'regions')
await page.locator('#region-new-code').fill('T')
await page.locator('#region-new-fr').fill('Thoracique')
await page.locator('#region-new-en').fill('Thoracic')
@@ -245,7 +250,7 @@ test.describe('editor structures (A4)', () => {
requests.forbid(actor.account.email, actor.account.password)
// The category is used by the point: the dialog lists it and offers no deletion.
await selectTab(page, dict, 'general')
await openSection(page, dict, 'categories')
await page
.getByRole('listitem')
.filter({ has: page.locator('#category-cat-a-name-fr') })
@@ -283,7 +288,7 @@ test.describe('editor structures (A4)', () => {
.click()
// The point goes first; the zone then deletes with its descendants named.
await selectTab(page, dict, 'annotations')
await showDrawing(page, dict)
await page
.getByRole('list', { name: dict['editor.annotations.list'] })
.getByRole('button', { name: /Point lié/ })