test(tests): R2 non-regression sweep fixes

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.
This commit is contained in:
bchanot committed 2026-11-12 22:42:20 +01:00
1 parent 8db6f4287f
commit 4b7d2542fd
2 files changed
+25 -7

No files matched your search

+16 -6
View File
@@ -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')