test(editor): e2e on the references dialog instead of the sheet

Helpers citationsDialog, closeCitations by the dialog's ✕. Owner journey
with tap at 375, keyboard and axe; geometry checks now dialog in viewport
with focus inside; refused « Tout afficher » over a dirty form.
This commit is contained in:
bchanot committed 2026-11-15 16:15:43 +01:00
1 parent abc781df52
commit 2c4c771269
10 files changed
+260 -323

No files matched your search

@@ -54,8 +54,8 @@ async function layerWritten(page: Page, layer: 'finding' | 'none') {
}, layer)
}
/** Whether the sheet is the dialog on top at the right edge of the viewport. */
const sheetOnTop = (page: Page) =>
/** Whether the references dialog is on top at the right edge of the viewport. */
const citationsOnTop = (page: Page) =>
page.evaluate(() => {
const top = document.elementFromPoint(window.innerWidth - 40, 100)
return !!top?.closest('dialog')?.querySelector('[data-place="citations"]')
@@ -300,16 +300,16 @@ test.describe('finding dialog', () => {
)
})
test('Back and Forward walk the layers, the sheet is on top each time (owner steps 1 to 4)', async ({
test('Back and Forward walk the layers, the references dialog is on top each time (owner steps 1 to 4)', async ({
page,
}) => {
test.setTimeout(150_000)
await open(page)
// 1. the finding dialog, 2. its sheet, 3. « Tout afficher », 4. the references tab.
// 1. the finding dialog, 2. its references dialog, 3. « Tout afficher », 4. the references tab.
await openFinding(page, dict, 'Constat A')
await layerWritten(page, 'finding')
await showCitations(page)
expect(await sheetOnTop(page)).toBe(true)
expect(await citationsOnTop(page)).toBe(true)
await page
.getByRole('button', { name: dict['editor.references.panel_show_all'] })
.click()
@@ -320,7 +320,7 @@ test.describe('finding dialog', () => {
)
await page.goBack()
await expect(page.locator('dialog[open]')).toHaveCount(2)
expect(await sheetOnTop(page)).toBe(true)
expect(await citationsOnTop(page)).toBe(true)
await page.goBack()
await expect(page.locator('dialog[open]')).toHaveCount(1)
await expect(dialog(page)).toBeVisible()
@@ -334,7 +334,7 @@ test.describe('finding dialog', () => {
await expect(page.locator('dialog[open]')).toHaveCount(1)
await page.goForward()
await expect(page.locator('dialog[open]')).toHaveCount(2)
expect(await sheetOnTop(page)).toBe(true)
expect(await citationsOnTop(page)).toBe(true)
await page.goForward()
await expectNoDialog(page)
await expect(place(page, 'references')).toBeVisible()