test(editor): keep-alive paths, neutral place visibility

Place visibility context moves to lib/placeVisibility.ts so the catalogue
no longer imports from components/editor. Adds tests: selection survival,
unmeasured hint round trip, keyboard tab move and « Aller à » with a field
focused, replace-tracing kept, announcements. Parse-sharing test uses
object identity. Early exits are two statements; shortcut comment on the
parse cache.

R-24:
- editor-equine.spec.ts:118, editor-geometry.spec.ts:376,
  editor-recovery.spec.ts:39, editor-signout.spec.ts:26: page.getByLabel
  ('Nom (FR)') -> place(page, 'general').getByLabel(...)
- editor-shell.spec.ts: toHaveCount(0) on the visible query -> count 1
  on the raw selector and toBeHidden()
- editor-keep-alive.test.tsx: JSON.parse stack-trace count -> same
  object reference across places
This commit is contained in:
bchanot committed 2026-11-06 20:57:08 +01:00
1 parent 6689827a8d
commit 79a09f8b25
12 files changed
+192 -46

No files matched your search

+5 -1
View File
@@ -11,6 +11,7 @@ import { stepUpAdmin } from '../support/admin'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
place,
type Actor,
closeReferences,
editorActor,
@@ -115,7 +116,10 @@ async function commitName(field: Locator, round: number) {
/** 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 = page.getByLabel(dict['editor.general.name_fr'], { exact: true })
const field = place(page, 'general').getByLabel(
dict['editor.general.name_fr'],
{ exact: true },
)
await startProbe(page)
await commitName(field, 0)
await takeSamples(page)
+7 -3
View File
@@ -3,6 +3,7 @@ import type { Page, TestInfo } from '@playwright/test'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
place,
clickDrawing,
clientOf,
editorActor,
@@ -373,9 +374,12 @@ test.describe('editor geometry (adversarial)', () => {
// An unrelated change is saved: the path is still the seeded one, byte for byte.
await selectTab(page, dict, 'general')
const nameFr = page.getByLabel(dict['editor.general.name_fr'], {
exact: true,
})
const nameFr = place(page, 'general').getByLabel(
dict['editor.general.name_fr'],
{
exact: true,
},
)
await nameFr.fill('Fiche sans toucher au tracé')
await nameFr.press('Tab')
await saveDraft(page, dict, seed.revision + 1)
+4 -1
View File
@@ -4,6 +4,7 @@ import { rpc } from '../../../../packages/supabase/tests/sandbox/stack'
import { expect, expectAccessible, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
place,
copyKeyOf,
editorActor,
expiringEditor,
@@ -36,7 +37,9 @@ const dict = fr
const isPhone = (info: TestInfo) => info.project.name === 'chromium-375'
const nameFr = (page: Page) =>
page.getByLabel(dict['editor.general.name_fr'], { exact: true })
place(page, 'general').getByLabel(dict['editor.general.name_fr'], {
exact: true,
})
async function commitText(field: Locator, value: string) {
await field.fill(value)
+3 -1
View File
@@ -60,7 +60,9 @@ test.describe('editor shell, kept places (B2a)', () => {
await openSection(page, dict, 'categories')
await page.locator('#category-new-fr').fill('Brouillon')
await selectTab(page, dict, 'general')
await expect(place(page, 'annotations.categories')).toHaveCount(0)
const hidden = page.locator('[data-place="annotations.categories"]')
await expect(hidden).toHaveCount(1)
await expect(hidden).toBeHidden()
await selectTab(page, dict, 'annotations')
await expect(page.locator('#category-new-fr')).toHaveValue('Brouillon')
+4 -1
View File
@@ -3,6 +3,7 @@ import type { Locator, Page, TestInfo } from '@playwright/test'
import { expect, test } from '../support/browser'
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
import {
place,
copyKeyOf,
editorActor,
openDraft,
@@ -23,7 +24,9 @@ const dict = fr
const isPhone = (info: TestInfo) => info.project.name === 'chromium-375'
const nameFr = (page: Page) =>
page.getByLabel(dict['editor.general.name_fr'], { exact: true })
place(page, 'general').getByLabel(dict['editor.general.name_fr'], {
exact: true,
})
const button = (scope: Page | Locator, name: string) =>
scope.getByRole('button', { name, exact: true })