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
@@ -227,9 +227,8 @@ export async function seedDraft(
|
||||
}
|
||||
|
||||
/**
|
||||
* The categories, zone and detail view most editor specs start from. Every defaulted
|
||||
* field is written out, as the core writes a document: the page reads the stored text
|
||||
* as it is (an omitted `reference_ids` breaks the findings tree, see the report).
|
||||
* The categories, zone and detail view most editor specs start from, written in full.
|
||||
* `bareShape` below omits the defaulted fields (the loader fills them from the core).
|
||||
*/
|
||||
export function standardShape(document: Record<string, unknown>) {
|
||||
document.categories = [
|
||||
@@ -272,6 +271,25 @@ export function standardShape(document: Record<string, unknown>) {
|
||||
})
|
||||
}
|
||||
|
||||
/** Like `standardShape`, but nodes and categories omit what the core defaults. */
|
||||
export function bareShape(document: Record<string, unknown>) {
|
||||
standardShape(document)
|
||||
document.finding_zones = [
|
||||
{
|
||||
id: 'zone-bare',
|
||||
name: text('Zone nue'),
|
||||
categories: [
|
||||
{
|
||||
id: 'fcat-bare',
|
||||
kind: 'dysfunction',
|
||||
name: text('Catégorie nue'),
|
||||
children: [{ id: 'node-bare', name: text('Constat nu') }],
|
||||
},
|
||||
],
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
export const draftPath = (sheetId: string) =>
|
||||
`/app/admin/sheets/${sheetId}/draft`
|
||||
|
||||
|
||||
@@ -8,8 +8,13 @@
|
||||
import { chromium, type FullConfig } from '@playwright/test'
|
||||
import { fr } from '@/i18n/fr'
|
||||
import { stepUpAdmin } from './admin'
|
||||
import { draftPath, editorActor, seedDraft, standardShape } from './editor'
|
||||
import { routeToSandbox } from './sandbox'
|
||||
import {
|
||||
draftPath,
|
||||
editorActor,
|
||||
secondSession,
|
||||
seedDraft,
|
||||
standardShape,
|
||||
} from './editor'
|
||||
import { signIn } from './shell'
|
||||
|
||||
const TABS = [
|
||||
@@ -27,9 +32,7 @@ export default async function warmUp(config: FullConfig): Promise<void> {
|
||||
const actor = await editorActor('fr')
|
||||
const seed = await seedDraft(actor, { shape: standardShape })
|
||||
const browser = await chromium.launch()
|
||||
const context = await browser.newContext({ baseURL, locale: 'fr-FR' })
|
||||
await routeToSandbox(context)
|
||||
const page = await context.newPage()
|
||||
const { page } = await secondSession(browser, baseURL, 'fr-FR')
|
||||
await signIn(page, actor.account, fr)
|
||||
await page.goto('/app/admin')
|
||||
await stepUpAdmin(page, fr, actor.secret)
|
||||
|
||||
Reference in new issue
Block a user