diff --git a/apps/app/e2e/shell/editor-equine.spec.ts b/apps/app/e2e/shell/editor-equine.spec.ts index 1558ad13..25bd4f47 100644 --- a/apps/app/e2e/shell/editor-equine.spec.ts +++ b/apps/app/e2e/shell/editor-equine.spec.ts @@ -15,6 +15,7 @@ import { type Actor, annotationList, editorActor, + openCitations, openEditor, openTab, openSection, @@ -395,11 +396,18 @@ test.describe('equine working copy and commit latency', () => { await stepUpAdmin(page, dict, actor.secret) await page.goto(`/app/admin/sheets/${copyId}/draft`) await expect(toolButton(page, dict, 'point')).toBeEnabled() - // Every tab, section and the panel mounted once: all of them stay mounted (B2a). + // Every tab, section and the citations panel mounted once: all of them stay mounted (B2a). for (const tab of ['general', 'findings', 'verification']) await selectTab(page, dict, tab) for (const section of SECTIONS) await openSection(page, dict, section) await openTab(page, dict, 'references') + // Zone parietal, 5 steps down to the sagittal suture (unique name, cites references). + await openCitations( + page, + dict, + 'Suture sagittale (entre les deux pariétaux)', + 5, + ) const renames = await measureRenames(page, 'equine, all places: rename') const additions = await measureAdditions(page, 'equine, all places: add') for (const line of [renames, additions]) diff --git a/apps/app/e2e/support/editor.ts b/apps/app/e2e/support/editor.ts index 0ec24418..50003dca 100644 --- a/apps/app/e2e/support/editor.ts +++ b/apps/app/e2e/support/editor.ts @@ -393,8 +393,8 @@ const SMALL_TIER_WIDTH = 640 /** * Shows a tab whatever the width: the tab button from 640 px, below it « Plus » opened and - * the tab picked in its list. Waits for the body of a tab that has a `data-place` of its - * own (every one but Annotations, which names its sections). + * the tab picked in its list. Waits for the tab's place to be visible (Annotations names + * its sections, so any of them). */ export async function openTab(page: Page, dict: Dict, tab: string) { const width = page.viewportSize()?.width ?? SMALL_TIER_WIDTH @@ -414,18 +414,28 @@ export async function openTab(page: Page, dict: Dict, tab: string) { } else { await page.getByRole('tab', { name }).click() } - if (tab !== 'annotations') await expect(place(page, tab)).toBeVisible() + await expect( + tab === 'annotations' + ? page.locator('[data-place^=annotations]:visible').first() + : place(page, tab), + ).toBeVisible() } /** * Opens the citations panel of the finding named `element`: the Constats tab, the tree * expanded down to it, the element selected, its « n références » trigger pressed, the - * slide over (the heading holds the focus). + * slide over (the heading holds the focus). Expansion goes depth-first from the first + * zone, one node per step, at most `expansions` steps (4 is enough for a small fixture). */ -export async function openCitations(page: Page, dict: Dict, element: string) { +export async function openCitations( + page: Page, + dict: Dict, + element: string, + expansions = 4, +) { await openTab(page, dict, 'findings') const item = page.getByRole('treeitem', { name: element }) - for (let depth = 0; depth < 4 && (await item.count()) === 0; depth++) { + for (let step = 0; step < expansions && (await item.count()) === 0; step++) { const closed = page.getByRole('treeitem', { expanded: false }).first() await closed.focus() await closed.press('ArrowRight')