test(tests): working-copy dialog checks independent of the shared slot

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.
This commit is contained in:
bchanot committed 2026-11-12 17:06:42 +01:00
1 parent da298cfab1
commit 2cdee42fe1
9 files changed
+304 -25

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Working copy harness</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./working-copy.tsx"></script>
</body>
</html>
+60
View File
@@ -0,0 +1,60 @@
/**
* 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>,
)