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
@@ -4,7 +4,10 @@ import { expect, expectAccessible, test } from '../support/browser'
|
||||
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
||||
import {
|
||||
bareShape,
|
||||
closeFinding,
|
||||
editorActor,
|
||||
expectNoDialog,
|
||||
findingDialog,
|
||||
libraryRoot,
|
||||
openEditor,
|
||||
openTab,
|
||||
@@ -30,6 +33,8 @@ const dict = fr
|
||||
|
||||
const isPhone = (info: TestInfo) => info.project.name === 'chromium-375'
|
||||
const dialog = (page: Page) => page.getByRole('dialog')
|
||||
/** The deletion dialog over the finding dialog: the last dialog open. */
|
||||
const deleteDialog = (page: Page) => page.locator('dialog[open]').last()
|
||||
const button = (page: Page, name: string) =>
|
||||
page.getByRole('button', { name, exact: true })
|
||||
|
||||
@@ -176,6 +181,8 @@ test.describe('editor structures (A4)', () => {
|
||||
await page
|
||||
.getByRole('button', { name: dict['editor.findings.create'] })
|
||||
.click()
|
||||
// « Créer » turns the dialog into the new zone's view: close it.
|
||||
await closeFinding(page, dict)
|
||||
await expect(items.filter({ hasText: 'Zone B' })).toBeVisible()
|
||||
|
||||
await page
|
||||
@@ -188,6 +195,7 @@ test.describe('editor structures (A4)', () => {
|
||||
await page
|
||||
.getByRole('button', { name: dict['editor.findings.create'] })
|
||||
.click()
|
||||
await closeFinding(page, dict)
|
||||
const category = items.filter({ hasText: 'Anamnèse B' })
|
||||
await expect(category).toBeVisible()
|
||||
await expect(
|
||||
@@ -203,12 +211,12 @@ test.describe('editor structures (A4)', () => {
|
||||
.getByRole('button', { name: dict['editor.findings.create'] })
|
||||
.click()
|
||||
const node = items.filter({ hasText: 'Constat B1' })
|
||||
await expect(node).toBeVisible()
|
||||
|
||||
// Marked reviewed: the badge of the row follows.
|
||||
await page
|
||||
// The dialog shows the new node: marked reviewed there, the badge of the row follows.
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.findings.mark_reviewed'] })
|
||||
.click()
|
||||
await closeFinding(page, dict)
|
||||
await expect(node).toBeVisible()
|
||||
await expect(
|
||||
node.getByText(dict['editor.findings.status.reviewed']),
|
||||
).toBeVisible()
|
||||
@@ -217,11 +225,12 @@ test.describe('editor structures (A4)', () => {
|
||||
await page.evaluate(() => window.scrollTo(0, 0))
|
||||
await expectAccessible(page, 'the findings tree')
|
||||
|
||||
// Reorder: the new zone moves above the seeded one.
|
||||
// Reorder: the new zone moves above the seeded one, from its dialog.
|
||||
await items.filter({ hasText: 'Zone B' }).first().click()
|
||||
await page
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.action.move_up'] })
|
||||
.click()
|
||||
await closeFinding(page, dict)
|
||||
await expect(items.first()).toContainText('Zone B')
|
||||
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
@@ -245,7 +254,14 @@ test.describe('editor structures (A4)', () => {
|
||||
await selectTab(page, dict, 'findings')
|
||||
const items = page.getByTestId('finding-item')
|
||||
await items.filter({ hasText: 'Catégorie nue' }).click()
|
||||
await commitText(page.locator('#finding-name-fr'), 'Catégorie renommée')
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.findings.edit'] })
|
||||
.click()
|
||||
await page.locator('#finding-edit-name-fr').fill('Catégorie renommée')
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.findings.save'] })
|
||||
.click()
|
||||
await closeFinding(page, dict)
|
||||
await saveDraft(page, dict, seed.revision + 1)
|
||||
|
||||
const saved = await serverDocument<{
|
||||
@@ -300,18 +316,19 @@ test.describe('editor structures (A4)', () => {
|
||||
await selectTab(page, dict, 'findings')
|
||||
const zone = page.getByTestId('finding-item').filter({ hasText: 'Zone A' })
|
||||
await zone.first().click()
|
||||
await page
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.action.delete'] })
|
||||
.click()
|
||||
await expect(
|
||||
dialog(page).getByText(
|
||||
deleteDialog(page).getByText(
|
||||
dict['editor.delete.blocked'].replace('{name}', 'Zone A'),
|
||||
),
|
||||
).toBeVisible()
|
||||
await dialog(page)
|
||||
await deleteDialog(page)
|
||||
.getByRole('button', { name: dict['editor.delete.close'], exact: true })
|
||||
.last()
|
||||
.click()
|
||||
await expect(page.locator('dialog[open]')).toHaveCount(1)
|
||||
await closeFinding(page, dict)
|
||||
|
||||
// The point goes first; the zone then deletes with its descendants named.
|
||||
await showDrawing(page, dict)
|
||||
@@ -325,16 +342,18 @@ test.describe('editor structures (A4)', () => {
|
||||
.click()
|
||||
await selectTab(page, dict, 'findings')
|
||||
await zone.first().click()
|
||||
await page
|
||||
await findingDialog(page)
|
||||
.getByRole('button', { name: dict['editor.action.delete'] })
|
||||
.click()
|
||||
await expect(
|
||||
dialog(page).getByText(dict['editor.delete.descendants']),
|
||||
deleteDialog(page).getByText(dict['editor.delete.descendants']),
|
||||
).toBeVisible()
|
||||
await expect(dialog(page).getByText('Dysfonction A')).toBeVisible()
|
||||
await dialog(page)
|
||||
await expect(deleteDialog(page).getByText('Dysfonction A')).toBeVisible()
|
||||
await deleteDialog(page)
|
||||
.getByRole('button', { name: dict['editor.delete.confirm'] })
|
||||
.click()
|
||||
// The deletion closes both dialogs at once.
|
||||
await expectNoDialog(page)
|
||||
await expect(page.getByTestId('finding-item')).toHaveCount(0)
|
||||
await expect(page.getByText(dict['editor.findings.empty'])).toBeVisible()
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user