/** * 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 references 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, closeReferences, draftPath, editorActor, openReferences, openSection, secondSession, seedDraft, SECTIONS, standardShape, } from './editor' import { signIn } from './shell' export default async function warmUp(config: FullConfig): Promise { 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 openReferences(page, fr) await closeReferences(page, fr) await page.goto('/app/admin/sheets/new') await page.waitForLoadState('networkidle') await browser.close() }