From 4b7d2542fd0bc3f29287ed26dbd5bd6a96e6879e Mon Sep 17 00:00:00 2001 From: bchanot Date: Thu, 12 Nov 2026 22:42:20 +0100 Subject: [PATCH] test(tests): R2 non-regression sweep fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit openTab waits for the shown place on every tab again (the former goToTab waited for the annotations place). editor-equine.spec opens the citations panel again on a finding of the equine copy, « Suture sagittale (entre les deux pariétaux) » (unique, cited, reached in five expansions: openCitations takes an optional expansion budget, default 4); updated for typecheck only, never run (owner rule). Sweep: e2e:shell all 21 specs except editor-equine on db:sandbox: 219 passed / 116 skipped / 3 failed, the three in admin.spec, « Target crashed » during axe on admin screens that render every accumulated grant (not R2); new specs run twice (sweep + 33 passed after these fixes); full-row guard: no pre-existing row changed in any table. R-24 audit of 49867ba..HEAD: 58 mapped, 17 justified, 0 lost. Gates: typecheck, lint, test:run (app 1488), build, e2e:ui 251. --- apps/app/e2e/shell/editor-equine.spec.ts | 10 +++++++++- apps/app/e2e/support/editor.ts | 22 ++++++++++++++++------ 2 files changed, 25 insertions(+), 7 deletions(-) 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')