feat(editor): sheet landings, history and e2e for the finding layers
« Tout afficher » clears the search and keeps the sort. A landing waits for the dialogs a move closed and for their focus restore. Helpers and shell specs move to the dialog and sheet flow; new finding dialog spec (entries, guards, flip, gone rule, Back and Forward over the layers).
This commit is contained in:
1 parent
18085cecf8
commit
4731a3376a
21 files changed
+782
-474
No files matched your search
@@ -9,23 +9,29 @@ import {
|
||||
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
||||
import {
|
||||
closeCitations,
|
||||
closeFinding,
|
||||
editorActor,
|
||||
expectNoDialog,
|
||||
findingDialog,
|
||||
libraryRoot,
|
||||
openCitations,
|
||||
openEditor,
|
||||
openFinding,
|
||||
openTab,
|
||||
place,
|
||||
saveDraft,
|
||||
seedDraft,
|
||||
serverDocument,
|
||||
showCitations,
|
||||
standardShape,
|
||||
} from '../support/editor'
|
||||
|
||||
// V1-2.6 R2.4: the contextual citations panel of one finding (board 25): its contents,
|
||||
// « Retirer de ce constat » and « Défaire », « Tout afficher », every close path with the
|
||||
// focus checked after the exit (motion and reduced motion), Escape in a tile field, the
|
||||
// inert page during the exit sampled in the page, axe open (edit, read-only at 375 px).
|
||||
// The spec seeds its own sheet and never touches another.
|
||||
// V1-2.6 R2 finish: the citations of one finding as a modal side sheet over its dialog
|
||||
// (R2F-4): its contents, « Retirer de ce constat » and « Défaire », « Tout afficher »,
|
||||
// every close path with the focus checked after the exit (motion and reduced motion),
|
||||
// Escape in a tile field, the exiting sheet inert, the keyboard and touch proofs, axe open
|
||||
// (edit, read-only at 375 px), Back and Forward over the layers. The spec seeds its own
|
||||
// sheet and never touches another.
|
||||
|
||||
const dict = fr
|
||||
|
||||
@@ -84,9 +90,12 @@ async function open(page: Page, seedShape = shape) {
|
||||
}
|
||||
|
||||
const panel = (page: Page) => page.getByTestId('editor-citations-panel')
|
||||
/** The sheet's own dialog (the finding dialog under it is the other one). */
|
||||
const sheet = (page: Page) =>
|
||||
page.locator('dialog[open]').filter({ has: panel(page) })
|
||||
const heads = (page: Page) =>
|
||||
panel(page).locator('button[aria-controls][id$="-header"]')
|
||||
const trigger = (page: Page) => page.locator('[data-citations-trigger]:visible')
|
||||
const trigger = (page: Page) => page.locator('[data-citations-trigger]')
|
||||
const link = (page: Page) =>
|
||||
panel(page).getByRole('button', {
|
||||
name: dict['editor.references.panel_show_all'],
|
||||
@@ -103,7 +112,7 @@ const nodeOf = (document: Record<string, unknown>) =>
|
||||
}[]
|
||||
)[0].categories[0].children[0]
|
||||
|
||||
test.describe('citations panel, editing', () => {
|
||||
test.describe('citations sheet, editing', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(
|
||||
@@ -116,7 +125,7 @@ test.describe('citations panel, editing', () => {
|
||||
await dropLateReplays(context)
|
||||
})
|
||||
|
||||
test('opens filtered on its finding, « Retirer » and one « Défaire », saved status', async ({
|
||||
test('opens over its finding dialog, « Retirer » then one « Défaire », saved status', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
@@ -137,7 +146,7 @@ test.describe('citations panel, editing', () => {
|
||||
await expect(heads(page)).toHaveCount(3)
|
||||
await expect(panel(page).getByText('Source libre')).toHaveCount(0)
|
||||
await expect(panel(page).getByRole('searchbox')).toHaveCount(0)
|
||||
await expectAccessible(page, 'the citations panel, closed tiles')
|
||||
await expectAccessible(page, 'the citations sheet, closed tiles')
|
||||
|
||||
await heads(page).nth(1).click()
|
||||
const tile = heads(page).nth(1).locator('xpath=ancestor::li[1]')
|
||||
@@ -151,20 +160,25 @@ test.describe('citations panel, editing', () => {
|
||||
]) {
|
||||
await expect(panel(page).getByRole('button', { name })).toHaveCount(0)
|
||||
}
|
||||
await expectAccessible(page, 'the citations panel, an open tile')
|
||||
await expectAccessible(page, 'the citations sheet, an open tile')
|
||||
|
||||
// « Retirer » then one « Défaire » restores the citation and the status together.
|
||||
// « Retirer » takes the citation out at once; the next tile takes the focus (P20).
|
||||
await retire(tile).click()
|
||||
await expect(heads(page)).toHaveCount(2)
|
||||
// The next tile (« Source C », now second) takes the focus (P20).
|
||||
await expect(heads(page).nth(1)).toBeFocused()
|
||||
await expect(heads(page).nth(1)).toContainText('Source C')
|
||||
// « Défaire » is out of reach under the dialogs: close them, then one undo restores
|
||||
// the citation and the status together.
|
||||
await closeCitations(page, dict)
|
||||
await closeFinding(page, dict)
|
||||
await undo(page).click()
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
await expect(heads(page)).toHaveCount(3)
|
||||
// The tile that came back is closed (its open state went with it): open it again.
|
||||
await heads(page).nth(1).click()
|
||||
await retire(tile).click()
|
||||
await expect(heads(page)).toHaveCount(2)
|
||||
await closeCitations(page, dict)
|
||||
await closeFinding(page, dict)
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
const saved = await serverDocument<Record<string, unknown>>(seed.draftId)
|
||||
expect(nodeOf(saved).reference_ids).toEqual(['ref-a', 'ref-c'])
|
||||
@@ -172,7 +186,7 @@ test.describe('citations panel, editing', () => {
|
||||
expect((saved.references as unknown[]).length).toBe(4)
|
||||
})
|
||||
|
||||
test('a long list scrolls inside the panel: the last tile is reachable from scroll 0, the page never moves', async ({
|
||||
test('a long list scrolls inside the sheet: the last tile is reachable from scroll 0, the page never moves', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -194,7 +208,7 @@ test.describe('citations panel, editing', () => {
|
||||
await expect(last).toHaveAttribute('aria-expanded', 'true')
|
||||
})
|
||||
|
||||
test('the last citations gone: the panel stays with its line, then closes on the tab', async ({
|
||||
test('the last citations gone: the sheet stays with its line, Escape closes it, the dialog stays', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -212,13 +226,12 @@ test.describe('citations panel, editing', () => {
|
||||
await expect(page.locator('#editor-citations-title')).toBeFocused()
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
// The trigger went with the last citation: the active tab takes the focus (P6).
|
||||
await expect(
|
||||
page.getByRole('tab', { name: dict['editor.tab.findings'] }),
|
||||
).toBeFocused()
|
||||
// The trigger went with the last citation: the focus stays in the dialog.
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(findingDialog(page).locator(':focus')).toHaveCount(1)
|
||||
})
|
||||
|
||||
test('« Tout afficher » closes it, resets search and sort, keeps open tiles, focuses the tab heading', async ({
|
||||
test('« Tout afficher » closes both layers, clears the search, keeps the sort and the open tiles; Back returns to the sheet', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -232,21 +245,29 @@ test.describe('citations panel, editing', () => {
|
||||
await root.getByRole('button', { name: /Source B/ }).click()
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
await link(page).click()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expectNoDialog(page)
|
||||
await expect(page.locator('#editor-references-title')).toBeFocused()
|
||||
await expect(root.getByRole('searchbox')).toHaveValue('')
|
||||
await expect(
|
||||
root.getByLabel(dict['editor.references.sort_by']),
|
||||
).toHaveValue('sheet')
|
||||
).toHaveValue('citation')
|
||||
await expect(
|
||||
root.getByRole('button', { name: /Source B/ }),
|
||||
).toHaveAttribute('aria-expanded', 'true')
|
||||
await expect(
|
||||
root.locator('button[aria-controls][id$="-header"]'),
|
||||
).toHaveCount(4)
|
||||
// The move is an entry of its own: Back returns to the finding with its sheet on top.
|
||||
await page.goBack()
|
||||
await expect(place(page, 'citations')).toBeVisible()
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(2)
|
||||
await page.goForward()
|
||||
await expectNoDialog(page)
|
||||
await expect(place(page, 'references')).toBeVisible()
|
||||
})
|
||||
|
||||
test('Escape in a field of a tile neither closes the panel nor commits; ✕ then commits', async ({
|
||||
test('Escape in a field of a tile neither closes the sheet nor commits; ✕ then commits', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -261,12 +282,13 @@ test.describe('citations panel, editing', () => {
|
||||
await field.press('Escape')
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await expect(field).toHaveValue('Référence A, révisée')
|
||||
await expect(undo(page)).toBeDisabled()
|
||||
// A user close applies a valid draft first (P22''), then the panel exits.
|
||||
// A user close applies a valid draft first (P22''), then the sheet exits.
|
||||
await panel(page)
|
||||
.getByRole('button', { name: dict['editor.references.close'] })
|
||||
.click()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await closeFinding(page, dict)
|
||||
await expect(undo(page)).toBeEnabled()
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
const saved = await serverDocument<{ references: { citation: string }[] }>(
|
||||
seed.draftId,
|
||||
@@ -274,7 +296,7 @@ test.describe('citations panel, editing', () => {
|
||||
expect(saved.references[0].citation).toBe('Référence A, révisée')
|
||||
})
|
||||
|
||||
test('a refused draft cancels the close: panel open, field focused, message shown', async ({
|
||||
test('a refused draft cancels every move that unmounts the sheet: ✕, scrim, Back, « Tout afficher »', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -286,67 +308,91 @@ test.describe('citations panel, editing', () => {
|
||||
.click()
|
||||
const field = panel(page).getByLabel(dict['editor.reference.citation'])
|
||||
await field.fill('')
|
||||
await page
|
||||
.getByRole('tab', {
|
||||
name: new RegExp(`^${dict['editor.tab.verification']}`),
|
||||
})
|
||||
await panel(page)
|
||||
.getByRole('button', { name: dict['editor.references.close'] })
|
||||
.click()
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await expect(field).toBeFocused()
|
||||
await expect(panel(page).getByRole('alert')).toBeVisible()
|
||||
await page
|
||||
.getByTestId('references-scrim')
|
||||
.click({ position: { x: 4, y: 40 } })
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await link(page).click()
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await expect(page.getByRole('tab', { selected: true })).toHaveText(
|
||||
new RegExp(`^${dict['editor.tab.findings']}`),
|
||||
)
|
||||
// Back: the page stays, the view is pushed again, the refusal shows.
|
||||
await page.goBack()
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(panel(page).getByRole('alert')).toBeVisible()
|
||||
})
|
||||
|
||||
test('the page and the panel are inert through the exit (sampled in the page)', async ({
|
||||
test('the exiting sheet is inert, and a second close finds nothing to close', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
await page.evaluate(() => {
|
||||
const samples: { panel: boolean; page: boolean; inert: boolean }[] = []
|
||||
const samples: boolean[] = []
|
||||
Object.assign(window, { samples })
|
||||
const tick = () => {
|
||||
const layer = document.querySelector('[data-place="citations"]')
|
||||
const body = document.querySelector('[data-place="findings"]')
|
||||
samples.push({
|
||||
panel: layer !== null,
|
||||
page: body?.closest('[inert]') !== null,
|
||||
inert: layer?.hasAttribute('inert') ?? false,
|
||||
})
|
||||
if (layer !== null) requestAnimationFrame(tick)
|
||||
if (layer === null) return
|
||||
samples.push(layer.closest('dialog')?.hasAttribute('inert') ?? false)
|
||||
requestAnimationFrame(tick)
|
||||
}
|
||||
tick()
|
||||
})
|
||||
await panel(page)
|
||||
.getByRole('button', { name: dict['editor.references.close'] })
|
||||
.click()
|
||||
const closeButton = panel(page).getByRole('button', {
|
||||
name: dict['editor.references.close'],
|
||||
})
|
||||
await closeButton.dispatchEvent('click')
|
||||
await closeButton.dispatchEvent('click').catch(() => undefined)
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
const samples = await page.evaluate(
|
||||
() =>
|
||||
(
|
||||
window as unknown as {
|
||||
samples: { panel: boolean; page: boolean; inert: boolean }[]
|
||||
}
|
||||
).samples,
|
||||
() => (window as unknown as { samples: boolean[] }).samples,
|
||||
)
|
||||
const leaving = samples.filter((sample) => sample.panel && sample.inert)
|
||||
expect(leaving.length).toBeGreaterThan(0)
|
||||
expect(leaving.every((sample) => sample.page)).toBe(true)
|
||||
await expect(page.locator('[data-place="findings"]')).toBeVisible()
|
||||
expect(
|
||||
await page
|
||||
.locator('[data-place="findings"]')
|
||||
.evaluate((body) => body.closest('[inert]') === null),
|
||||
).toBe(true)
|
||||
expect(samples.some((inert) => inert)).toBe(true)
|
||||
// The dialog under the sheet is still open: the second click closed nothing more.
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(1)
|
||||
})
|
||||
|
||||
test('keyboard: Tab stays in the sheet, Escape closes only it, the trigger holds the focus', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
const controls = await panel(page)
|
||||
.locator('button, [href], input, select, textarea')
|
||||
.count()
|
||||
for (let step = 0; step < controls + 2; step++) {
|
||||
await page.keyboard.press('Tab')
|
||||
const where = await page.evaluate(() => {
|
||||
const active = document.activeElement
|
||||
if (!active || active === document.body) return 'outside'
|
||||
return active.closest('[data-place="citations"]') ? 'sheet' : 'page'
|
||||
})
|
||||
// Past the last control the focus leaves for the browser's own interface
|
||||
// (body): it never reaches the dialog under the sheet or the page.
|
||||
expect(where, `Tab ${step + 1}`).not.toBe('page')
|
||||
}
|
||||
await sheet(page).evaluate((node) => (node as HTMLElement).focus())
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
})
|
||||
})
|
||||
|
||||
/** Every way out of the panel, the focus read from the document after the exit. */
|
||||
/** Every way out of the sheet, the focus read from the document after the exit. */
|
||||
for (const reduced of [false, true]) {
|
||||
test.describe(`citations panel closes, ${reduced ? 'reduced motion' : 'motion'}`, () => {
|
||||
test.describe(`citations sheet closes, ${reduced ? 'reduced motion' : 'motion'}`, () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context, page }, info) => {
|
||||
test.skip(isPhone(info), 'the paths are walked on desktop') // floor-guard: allow C16 editing needs >= 1 024 px
|
||||
@@ -359,7 +405,7 @@ for (const reduced of [false, true]) {
|
||||
await dropLateReplays(context)
|
||||
})
|
||||
|
||||
test('✕, Escape and the scrim give the focus back to the trigger', async ({
|
||||
test('✕, Escape, the scrim and Back give the focus back to the trigger', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
@@ -368,28 +414,34 @@ for (const reduced of [false, true]) {
|
||||
await closeCitations(page, dict)
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await expect(trigger(page)).toHaveAttribute('aria-expanded', 'false')
|
||||
await trigger(page).click()
|
||||
await expect(page.locator('#editor-citations-title')).toBeFocused()
|
||||
await showCitations(page)
|
||||
await page.keyboard.press('Escape')
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await trigger(page).click()
|
||||
await expect(page.locator('#editor-citations-title')).toBeFocused()
|
||||
await showCitations(page)
|
||||
await page
|
||||
.getByTestId('references-scrim')
|
||||
.click({ position: { x: 12, y: 40 } })
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await showCitations(page)
|
||||
await page.goBack()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await page.goForward()
|
||||
await expect(panel(page)).toBeVisible()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(2)
|
||||
})
|
||||
|
||||
test('« Tout afficher », « Aller à » and a tab choice land where the pending move says', async ({
|
||||
test('« Tout afficher » and « Aller à » land where the pending move says', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
await link(page).click()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expectNoDialog(page)
|
||||
await expect(page.locator('#editor-references-title')).toBeFocused()
|
||||
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
@@ -398,35 +450,23 @@ for (const reduced of [false, true]) {
|
||||
.getByRole('button', { name: dict['editor.references.go_to'] })
|
||||
.first()
|
||||
.click()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expectNoDialog(page)
|
||||
await expect(
|
||||
page.getByRole('treeitem', { name: /Dysfonction A/ }),
|
||||
).toBeFocused()
|
||||
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
const verification = page.getByRole('tab', {
|
||||
name: new RegExp(`^${dict['editor.tab.verification']}`),
|
||||
})
|
||||
await verification.click()
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(verification).toBeFocused()
|
||||
})
|
||||
|
||||
test('the panel slides only when motion is allowed', async ({ page }) => {
|
||||
test('the sheet slides only when motion is allowed', async ({ page }) => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await page.getByRole('tab', { name: dict['editor.tab.findings'] }).click()
|
||||
await page
|
||||
.getByRole('treeitem', { expanded: false })
|
||||
.first()
|
||||
.press('ArrowRight')
|
||||
await page.getByRole('treeitem', { name: 'Constat A' }).click()
|
||||
await openFinding(page, dict, 'Constat A')
|
||||
await page.evaluate(() => {
|
||||
const seen: string[] = []
|
||||
Object.assign(window, { seen })
|
||||
new MutationObserver(() => {
|
||||
const layer = document.querySelector('[data-place="citations"]')
|
||||
const slider = layer?.firstElementChild as HTMLElement | null
|
||||
const slider = document.querySelector(
|
||||
'[data-place="citations"]',
|
||||
) as HTMLElement | null
|
||||
if (slider) seen.push(slider.style.transform)
|
||||
}).observe(document.body, {
|
||||
subtree: true,
|
||||
@@ -436,7 +476,8 @@ for (const reduced of [false, true]) {
|
||||
})
|
||||
})
|
||||
await trigger(page).click()
|
||||
await expect(page.locator('#editor-citations-title')).toBeFocused()
|
||||
await expect(place(page, 'citations')).toBeVisible()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(2)
|
||||
const seen = await page.evaluate(
|
||||
() => (window as unknown as { seen: string[] }).seen,
|
||||
)
|
||||
@@ -446,7 +487,7 @@ for (const reduced of [false, true]) {
|
||||
})
|
||||
}
|
||||
|
||||
test.describe('citations panel, read-only at 375 px', () => {
|
||||
test.describe('citations sheet, read-only at 375 px', () => {
|
||||
test.use({ locale: 'fr-FR', actionTimeout: 15_000 })
|
||||
test.beforeEach(async ({ context }, info) => {
|
||||
test.skip(!isPhone(info), 'the read-only twin runs at 375 px only')
|
||||
@@ -462,14 +503,13 @@ test.describe('citations panel, read-only at 375 px', () => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await openCitations(page, dict, 'Constat A')
|
||||
// Full width: the whole content area (the page's side gutters stay).
|
||||
// Full width: the sheet is min(34 rem, 100 vw), so the whole phone screen.
|
||||
const layer = page.locator('[data-place="citations"]')
|
||||
const box = await layer.boundingBox()
|
||||
const area = await layer.locator('xpath=..').boundingBox()
|
||||
expect(box?.width ?? 0).toBeLessThanOrEqual(375)
|
||||
expect(Math.abs((box?.width ?? 0) - (area?.width ?? 0))).toBeLessThan(1)
|
||||
expect(Math.abs((box?.width ?? 0) - 375)).toBeLessThan(1)
|
||||
await expect(heads(page)).toHaveCount(3)
|
||||
await expectNoHorizontalOverflow(page, 'the panel at 375 px')
|
||||
await expectNoHorizontalOverflow(page, 'the sheet at 375 px')
|
||||
await heads(page).first().click()
|
||||
for (const name of [
|
||||
dict['editor.references.edit'],
|
||||
@@ -483,9 +523,51 @@ test.describe('citations panel, read-only at 375 px', () => {
|
||||
.boundingBox()
|
||||
expect(close?.width ?? 0).toBeGreaterThanOrEqual(44)
|
||||
expect(close?.height ?? 0).toBeGreaterThanOrEqual(44)
|
||||
await expectAccessible(page, 'the citations panel, read-only at 375 px')
|
||||
await expectAccessible(page, 'the citations sheet, read-only at 375 px')
|
||||
await closeCitations(page, dict)
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await closeFinding(page, dict)
|
||||
await expect(place(page, 'findings')).toBeVisible()
|
||||
})
|
||||
|
||||
test('by touch: taps act on the sheet only, the dialog under it is never activated @phone', async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(150_000)
|
||||
await open(page)
|
||||
await openFinding(page, dict, 'Constat A')
|
||||
const center = async (target: Locator) => {
|
||||
const box = await target.boundingBox()
|
||||
return { x: box!.x + box!.width / 2, y: box!.y + box!.height / 2 }
|
||||
}
|
||||
const tap = async (target: Locator) => {
|
||||
const at = await center(target)
|
||||
await page.touchscreen.tap(at.x, at.y)
|
||||
}
|
||||
await tap(trigger(page))
|
||||
await expect(place(page, 'citations')).toBeVisible()
|
||||
// A tile opens by a tap; the dialog's own controls underneath stay as they were.
|
||||
await tap(heads(page).first())
|
||||
await expect(heads(page).first()).toHaveAttribute('aria-expanded', 'true')
|
||||
await expect(trigger(page)).toHaveAttribute('aria-expanded', 'true')
|
||||
// A tap where the dialog's close button lies (it is under the sheet) hits the sheet.
|
||||
const under = await center(
|
||||
findingDialog(page).getByRole('button', { name: dict['common.close'] }),
|
||||
)
|
||||
await page.touchscreen.tap(under.x, under.y)
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
// The sheet's ✕ closes the sheet only; the trigger holds the focus.
|
||||
await tap(
|
||||
panel(page).getByRole('button', {
|
||||
name: dict['editor.references.close'],
|
||||
}),
|
||||
)
|
||||
await expect(panel(page)).toHaveCount(0)
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
await expect(trigger(page)).toBeFocused()
|
||||
await tap(
|
||||
findingDialog(page).getByRole('button', { name: dict['common.close'] }),
|
||||
)
|
||||
await expectNoDialog(page)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user