The reference library moves into a fifth editor tab (Général,
Annotations, Constats, Références, Vérification; under « Plus » below
640 px with Général and Constats). The header « Références » button is
removed. The side panel becomes the citations list of one finding,
opened only from a finding's trigger (owner GO 2026-11-12: never from a
family; the family keeps its inline list with « Retirer »). Selecting a
tab closes it; every close records one pending move applied after the
panel is gone, focus back to the trigger else the active tab button.
Vérification's reference issues land on the tab. e2e seed gains a
reference cited by « Constat A ».
Gates: typecheck, lint, test:run (app 1396), build, e2e:ui 251 passed;
e2e:shell 15 specs on db:sandbox (editor-equine never listed): 107
passed / 95 skipped / 2 failed (test remap dropped its edit), fixed and
rerun: editor-shell.spec 11 passed; full-row data guard: no
pre-existing row changed in any table. editor-equine.spec.ts helper
calls updated, not run.
## R-24 table (removed or rewritten assertions; old = fc3fec7 line, new = current file)
Unit tests:
| file:old line | old | new |
|---|---|---|
| editor-verification.test.tsx:87-96 | `navigate` called with target AND `expect.any(HTMLElement)` | called with the target only (opener dropped) |
| editor-verification.test.tsx:238-241 | `references[0]` path -> `{place:'references', citedBy:null}` | `{place:'tab', tab:'references', section:null}` |
| editor-verification.test.tsx:262-264 | `placeKey(references[9])` = `editor.place.references` | `editor.tab.references` |
| editor-navigation.test.ts:63 | targetOfKey reference -> `{place:'references', key, citedBy:null}` | `{place:'tab', tab:'references', section:null, key}` |
| editor-navigation.test.ts:80 | `referencesMounted` false at start | `citationsOf` null and `libraryReset` 0 |
| editor-navigation.test.ts:95-110 | go_to a reference opens the panel over the place | go_to a reference shows the Références tab with its focus request |
| editor-navigation.test.ts:112-122 | go_to a tab closes the panel (`references` object) | same, via `citationsOf` null |
| editor-navigation.test.ts:124-136 | select_tab keeps the panel | select_tab CLOSES the panel (P21), keeps section, no request |
| editor-navigation.test.ts:138-146 | `clear_cited_by` drops the filter | removed (action gone); replaced by `open_citations` refuses family/zone/view, `show_all_references` (closes, tab, reset bump), plain go_to leaves reset alone |
| editor-navigation.test.ts:160-175 | open/close references keep tab and section | open/close citations, same assertions on `citationsOf` |
| editor-mode.test.ts:100-109 | tabsFor four tabs, small more = general, findings | five tabs, small more = general, findings, references |
| editor-route.test.tsx:46,50 | TABS four, title « four tabs » | five |
| editor-route.test.tsx:139-146 | 640-1023 px four tabs | five tabs, tablist has `flex-wrap` |
| editor-route.test.tsx:149-161 | « Plus » lists Général, Constats | lists Général, Constats, Références |
| editor-route.test.tsx:168-190 | header button opens panel, ✕ returns focus to button | no header button, panel not mounted at start (full panel flow moved to editor-references-panel.test.tsx) |
| editor-route.test.tsx:192-206 | Escape closes, panel content kept for next opening | removed: the panel is no longer kept mounted (design choice 3); Escape/close covered in editor-references-panel + editor-escape |
| editor-route.test.tsx:208-218 | read-only: panel lists references, no edit control | read-only: the Références tab lists them, no textbox, no add button; plus new: tab keeps mounted when left |
| editor-tabs-lists.test.tsx:47,75,114,130 | render `ReferencesPanel` | render `ReferencesTab` |
| editor-tabs-lists.test.tsx:77 | selector `#reference-ref-a-url` | `#tab-reference-ref-a-url` |
| editor-tabs-lists.test.tsx:131-135 | read-only buttons = only « Fermer les références » | no button at all |
| editor-focus-request.test.tsx:166-171,200-202,346 | `ReferencesPanel` with `panel` props and focus | `ReferenceLibrary` with focus (same assertions) |
| editor-focus-request.test.tsx:226 | `ownedBy(ref,'citations')` is the request | `ownedBy(ref,'references')` is the request, `'citations'` undefined |
| editor-focus-request.test.tsx (Probe) | none | new: Vérification « Aller à » reference -> tab + focused row; reference path naming no element -> tab heading |
| editor-keep-alive.test.tsx:71,178-190 | add form survives closing/reopening the panel | survives leaving/returning to the Références tab (`#tab-reference-new-citation`) |
| editor-keep-alive.test.tsx:300-326 | « Aller à » without focus move commits Références text | a tab click without focus move commits it (one undo entry): « Aller à » is not reachable from the Références tab in R2.1 |
| editor-keep-alive.test.tsx:333-347 | Escape in panel reference field commits, panel hides | same, panel opened from a finding node, field `#panel-reference-ref-1-citation` |
| editor-keep-alive.test.tsx:350-363 | header toggle (no focus move) closes after committing | scrim click (no focus move) closes after committing |
| editor-keep-alive.test.tsx:425 | `referencesButton` click in the all-places sweep | `Références` added to the tab loop |
| editor-escape.test.tsx:218-227 | header button toggle, Escape on body closes panel, annotation selection kept | trigger-opened panel (A5), Escape closes it, `aria-expanded` back to false, selection kept after returning to Annotations |
| editor-escape.test.tsx:255-266 | Escape from tab row closes panel | same from the Constats tab button |
| editor-no-loss.test.tsx:146-153 | reference creation form, in the panel | in the Références tab, id `tab-reference-new-citation` |
| editor-no-loss.test.tsx:285-291 | focused header button survives crossing | focused tab button (Constats) survives crossing: no header button left |
| editor-no-loss.test.tsx:293-307 | references search in panel keeps focus/text | same in the Références tab body |
| editor-no-loss.test.tsx:390-400 | `everyPlace` ends by opening the panel | visits Références in the tab loop, no panel open |
| editor-no-loss-decisions.test.tsx:248-259 | open references panel holds the decision back | REMOVED: the panel exists only over Constats, decisions live in Annotations (hidden then); « a widening on another tab opens nothing » (same file) covers the withholding |
| editor-route-recovery.test.tsx:93-97 | recovery offer: header button opens panel, `aria-labelledby` | tab Références shows `editor-tab-references` labelled by `editor-references-title` |
| editor-references-panel.test.tsx (all) | header-button-driven panel tests incl. search, order, add, « Aller à » | split: panel tests (finding path only) stay in this file; library tests moved to new editor-references-tab.test.tsx (search matching, ↑/↓ only without search, counts, Ctrl+Z, read-only, « Aller à », add clears search, refused add keeps it); new: reset signal, ids unique with both mounted (P14), P6 fallback under « Plus » |
e2e (updated only, not run):
| file:old line | old | new |
|---|---|---|
| editor-shell.spec.ts:95-108 | panel keeps form text, no id repeats | Références tab keeps form text (`#tab-reference-new-citation`), ids unique with the panel open |
| editor-shell.spec.ts:121-142 | open panel leaves header and tab row clickable (incl. header Références button, add form) | `openCitations`; header button target and form steps dropped |
| editor-shell-journeys.spec.ts:113-123 | four tabs, `old` list includes « Références » | five tabs, « Références » removed from the old-layout list |
| editor-shell-journeys.spec.ts:246-249 | Aller à reference -> panel visible, close | `place('references')` visible, tab Références selected, row focus key, no close |
| editor-shell-layout.spec.ts:84-103 | overflow on four tabs + panel over drawing | five tabs + `openCitations`/`closeCitations` |
| editor-shell-layout.spec.ts:54-63 | local `goToTab` | removed, uses `openTab` |
| editor-shell-layout.spec.ts:140-158 | canvas width without/with panel over the drawing | E1: width measured before open and after a P21 switch to Annotations, asserted equal |
| editor-shell-layout.spec.ts:161-189 | axe on four tabs + open panel | five tabs + citations panel |
| editor-shell-layout.spec.ts:~255-310 | keyboard order began with `header` (the Références button) | `header` dropped from both orders (no focusable header control while the draft is clean); panel test selects Annotations before walking to `side` |
| editor-access.spec.ts:150-152,191-194,219-220 | axe/overflow with the panel at 320/375/768/800, 1024, read-only | same checks through `openCitations` (`showDrawing` calls dropped) |
| editor-shell-crossing.spec.ts:194-206 | references form with panel open, tab `annotations` | in the tab, focus expected on `editor-tab-references` |
| editor-shell-crossing.spec.ts:264-282 | panel open + add-form text across crossing | citations panel over a crossing, no typed-text step |
| editor-shell-crossing.spec.ts:~385-410 | decision withheld while panel open, Reprendre | REMOVED (state unreachable, see unit row) |
| editor-deselect.spec.ts:226-229 | Escape closes header-opened panel, selection kept | opened via Constats, Escape, back to Annotations, selection kept |
| editor-structures.spec.ts:80-122 | two references added, counts 2/1 | shape now holds `ref-a`: counts 3/2, `nth(1)` after move, saved list `['Référence A','Seconde référence']`, no panel |
| editor-equine.spec.ts:304-305,404-405 | openReferences/closeReferences | `openTab(page, dict, 'references')`: mis à jour, non exécuté, non vérifié |
Fix round 1: 1. e2e/shell/editor-shell.spec.ts « the open citations panel leaves the header and the tab row clickable »: before `openCitations`, the test now opens the Références tab and adds a reference through the library form (`#tab-reference-new-type` book, `#tab-reference-new-citation` « Smith 1999 », « Ajouter la référence »), so the draft is dirty and Save is enabled. All original assertion
446 lines
15 KiB
TypeScript
446 lines
15 KiB
TypeScript
import { readFile } from 'node:fs/promises'
|
|
import { join } from 'node:path'
|
|
import { fr } from '@/i18n/fr'
|
|
import type { Locator, Page } from '@playwright/test'
|
|
import {
|
|
rpc,
|
|
sql,
|
|
stack,
|
|
} from '../../../../packages/supabase/tests/sandbox/stack'
|
|
import { stepUpAdmin } from '../support/admin'
|
|
import { expect, expectAccessible, test } from '../support/browser'
|
|
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
|
import {
|
|
place,
|
|
type Actor,
|
|
annotationList,
|
|
editorActor,
|
|
openEditor,
|
|
openTab,
|
|
openSection,
|
|
SECTIONS,
|
|
seedDraft,
|
|
selectionTag,
|
|
selectTab,
|
|
serverDocument,
|
|
showDrawing,
|
|
standardShape,
|
|
toolButton,
|
|
} from '../support/editor'
|
|
import { signIn } from '../support/shell'
|
|
|
|
// V1-2.6 equine working copy and commit latency (contract C31, plan « Edge cases »): the
|
|
// historical equine sheet opened as a working copy in the editor (a copy left active by
|
|
// an earlier run is set aside first, as sheets-concurrency.sandbox.ts does), the commit
|
|
// latency measured on it and on a synthetic document near 2 MiB. The numbers are
|
|
// reported (console, test annotations); the budget is 500 ms per commit on the equine copy.
|
|
|
|
const dict = fr
|
|
const HISTORICAL = '503dc301-a8b1-50d4-9e44-0919b2fc2916'
|
|
const REPO = join(__dirname, '../../../..')
|
|
const BUDGET_MS = 500
|
|
const SAMPLES = 15
|
|
|
|
interface Sample {
|
|
handler: number
|
|
paint: number
|
|
}
|
|
|
|
/** Time from the Enter or click that commits to the end of its task, and to the 2nd frame. */
|
|
async function startProbe(page: Page) {
|
|
await page.evaluate(() => {
|
|
const w = window as unknown as { __latency?: Sample[] }
|
|
if (w.__latency) {
|
|
w.__latency.length = 0
|
|
return
|
|
}
|
|
const samples: Sample[] = []
|
|
w.__latency = samples
|
|
const mark = (event: Event) => {
|
|
const start = performance.now()
|
|
setTimeout(() => {
|
|
const handler = performance.now() - start
|
|
requestAnimationFrame(() =>
|
|
requestAnimationFrame(() =>
|
|
samples.push({ handler, paint: performance.now() - start }),
|
|
),
|
|
)
|
|
}, 0)
|
|
void event
|
|
}
|
|
window.addEventListener(
|
|
'keydown',
|
|
(e) => e.key === 'Enter' && mark(e),
|
|
true,
|
|
)
|
|
window.addEventListener('click', mark, true)
|
|
})
|
|
}
|
|
|
|
function takeSamples(page: Page): Promise<Sample[]> {
|
|
return page.evaluate(() => {
|
|
const w = window as unknown as { __latency: Sample[] }
|
|
return w.__latency.splice(0)
|
|
})
|
|
}
|
|
|
|
function stats(values: number[]) {
|
|
const sorted = [...values].sort((a, b) => a - b)
|
|
const at = (share: number) => sorted[Math.floor(share * (sorted.length - 1))]
|
|
return {
|
|
n: sorted.length,
|
|
median: Math.round(at(0.5)),
|
|
p95: Math.round(at(0.95)),
|
|
max: Math.round(sorted[sorted.length - 1]),
|
|
}
|
|
}
|
|
|
|
function report(label: string, samples: Sample[]) {
|
|
const line = {
|
|
label,
|
|
handler: stats(samples.map((s) => s.handler)),
|
|
paint: stats(samples.map((s) => s.paint)),
|
|
}
|
|
console.log(`LATENCY ${JSON.stringify(line)}`)
|
|
test.info().annotations.push({
|
|
type: 'latency',
|
|
description: JSON.stringify(line),
|
|
})
|
|
return line
|
|
}
|
|
|
|
async function commitName(field: Locator, round: number) {
|
|
await field.fill(`Nom mesuré ${round}`)
|
|
await field.press('Enter')
|
|
}
|
|
|
|
/** SAMPLES commits of the sheet's French name, one probe entry each (after a warm-up). */
|
|
async function measureRenames(page: Page, label: string) {
|
|
await selectTab(page, dict, 'general')
|
|
const field = place(page, 'general').getByLabel(
|
|
dict['editor.general.name_fr'],
|
|
{ exact: true },
|
|
)
|
|
await startProbe(page)
|
|
await commitName(field, 0)
|
|
await takeSamples(page)
|
|
for (let round = 1; round <= SAMPLES; round++) await commitName(field, round)
|
|
await expect(field).toHaveValue(`Nom mesuré ${SAMPLES}`)
|
|
await page.waitForTimeout(200)
|
|
return report(label, await takeSamples(page))
|
|
}
|
|
|
|
async function measureAdditions(page: Page, label: string) {
|
|
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}`)
|
|
await page.locator('#category-new-en').fill(`Category ${round}`)
|
|
await page.locator('#category-new-fr').press('Tab')
|
|
await page
|
|
.getByRole('button', { name: dict['editor.general.category_add'] })
|
|
.click()
|
|
await expect(page.locator('#category-new-fr')).toHaveValue('')
|
|
}
|
|
await page.waitForTimeout(200)
|
|
// The first round is the warm-up.
|
|
return report(label, (await takeSamples(page)).slice(1))
|
|
}
|
|
|
|
async function confirmHistoricalDrawing() {
|
|
const row = (
|
|
await sql(`select id || ' ' || sha256 || ' ' || (uploaded_at is null)::text
|
|
from public.anatomical_sheet_assets where sheet_id = '${HISTORICAL}'`)
|
|
).split(' ')
|
|
if (row[2] !== 'true') return
|
|
const bytes = await readFile(
|
|
join(REPO, 'supabase/seed/anatomical-sheets/equine/draft/assets/horse.svg'),
|
|
)
|
|
const stored = await fetch(
|
|
`${stack.storageUrl}/object/anatomical-sheet-assets/${row[1]}.svg`,
|
|
{
|
|
method: 'POST',
|
|
headers: {
|
|
Authorization: `Bearer ${stack.serviceKey}`,
|
|
'Content-Type': 'image/svg+xml',
|
|
},
|
|
body: new Uint8Array(bytes),
|
|
},
|
|
)
|
|
await stored.arrayBuffer()
|
|
const confirmed = await rpc(
|
|
'confirm_sheet_asset_upload',
|
|
{ asset_id: row[0] },
|
|
stack.serviceKey,
|
|
)
|
|
expect(confirmed.status).toBe(200)
|
|
}
|
|
|
|
/** Finding nodes with long descriptions, up to about 1.9 MiB of document text. */
|
|
function nearCapShape(document: Record<string, unknown>) {
|
|
standardShape(document)
|
|
const filler = (letter: string) => letter.repeat(260)
|
|
const zones = []
|
|
for (let z = 0; z < 20; z++) {
|
|
const categories = []
|
|
for (let c = 0; c < 10; c++) {
|
|
const children = []
|
|
for (let n = 0; n < 12; n++) {
|
|
children.push({
|
|
id: `node-${z}-${c}-${n}`,
|
|
name: { fr: `Constat ${z}.${c}.${n}`, en: `Finding ${z}.${c}.${n}` },
|
|
description: { fr: filler('a'), en: filler('b') },
|
|
requires_vet_referral: false,
|
|
reference_ids: [],
|
|
review_status: 'reviewed',
|
|
children: [],
|
|
})
|
|
}
|
|
categories.push({
|
|
id: `fcat-${z}-${c}`,
|
|
kind: 'dysfunction',
|
|
name: { fr: `Catégorie ${z}.${c}`, en: `Category ${z}.${c}` },
|
|
description: {},
|
|
reference_ids: [],
|
|
review_status: 'reviewed',
|
|
children,
|
|
})
|
|
}
|
|
zones.push({
|
|
id: `zone-${z}`,
|
|
name: { fr: `Zone ${z}`, en: `Zone ${z}` },
|
|
categories,
|
|
})
|
|
}
|
|
document.finding_zones = zones
|
|
}
|
|
|
|
test.describe.configure({ mode: 'serial' })
|
|
|
|
test.describe('equine working copy and commit latency', () => {
|
|
test.use({ locale: 'fr-FR', actionTimeout: 30_000 })
|
|
// Skipped as a whole on the phone project: beforeAll and afterAll toggle the copies'
|
|
// status and must run in one worker only.
|
|
test.skip(({ isMobile }) => isMobile, 'editing needs 1 024 px') // floor-guard: allow C16 editing needs >= 1024 px; phone read-only covered in editor-access
|
|
let actor: Actor
|
|
let setAside: string[] = []
|
|
let copyId = ''
|
|
|
|
test.beforeAll(async () => {
|
|
actor = await editorActor('fr')
|
|
await confirmHistoricalDrawing()
|
|
// A copy left active by an earlier run is set aside and put back after.
|
|
setAside = (
|
|
await sql(`update public.anatomical_sheets set status = 'archived', archived_at = now()
|
|
where status = 'active' and private.is_historical_working_copy(id) returning id`)
|
|
)
|
|
.split('\n')
|
|
.filter(Boolean)
|
|
})
|
|
|
|
test.afterAll(async () => {
|
|
// Archived as postgres, like the set-aside below: the sheet is a fixture of this run.
|
|
if (copyId)
|
|
await sql(`update public.anatomical_sheets set status = 'archived', archived_at = now()
|
|
where id = '${copyId}'`)
|
|
if (setAside.length > 0)
|
|
await sql(`update public.anatomical_sheets set status = 'active', archived_at = null
|
|
where id in (${setAside.map((id) => `'${id}'`).join(', ')})`)
|
|
})
|
|
|
|
test.beforeEach(async ({ context }) => {
|
|
await routeToSandbox(context)
|
|
})
|
|
test.afterEach(async ({ context }) => {
|
|
await dropLateReplays(context)
|
|
})
|
|
|
|
test('the historical equine sheet opens as a working copy in the editor', async ({
|
|
page,
|
|
requests,
|
|
}) => {
|
|
test.setTimeout(120_000)
|
|
requests.forbid(actor.account.email, actor.account.password)
|
|
const errors: string[] = []
|
|
page.on('pageerror', (error) => errors.push(error.message))
|
|
await signIn(page, actor.account, dict)
|
|
await page.goto('/app/admin')
|
|
await stepUpAdmin(page, dict, actor.secret)
|
|
await page.goto(`/app/admin/sheets/${HISTORICAL}`)
|
|
await page
|
|
.getByRole('button', { name: dict['admin.working_copy.create'] })
|
|
.first()
|
|
.click()
|
|
const dialog = page.getByRole('dialog', {
|
|
name: dict['admin.working_copy.create'],
|
|
})
|
|
// The proposed slug is taken by the copies of earlier runs: one of its own.
|
|
await dialog
|
|
.getByLabel(dict['admin.sheet_form.slug'])
|
|
.fill(`e2e-copie-${actor.account.id.slice(0, 8)}`)
|
|
await dialog
|
|
.getByRole('button', { name: dict['admin.working_copy.confirm'] })
|
|
.click()
|
|
await expect(page).toHaveURL(/\/app\/admin\/sheets\/[0-9a-f-]{36}\/draft$/)
|
|
copyId = new URL(page.url()).pathname.split('/')[4]
|
|
await expect(
|
|
page.getByText(dict['admin.badge.working_copy'], { exact: true }),
|
|
).toBeVisible()
|
|
await expect(toolButton(page, dict, 'point')).toBeEnabled()
|
|
const rows = page
|
|
.getByRole('list', { name: dict['editor.annotations.list'] })
|
|
.getByRole('listitem')
|
|
await expect(rows.first()).toBeVisible()
|
|
expect(await rows.count()).toBeGreaterThan(5)
|
|
await expectAccessible(page, 'the equine working copy')
|
|
// Every tab opens on the real equine data without a page error (the findings tree
|
|
// 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', 'verification'])
|
|
await selectTab(page, dict, tab)
|
|
for (const section of SECTIONS) await openSection(page, dict, section)
|
|
await openTab(page, dict, 'references')
|
|
expect(errors, 'page errors on the equine copy').toEqual([])
|
|
})
|
|
|
|
test('an empty click on the horse drawing deselects the annotation (D6b)', async ({
|
|
page,
|
|
requests,
|
|
}) => {
|
|
test.setTimeout(120_000)
|
|
expect(copyId).not.toBe('')
|
|
requests.forbid(actor.account.email, actor.account.password)
|
|
await signIn(page, actor.account, dict)
|
|
await page.goto('/app/admin')
|
|
await stepUpAdmin(page, dict, actor.secret)
|
|
await page.goto(`/app/admin/sheets/${copyId}/draft`)
|
|
await expect(toolButton(page, dict, 'point')).toBeEnabled()
|
|
await showDrawing(page, dict)
|
|
await annotationList(page, dict).getByRole('button').first().click()
|
|
await expect(selectionTag(page)).toHaveCount(1)
|
|
// A horse path no annotation covers: its box centre hits the path itself.
|
|
const at = await page
|
|
.getByTestId('annotation-canvas')
|
|
.evaluate((canvas) => {
|
|
const paths = canvas.querySelectorAll('path')
|
|
for (const path of paths) {
|
|
if (path.closest('[data-anno-id]')) continue
|
|
const r = path.getBoundingClientRect()
|
|
const x = r.x + r.width / 2
|
|
const y = r.y + r.height / 2
|
|
if (document.elementFromPoint(x, y) !== path) continue
|
|
return { x, y }
|
|
}
|
|
return null
|
|
})
|
|
expect(
|
|
at,
|
|
'a horse path with no annotation under its centre',
|
|
).not.toBeNull()
|
|
await page.mouse.click(at!.x, at!.y)
|
|
await expect(selectionTag(page)).toHaveCount(0)
|
|
await expect(page.getByTestId('annotation-overview')).toBeVisible()
|
|
})
|
|
|
|
test('commit latency on the equine copy', async ({ page, requests }) => {
|
|
test.setTimeout(180_000)
|
|
expect(copyId).not.toBe('')
|
|
requests.forbid(actor.account.email, actor.account.password)
|
|
await signIn(page, actor.account, dict)
|
|
await page.goto('/app/admin')
|
|
await stepUpAdmin(page, dict, actor.secret)
|
|
await page.goto(`/app/admin/sheets/${copyId}/draft`)
|
|
await expect(toolButton(page, dict, 'point')).toBeEnabled()
|
|
|
|
const renames = await measureRenames(page, 'equine: rename (update)')
|
|
const additions = await measureAdditions(
|
|
page,
|
|
'equine: add category (insert)',
|
|
)
|
|
// A geometry edit: the first annotation's centre, through the geometry group.
|
|
await showDrawing(page, dict)
|
|
await page
|
|
.getByRole('list', { name: dict['editor.annotations.list'] })
|
|
.getByRole('button')
|
|
.first()
|
|
.click()
|
|
const cx = page.getByLabel(dict['editor.annotations.geometry.cx'], {
|
|
exact: true,
|
|
})
|
|
const base = Number(await cx.inputValue())
|
|
await startProbe(page)
|
|
for (let round = 0; round <= SAMPLES; round++) {
|
|
await cx.fill(String(base + ((round % 2) + 1) * 0.5))
|
|
await cx.press('Enter')
|
|
}
|
|
await page.waitForTimeout(200)
|
|
const moves = report(
|
|
'equine: geometry edit',
|
|
(await takeSamples(page)).slice(1),
|
|
)
|
|
for (const line of [renames, additions, moves])
|
|
expect(line.handler.max, line.handler.max + ' ms').toBeLessThan(BUDGET_MS)
|
|
})
|
|
|
|
test('commit-to-paint on the equine copy with every place visited (U1 shell)', async ({
|
|
page,
|
|
requests,
|
|
}) => {
|
|
test.setTimeout(180_000)
|
|
expect(copyId).not.toBe('')
|
|
requests.forbid(actor.account.email, actor.account.password)
|
|
await signIn(page, actor.account, dict)
|
|
await page.goto('/app/admin')
|
|
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).
|
|
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')
|
|
const renames = await measureRenames(page, 'equine, all places: rename')
|
|
const additions = await measureAdditions(page, 'equine, all places: add')
|
|
for (const line of [renames, additions])
|
|
expect(line.paint.max, `${line.paint.max} ms to paint`).toBeLessThan(
|
|
BUDGET_MS,
|
|
)
|
|
})
|
|
|
|
test('commit latency on a synthetic document near 2 MiB', async ({
|
|
page,
|
|
requests,
|
|
}) => {
|
|
test.setTimeout(180_000)
|
|
requests.forbid(actor.account.email, actor.account.password)
|
|
const seed = await seedDraft(actor, { shape: nearCapShape })
|
|
const bytes = Number(
|
|
await sql(
|
|
`select octet_length(content::text) from public.anatomical_sheet_versions where id = '${seed.draftId}'`,
|
|
),
|
|
)
|
|
console.log(`SYNTHETIC document ${bytes} bytes`)
|
|
expect(bytes).toBeGreaterThan(1_800_000)
|
|
expect(bytes).toBeLessThanOrEqual(2_097_152)
|
|
expect(
|
|
Object.keys(await serverDocument(seed.draftId)).length,
|
|
).toBeGreaterThan(5)
|
|
await openEditor(page, dict, actor, seed.sheetId)
|
|
const renames = await measureRenames(
|
|
page,
|
|
`synthetic ${bytes} B: rename (update)`,
|
|
)
|
|
const additions = await measureAdditions(
|
|
page,
|
|
`synthetic ${bytes} B: add category (insert)`,
|
|
)
|
|
test.info().annotations.push({
|
|
type: 'synthetic-bytes',
|
|
description: String(bytes),
|
|
})
|
|
expect(renames.handler.n).toBeGreaterThan(0)
|
|
expect(additions.handler.n).toBeGreaterThan(0)
|
|
})
|
|
})
|