test(editor): lot K review fixes, filled-document save proof
This commit is contained in:
1 parent
bb99edd2dd
commit
4cc27a8231
10 files changed
+132
-32
No files matched your search
@@ -3,6 +3,7 @@ import type { Locator, Page, TestInfo } from '@playwright/test'
|
||||
import { expect, expectAccessible, test } from '../support/browser'
|
||||
import { dropLateReplays, routeToSandbox } from '../support/sandbox'
|
||||
import {
|
||||
bareShape,
|
||||
editorActor,
|
||||
openEditor,
|
||||
pointOf,
|
||||
@@ -10,6 +11,7 @@ import {
|
||||
seedDraft,
|
||||
selectTab,
|
||||
serverDocument,
|
||||
serverRevision,
|
||||
shapeWith,
|
||||
} from '../support/editor'
|
||||
|
||||
@@ -21,6 +23,8 @@ const dict = fr
|
||||
|
||||
const isPhone = (info: TestInfo) => info.project.name === 'chromium-375'
|
||||
const dialog = (page: Page) => page.getByRole('dialog')
|
||||
const button = (page: Page, name: string) =>
|
||||
page.getByRole('button', { name, exact: true })
|
||||
|
||||
async function open(page: Page, ...annotations: unknown[]) {
|
||||
const actor = await editorActor('fr')
|
||||
@@ -198,6 +202,37 @@ test.describe('editor structures (A4)', () => {
|
||||
])
|
||||
})
|
||||
|
||||
test('a draft stored with bare nodes loads filled: rename, save, reload clean', async ({
|
||||
page,
|
||||
requests,
|
||||
}) => {
|
||||
const actor = await editorActor('fr')
|
||||
requests.forbid(actor.account.email, actor.account.password)
|
||||
const seed = await seedDraft(actor, { shape: bareShape })
|
||||
await openEditor(page, dict, actor, seed.sheetId)
|
||||
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 saveDraft(page, dict, seed.revision + 1)
|
||||
|
||||
const saved = await serverDocument<{
|
||||
finding_zones: { categories: { reference_ids: string[] }[] }[]
|
||||
}>(seed.draftId)
|
||||
expect(saved.finding_zones[0].categories[0].reference_ids).toEqual([])
|
||||
expect(await serverRevision(seed.draftId)).toBe(seed.revision + 1)
|
||||
|
||||
await page.reload()
|
||||
await selectTab(page, dict, 'findings')
|
||||
await expect(items.filter({ hasText: 'Catégorie renommée' })).toBeVisible()
|
||||
await expect(
|
||||
page.getByText(dict['editor.draft.status.unsaved'], { exact: false }),
|
||||
).toHaveCount(0)
|
||||
await expect(
|
||||
button(page, dict['editor.draft.recovery.restore']),
|
||||
).toHaveCount(0)
|
||||
})
|
||||
|
||||
test('delete with dependents: refused with the list; without, descendants named', async ({
|
||||
page,
|
||||
requests,
|
||||
|
||||
Reference in new issue
Block a user