feat(editor): « Aller à » opens the finding dialog, spec races fixed
« Aller à » a finding shows its row and opens its dialog in view mode. E2e helpers wait for the history to settle after a layer or section pop; the layout walk waits out the write budget. Label rows for the nine new keys.
This commit is contained in:
1 parent
4731a3376a
commit
c893dec60b
10 files changed
+89
-3
No files matched your search
@@ -362,6 +362,12 @@ export function place(page: Page, name: string): Locator {
|
||||
export async function backToDrawing(page: Page, dict: Dict) {
|
||||
await page.getByRole('button', { name: dict['editor.section.back'] }).click()
|
||||
await expect(place(page, 'annotations.drawing')).toBeVisible()
|
||||
// The move pops its section entry from an effect: a click made before the pop lands
|
||||
// would be undone by it (a user cannot be that quick, a script can).
|
||||
await page.waitForFunction(() => {
|
||||
const view = history.state?.usr?.editorEntry?.view
|
||||
return !view || view.section === 'drawing'
|
||||
})
|
||||
}
|
||||
|
||||
/** The Annotations tab on its drawing, whatever section it was left on. */
|
||||
@@ -466,12 +472,27 @@ export async function openFinding(
|
||||
await expect(findingDialog(page)).toBeVisible()
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the history to settle on a view without the finding layer (or without its
|
||||
* sheet): a close pops its entry from an effect, and a move made before the pop lands
|
||||
* would be undone by it (a user cannot be that quick, a script can).
|
||||
*/
|
||||
export async function layersSettled(page: Page, keepDialog = false) {
|
||||
await page.waitForFunction((dialogStays) => {
|
||||
const view = history.state?.usr?.editorEntry?.view
|
||||
if (!view) return true
|
||||
if (dialogStays) return !view.finding?.citations
|
||||
return view.finding === null
|
||||
}, keepDialog)
|
||||
}
|
||||
|
||||
/** Closes the finding dialog with its ✕ and waits until no dialog is left. */
|
||||
export async function closeFinding(page: Page, dict: Dict) {
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['common.close'], exact: true })
|
||||
.click()
|
||||
await expectNoDialog(page)
|
||||
await layersSettled(page)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -502,6 +523,7 @@ export async function closeCitations(page: Page, dict: Dict) {
|
||||
.click()
|
||||
await expect(place(page, 'citations')).toHaveCount(0)
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(1)
|
||||
await layersSettled(page, true)
|
||||
}
|
||||
|
||||
/** The revision the server holds for the draft. */
|
||||
|
||||
Reference in new issue
Block a user