admin.spec opened the working-copy dialog on the historical sheet, whose single slot was taken by a copy the sandbox suite leaked. The dialog checks move to an e2e:ui page on the real component; the suite archives its own copies.
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
/**
|
|
* Test page for the real « Créer une copie de travail » action in a real
|
|
* browser (e2e/ui/working-copy.spec.ts). Served by the Vite dev server only
|
|
* (`/e2e/harness/working-copy.html`); the build has a single entry, index.html,
|
|
* so this page never ships. The action is the application's own component,
|
|
* rendered with the slot free and with the slot taken (the two states the
|
|
* historical sheet page shows); no request is made unless the form is
|
|
* submitted, which the spec never does. `?lang=en` picks the language.
|
|
*/
|
|
import { StrictMode } from 'react'
|
|
import { createRoot } from 'react-dom/client'
|
|
import { MemoryRouter } from 'react-router-dom'
|
|
import '@/styles/index.css'
|
|
import WorkingCopyAction from '@/components/admin/WorkingCopyAction'
|
|
import { useLocaleStore } from '@/state/localeStore'
|
|
import type { Locale } from '@/i18n/types'
|
|
|
|
const lang: Locale =
|
|
new URLSearchParams(location.search).get('lang') === 'en' ? 'en' : 'fr'
|
|
useLocaleStore.setState({ locale: lang })
|
|
document.documentElement.lang = lang
|
|
|
|
const SLUG = 'faunosteo-cheval'
|
|
const SOURCE_VERSION_ID = '00000000-0000-4000-8000-000000000001'
|
|
|
|
function Harness() {
|
|
return (
|
|
<main className="mx-auto max-w-2xl space-y-6 p-4">
|
|
<h1 className="text-xl font-semibold">Working copy harness</h1>
|
|
<section aria-labelledby="slot-free" className="space-y-2">
|
|
<h2 id="slot-free" className="text-lg font-semibold">
|
|
Slot free
|
|
</h2>
|
|
<WorkingCopyAction
|
|
slug={SLUG}
|
|
sourceVersionId={SOURCE_VERSION_ID}
|
|
copyActive={false}
|
|
/>
|
|
</section>
|
|
<section aria-labelledby="slot-taken" className="space-y-2">
|
|
<h2 id="slot-taken" className="text-lg font-semibold">
|
|
Slot taken
|
|
</h2>
|
|
<WorkingCopyAction
|
|
slug={SLUG}
|
|
sourceVersionId={SOURCE_VERSION_ID}
|
|
copyActive={true}
|
|
/>
|
|
</section>
|
|
</main>
|
|
)
|
|
}
|
|
|
|
createRoot(document.getElementById('root') as HTMLElement).render(
|
|
<StrictMode>
|
|
<MemoryRouter>
|
|
<Harness />
|
|
</MemoryRouter>
|
|
</StrictMode>,
|
|
)
|