Files
faunosteo/apps/app/e2e/support/warm-up.ts
T
bchanot 4731a3376a 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).
2026-11-13 19:03:21 +01:00

58 lines
1.9 KiB
TypeScript

/**
* Global setup of the shell suite (V1-2.6): the Vite dev server discovers some
* dependencies only when a route first loads them and answers with a full page
* reload, which wiped a form a test had begun to fill. One throwaway session
* visits the editor routes, every tab, every Annotations section and the citations panel once before the tests start, so the
* reload happens here and not in a test.
*/
import { chromium, type FullConfig } from '@playwright/test'
import { fr } from '@/i18n/fr'
import { stepUpAdmin } from './admin'
import {
TABS,
closeCitations,
closeFinding,
draftPath,
editorActor,
openCitations,
openSection,
secondSession,
seedDraft,
SECTIONS,
standardShape,
} from './editor'
import { signIn } from './shell'
export default async function warmUp(config: FullConfig): Promise<void> {
const baseURL = config.projects[0].use.baseURL ?? ''
const actor = await editorActor('fr')
const seed = await seedDraft(actor, { shape: standardShape })
const browser = await chromium.launch()
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)
for (const path of ['/app/admin/sheets/new', draftPath(seed.sheetId)]) {
await page.goto(path)
await page.waitForLoadState('networkidle')
}
for (const tab of TABS) {
await page
.getByRole('tab', {
name: new RegExp(`^${fr[`editor.tab.${tab}`]}( |$)`),
})
.click()
await page.waitForLoadState('networkidle')
}
for (const section of SECTIONS) {
await openSection(page, fr, section)
await page.waitForLoadState('networkidle')
}
await openCitations(page, fr, 'Constat A')
await closeCitations(page, fr)
await closeFinding(page, fr)
await page.goto('/app/admin/sheets/new')
await page.waitForLoadState('networkidle')
await browser.close()
}