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

+64 -2
View File
@@ -9,7 +9,7 @@ import { createHash, randomUUID } from 'node:crypto'
import { readFileSync } from 'node:fs'
import { join } from 'node:path'
import type { Dict } from '@/i18n/types'
import type { Browser, BrowserContext, Page } from '@playwright/test'
import type { Browser, BrowserContext, Locator, Page } from '@playwright/test'
import {
enrolTotp,
refusal,
@@ -323,10 +323,72 @@ export async function openDraft(page: Page, dict: Dict, sheetId: string) {
await expect(page.getByRole('tablist')).toBeVisible()
}
/** The four tabs of the editor (U1): the references moved to a panel, the rest to Annotations. */
export const TABS = [
'general',
'annotations',
'findings',
'verification',
] as const
/** The Annotations sections and the panel, in the order the overview offers them. */
export const SECTIONS = ['views', 'categories', 'regions'] as const
/**
* Clicks a tab by role. The name is a pattern: the Vérification tab adds « n erreur(s) »
* to its name while the in-page check has errors.
*/
export async function selectTab(page: Page, dict: Dict, tab: string) {
const name = dict[`editor.tab.${tab}`]
await page.getByRole('tab', { name: new RegExp(`^${name}( |$)`) }).click()
}
/** The visible place with this `data-place` name; a hidden copy never answers. */
export function place(page: Page, name: string): Locator {
return page.locator(`[data-place="${name}"]:visible`)
}
/** « Retour au dessin »: leaves an Annotations section for the drawing. */
export async function backToDrawing(page: Page, dict: Dict) {
await page.getByRole('button', { name: dict['editor.section.back'] }).click()
await expect(place(page, 'annotations.drawing')).toBeVisible()
}
/** The Annotations tab on its drawing, whatever section it was left on. */
export async function showDrawing(page: Page, dict: Dict) {
await selectTab(page, dict, 'annotations')
const back = page.getByRole('button', { name: dict['editor.section.back'] })
if (await back.isVisible()) await backToDrawing(page, dict)
await expect(place(page, 'annotations.drawing')).toBeVisible()
}
/** Opens an Annotations section through its overview entry. */
export async function openSection(
page: Page,
dict: Dict,
section: (typeof SECTIONS)[number],
) {
await showDrawing(page, dict)
await page.locator(`[data-section-entry="${section}"]`).click()
await expect(place(page, `annotations.${section}`)).toBeVisible()
}
/** Opens the references panel from the header button. */
export async function openReferences(page: Page, dict: Dict) {
const toggle = page.getByRole('button', {
name: dict['editor.references.open'],
exact: true,
})
if ((await toggle.getAttribute('aria-expanded')) !== 'true')
await toggle.click()
await expect(place(page, 'references')).toBeVisible()
}
export async function closeReferences(page: Page, dict: Dict) {
await page
.getByRole('tab', { name: dict[`editor.tab.${tab}`], exact: true })
.getByRole('button', { name: dict['editor.references.close'] })
.click()
await expect(place(page, 'references')).toHaveCount(0)
}
/** The revision the server holds for the draft. */
+15 -12
View File
@@ -2,31 +2,26 @@
* Global setup of the shell suite (V1-2.6): the Vite dev server discovers some
* dependencies only when a route first loads them and answers with a full page
* reload, which wiped a form a test had begun to fill. One throwaway session
* visits the editor routes and every tab once before the tests start, so the
* visits the editor routes, every tab, every Annotations section and the references panel once before the tests start, so the
* reload happens here and not in a test.
*/
import { chromium, type FullConfig } from '@playwright/test'
import { fr } from '@/i18n/fr'
import { stepUpAdmin } from './admin'
import {
TABS,
closeReferences,
draftPath,
editorActor,
openReferences,
openSection,
secondSession,
seedDraft,
SECTIONS,
standardShape,
} from './editor'
import { signIn } from './shell'
const TABS = [
'general',
'views',
'annotations',
'findings',
'references',
'vertebrae',
'verification',
] as const
export default async function warmUp(config: FullConfig): Promise<void> {
const baseURL = config.projects[0].use.baseURL ?? ''
const actor = await editorActor('fr')
@@ -42,10 +37,18 @@ export default async function warmUp(config: FullConfig): Promise<void> {
}
for (const tab of TABS) {
await page
.getByRole('tab', { name: fr[`editor.tab.${tab}`], exact: true })
.getByRole('tab', {
name: new RegExp(`^${fr[`editor.tab.${tab}`]}( |$)`),
})
.click()
await page.waitForLoadState('networkidle')
}
for (const section of SECTIONS) {
await openSection(page, fr, section)
await page.waitForLoadState('networkidle')
}
await openReferences(page, fr)
await closeReferences(page, fr)
await page.goto('/app/admin/sheets/new')
await page.waitForLoadState('networkidle')
await browser.close()