Compare commits

..

4 Commits

Author SHA1 Message Date
e1d9738f23 Merge pull request 'sprint/2-simulations' (#5) from sprint/2-simulations into main
Reviewed-on: #5
2026-05-26 17:06:31 +00:00
Knacky
ddf48dd1d1 docs(changelog): post-QA fixes summary + e2e suite now fully green
- Document the 4 post-QA fixes (i18n FR→EN, password field alignment,
  execution_result TextArea, unified sticky action bar)
- Update the e2e suite status: 68/68 passing on both docker and podman
  (sprint 1 us1/us6 failures resolved by b3124ba's auto-detect that also
  landed in those specs)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 16:14:37 +02:00
Knacky
da2ce68660 test(e2e): align assertions with i18n fix — French→English labels
- us7: "Nouvelle simulation" → "New simulation" (3 assertions)
- us4: "Nouvelle simulation" → "New simulation" (1 assertion)
- us9: "Simulation pas encore en revue" → "Simulation not yet ready for review" (1 assertion)
- us11: "Marquer en revue" → "Mark for review" (6 assertions), "Clôturer" → /^close$/i (7 assertions)
- us12: "Supprimer" → /^delete$/i (4 assertions), "Supprimer la simulation" → "Delete simulation" (1 assertion)

No other French strings found in e2e/tests/. Suite: 68/68 pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:13:33 +02:00
Knacky
2a7d27bf02 fix(frontend): post-QA sprint 2 — i18n + alignment + textarea + action bar layout
- Translate all remaining French strings to English (toasts, buttons, banner)
- Fix UsersAdminPage create-form grid alignment: items-start + self-end on button wrapper
- Change execution_result from TextInput to TextArea (5 rows, multiline)
- Replace split Save RT / Save SOC footers + workflow div with a single sticky
  action bar (Save Red Team | Save SOC | Mark for review | Close | Delete)
- Update Vitest assertions to use English button labels

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 16:08:46 +02:00
10 changed files with 111 additions and 109 deletions

View File

@@ -25,10 +25,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
- `ConfirmDialog`: generic modal used by the delete flow.
- TanStack Query hooks: `useEngagementSimulations`, `useSimulation`, `useCreateSimulation`, `useUpdateSimulation`, `useDeleteSimulation`, `useTransitionSimulation`, `useMitreSearch`. Mutations invalidate both the simulation detail key and the engagement-scoped list key.
**Acceptance tests** (Playwright, 68 specs)
**Acceptance tests** (Playwright, **68/68 passing**)
- 6 new spec files (one per user story US-7 → US-12), 32 tests, all green.
- `us4-engagements.spec.ts` AC-4.9 assertion refreshed: the Sprint 1 placeholder text was correctly replaced by the new `SimulationList` (the test now asserts the new heading + "Nouvelle simulation" link).
- 5 pre-existing failures in `us1-bootstrap-admin.spec.ts` and `us6-deployment.spec.ts` remain — they hard-code `docker` in the test body and fail in dev environments that only have `podman`. The fixtures already support `MIMIC_CONTAINER_CMD`; the test bodies don't yet. Out of scope for Sprint 2 — to be picked up later.
- `us4-engagements.spec.ts` AC-4.9 assertion refreshed: the Sprint 1 placeholder text was correctly replaced by the new `SimulationList` (the test now asserts the new heading + "New simulation" link).
- Sprint 1 docker-hardcoded tests (`us1`, `us6`) now resolve thanks to the podman auto-detect added to those specs in the same sprint — full suite is green on both docker and podman hosts.
- E2e assertions translated to match the i18n cleanup (French → English) shipped in the post-QA fix.
**Post-QA fixes (2026-05-26)**
- All French labels in the frontend translated to English (convention: anglais partout). Affected: `SimulationList`, `SimulationFormPage`, `ConfirmDialog` strings.
- `UsersAdminPage` "Create account" form: grid alignment fixed — the password field's `hint="≥ 8 characters"` was pushing labels out of alignment with `items-end`. Now uses `items-start` + `self-end` button wrapper so labels sit at the same baseline and the Create button stays bottom-aligned.
- `SimulationFormPage` "Execution result" field: switched from single-line `TextInput` to multiline `TextArea` (5 rows).
- `SimulationFormPage` actions reorganised: single sticky action bar at the bottom of the page replaces the previous split between RT-card footer, SOC-card footer, and workflow div. Layout: Save Red Team · Save SOC · | · Mark for review · Close · (right-aligned) Delete.
### Changed
- 2026-05-26 — `make update-mitre` upgraded from no-op placeholder to a real `curl` + optional container restart (Sprint 1 marker resolved).

View File

@@ -167,7 +167,7 @@ test.describe('US-11 — workflow transitions', () => {
}) => {
const rtClient = makeClient(redteamToken);
// pending → "Marquer en revue" visible for redteam; "Clôturer" hidden
// pending → "Mark for review" visible for redteam; "Close" hidden
const simPending = await createSimulation(
redteamToken,
engagementId,
@@ -175,34 +175,34 @@ test.describe('US-11 — workflow transitions', () => {
);
await seedTokenInStorage(context, redteamToken);
await page.goto(`/engagements/${engagementId}/simulations/${simPending.id}/edit`);
await expect(page.getByRole('button', { name: /marquer en revue/i })).toBeVisible();
await expect(page.getByRole('button', { name: /clôturer/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /mark for review/i })).toBeVisible();
await expect(page.getByRole('button', { name: /^close$/i })).toHaveCount(0);
// in_progress → "Marquer en revue" visible
// in_progress → "Mark for review" visible
const simIP = await createSimulation(redteamToken, engagementId, 'AC-11.4 in_progress UI');
await rtClient.patch(`/simulations/${simIP.id}`, { name: 'trigger' });
await page.goto(`/engagements/${engagementId}/simulations/${simIP.id}/edit`);
await expect(page.getByRole('button', { name: /marquer en revue/i })).toBeVisible();
await expect(page.getByRole('button', { name: /clôturer/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /mark for review/i })).toBeVisible();
await expect(page.getByRole('button', { name: /^close$/i })).toHaveCount(0);
// review_required → "Clôturer" visible for redteam; "Marquer en revue" hidden
// review_required → "Close" visible for redteam; "Mark for review" hidden
const simRR = await createSimulation(redteamToken, engagementId, 'AC-11.4 review UI');
await rtClient.post(`/simulations/${simRR.id}/transition`, { to: 'review_required' });
await page.goto(`/engagements/${engagementId}/simulations/${simRR.id}/edit`);
await expect(page.getByRole('button', { name: /clôturer/i })).toBeVisible();
await expect(page.getByRole('button', { name: /marquer en revue/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /^close$/i })).toBeVisible();
await expect(page.getByRole('button', { name: /mark for review/i })).toHaveCount(0);
// review_required → "Clôturer" also visible for SOC
// review_required → "Close" also visible for SOC
await seedTokenInStorage(context, socToken);
await page.goto(`/engagements/${engagementId}/simulations/${simRR.id}/edit`);
await expect(page.getByRole('button', { name: /clôturer/i })).toBeVisible();
await expect(page.getByRole('button', { name: /^close$/i })).toBeVisible();
// done → both buttons hidden
await rtClient.post(`/simulations/${simRR.id}/transition`, { to: 'done' });
await seedTokenInStorage(context, redteamToken);
await page.goto(`/engagements/${engagementId}/simulations/${simRR.id}/edit`);
await expect(page.getByRole('button', { name: /marquer en revue/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /clôturer/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /mark for review/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /^close$/i })).toHaveCount(0);
await deleteSimulation(redteamToken, simPending.id);
await deleteSimulation(redteamToken, simIP.id);
@@ -223,14 +223,14 @@ test.describe('US-11 — workflow transitions', () => {
const badge = page.getByTestId('simulation-status-badge');
await expect(badge).toHaveAttribute('data-status', 'pending');
// Click "Marquer en revue"
await page.getByRole('button', { name: /marquer en revue/i }).click();
// Click "Mark for review"
await page.getByRole('button', { name: /mark for review/i }).click();
// Badge updates to review_required without page reload
await expect(badge).toHaveAttribute('data-status', 'review_required', { timeout: 5_000 });
// "Clôturer" now visible; click it
await page.getByRole('button', { name: /clôturer/i }).click();
// "Close" now visible; click it
await page.getByRole('button', { name: /^close$/i }).click();
await expect(badge).toHaveAttribute('data-status', 'done', { timeout: 5_000 });
// Verify list is also updated: navigate to engagement detail and check badge there

View File

@@ -123,26 +123,26 @@ test.describe('US-12 — simulation delete', () => {
await page.goto(`/engagements/${engagementId}/simulations/${sim.id}/edit`);
// Delete button is visible for redteam
const deleteBtn = page.getByRole('button', { name: /supprimer/i });
const deleteBtn = page.getByRole('button', { name: /^delete$/i });
await expect(deleteBtn).toBeVisible();
// SOC should NOT see delete button
await seedTokenInStorage(context, socToken);
await page.goto(`/engagements/${engagementId}/simulations/${sim.id}/edit`);
await expect(page.getByRole('button', { name: /supprimer/i })).toHaveCount(0);
await expect(page.getByRole('button', { name: /^delete$/i })).toHaveCount(0);
// Back to redteam — click delete, confirm modal appears
await seedTokenInStorage(context, redteamToken);
await page.goto(`/engagements/${engagementId}/simulations/${sim.id}/edit`);
await page.getByRole('button', { name: /supprimer/i }).click();
await page.getByRole('button', { name: /^delete$/i }).click();
// Confirmation dialog must appear
const dialog = page.getByRole('dialog');
await expect(dialog).toBeVisible();
await expect(dialog.getByText(/supprimer la simulation/i)).toBeVisible();
await expect(dialog.getByText(/delete simulation/i)).toBeVisible();
// Confirm deletion
await dialog.getByRole('button', { name: /supprimer/i }).click();
await dialog.getByRole('button', { name: /^delete$/i }).click();
// Should navigate back to engagement detail
await page.waitForURL(new RegExp(`/engagements/${engagementId}$`));

View File

@@ -265,9 +265,9 @@ test.describe('US-4 — engagement CRUD', () => {
await expect(page.getByRole('heading', { name: /AC-4.9 detail target/i })).toBeVisible();
// Sprint 2 replaced the placeholder with the real SimulationList — covered by AC-7.5.
await expect(page.getByRole('heading', { name: /simulations/i })).toBeVisible();
// admin/redteam see the "Nouvelle simulation" button
// admin/redteam see the "New simulation" button
await expect(
page.getByRole('link', { name: /nouvelle simulation/i }),
page.getByRole('link', { name: /new simulation/i }),
).toBeVisible();
});
});

View File

@@ -156,15 +156,15 @@ test.describe('US-7 — simulation create', () => {
// The created simulation row is visible
await expect(page.getByRole('row', { name: /Visible sim/i })).toBeVisible();
// "Nouvelle simulation" button visible for redteam
// "New simulation" button visible for redteam
await expect(
page.getByRole('link', { name: /nouvelle simulation/i }),
page.getByRole('link', { name: /new simulation/i }),
).toBeVisible();
// SOC should NOT see "Nouvelle simulation" button
// SOC should NOT see "New simulation" button
await seedTokenInStorage(context, socToken);
await page.goto(`/engagements/${engagementId}`);
await expect(page.getByRole('link', { name: /nouvelle simulation/i })).toHaveCount(0);
await expect(page.getByRole('link', { name: /new simulation/i })).toHaveCount(0);
await deleteSimulation(redteamToken, sim.id);
});

View File

@@ -178,7 +178,7 @@ test.describe('US-9 — SOC restricted edit', () => {
// Banner must be visible
await expect(page.getByTestId('soc-blocked-banner')).toBeVisible();
await expect(
page.getByText(/simulation pas encore en revue/i),
page.getByText(/simulation not yet ready for review/i),
).toBeVisible();
// SOC fields are disabled

View File

@@ -44,7 +44,7 @@ export function SimulationList({ engagementId }: SimulationListProps): JSX.Eleme
className="btn-primary"
data-testid="new-simulation-btn"
>
Nouvelle simulation
New simulation
</Link>
) : undefined
}
@@ -62,7 +62,7 @@ export function SimulationList({ engagementId }: SimulationListProps): JSX.Eleme
className="btn-primary"
data-testid="new-simulation-btn"
>
Nouvelle simulation
New simulation
</Link>
) : null}
</div>

View File

@@ -137,7 +137,7 @@ export function SimulationFormPage(): JSX.Element {
}
try {
const created = await createMutation.mutateAsync({ name: rt.name.trim() });
push('Simulation créée', 'success');
push('Simulation created', 'success');
navigate(`/engagements/${engagementId}/simulations/${created.id}/edit`);
} catch (err) {
setSubmitError(extractApiError(err, 'Could not create simulation'));
@@ -164,7 +164,7 @@ export function SimulationFormPage(): JSX.Element {
};
try {
await updateMutation.mutateAsync(patch);
push('Simulation mise à jour', 'success');
push('Simulation updated', 'success');
} catch (err) {
setSubmitError(extractApiError(err, 'Could not update simulation'));
}
@@ -181,7 +181,7 @@ export function SimulationFormPage(): JSX.Element {
};
try {
await updateMutation.mutateAsync(patch);
push('Rapport SOC mis à jour', 'success');
push('SOC report updated', 'success');
} catch (err) {
setSubmitError(extractApiError(err, 'Could not update SOC fields'));
}
@@ -190,18 +190,18 @@ export function SimulationFormPage(): JSX.Element {
const onMarkReview = async () => {
try {
await transitionMutation.mutateAsync('review_required');
push('Simulation marquée en revue', 'success');
push('Simulation marked for review', 'success');
} catch (err) {
push(extractApiError(err, 'Transition impossible'), 'error');
push(extractApiError(err, 'Transition failed'), 'error');
}
};
const onClose = async () => {
try {
await transitionMutation.mutateAsync('done');
push('Simulation clôturée', 'success');
push('Simulation closed', 'success');
} catch (err) {
push(extractApiError(err, 'Transition impossible'), 'error');
push(extractApiError(err, 'Transition failed'), 'error');
}
};
@@ -209,10 +209,10 @@ export function SimulationFormPage(): JSX.Element {
setShowDeleteConfirm(false);
try {
await deleteMutation.mutateAsync(simulationId as number);
push('Simulation supprimée', 'success');
push('Simulation deleted', 'success');
navigate(`/engagements/${engagementId}`);
} catch (err) {
push(extractApiError(err, 'Suppression impossible'), 'error');
push(extractApiError(err, 'Could not delete simulation'), 'error');
}
};
@@ -225,7 +225,7 @@ export function SimulationFormPage(): JSX.Element {
<Link to={`/engagements/${engagementId}`} className="btn-text-link text-[14px]">
Back to engagement
</Link>
<h1 className="text-[44px] font-medium leading-none mt-sm">Nouvelle simulation</h1>
<h1 className="text-[44px] font-medium leading-none mt-sm">New simulation</h1>
</header>
<form onSubmit={onSubmitNew} noValidate className="card-product flex flex-col gap-md">
@@ -290,8 +290,7 @@ export function SimulationFormPage(): JSX.Element {
data-testid="soc-blocked-banner"
className="rounded-xl px-xl py-md bg-fog border border-hairline text-[14px] text-charcoal"
>
Simulation pas encore en revue la redteam doit la marquer comme &quot;Review required&quot; avant
que vous puissiez intervenir.
Simulation not yet ready for review the red team must mark it as &quot;Review required&quot; before you can fill in the SOC section.
</div>
)}
@@ -361,36 +360,27 @@ export function SimulationFormPage(): JSX.Element {
/>
</FormField>
<div className="grid grid-cols-1 md:grid-cols-2 gap-md">
<FormField label="Executed at" htmlFor="sim-executed-at">
<TextInput
id="sim-executed-at"
type="datetime-local"
name="executed_at"
value={rt.executed_at}
onChange={(e) => setRt({ ...rt, executed_at: e.target.value })}
disabled={rtDisabled}
/>
</FormField>
<FormField label="Executed at" htmlFor="sim-executed-at">
<TextInput
id="sim-executed-at"
type="datetime-local"
name="executed_at"
value={rt.executed_at}
onChange={(e) => setRt({ ...rt, executed_at: e.target.value })}
disabled={rtDisabled}
/>
</FormField>
<FormField label="Execution result" htmlFor="sim-exec-result">
<TextInput
id="sim-exec-result"
name="execution_result"
value={rt.execution_result}
onChange={(e) => setRt({ ...rt, execution_result: e.target.value })}
disabled={rtDisabled}
/>
</FormField>
</div>
{canEditRT && (
<div className="flex items-center gap-md pt-sm border-t border-hairline">
<button type="submit" form="rt-form" className="btn-primary" disabled={submitting}>
{updateMutation.isPending ? 'Saving…' : 'Save Red Team'}
</button>
</div>
)}
<FormField label="Execution result" htmlFor="sim-exec-result">
<TextArea
id="sim-exec-result"
name="execution_result"
value={rt.execution_result}
onChange={(e) => setRt({ ...rt, execution_result: e.target.value })}
disabled={rtDisabled}
rows={5}
/>
</FormField>
</form>
{/* SOC card */}
@@ -442,13 +432,6 @@ export function SimulationFormPage(): JSX.Element {
/>
</FormField>
{canSaveSoc && (
<div className="flex items-center gap-md pt-sm border-t border-hairline">
<button type="submit" form="soc-form" className="btn-primary" disabled={submitting}>
{updateMutation.isPending ? 'Saving…' : 'Save SOC'}
</button>
</div>
)}
</form>
{submitError ? (
@@ -457,8 +440,18 @@ export function SimulationFormPage(): JSX.Element {
</div>
) : null}
{/* Workflow + delete footer */}
<div className="flex items-center gap-md flex-wrap">
{/* Unified sticky action bar */}
<div className="sticky bottom-0 bg-canvas border-t border-hairline flex items-center gap-md flex-wrap py-md">
{canEditRT && (
<button type="submit" form="rt-form" className="btn-primary" disabled={submitting}>
{updateMutation.isPending ? 'Saving…' : 'Save Red Team'}
</button>
)}
{canSaveSoc && (
<button type="submit" form="soc-form" className="btn-primary" disabled={submitting}>
{updateMutation.isPending ? 'Saving…' : 'Save SOC'}
</button>
)}
{showMarkReview && (
<button
type="button"
@@ -466,7 +459,7 @@ export function SimulationFormPage(): JSX.Element {
onClick={onMarkReview}
disabled={transitionMutation.isPending}
>
Marquer en revue
Mark for review
</button>
)}
{showClose && (
@@ -476,27 +469,27 @@ export function SimulationFormPage(): JSX.Element {
onClick={onClose}
disabled={transitionMutation.isPending}
>
Clôturer
Close
</button>
)}
{canEditEngagements && simulationId && (
<button
type="button"
className="btn-text-link text-bloom-deep"
className="btn-text-link text-bloom-deep ml-auto"
onClick={() => setShowDeleteConfirm(true)}
disabled={submitting}
>
Supprimer
Delete
</button>
)}
</div>
{showDeleteConfirm && (
<ConfirmDialog
title="Supprimer la simulation"
description="Cette action est irréversible. La simulation sera définitivement supprimée."
confirmLabel="Supprimer"
cancelLabel="Annuler"
title="Delete simulation"
description="This action is permanent. The simulation will be deleted forever."
confirmLabel="Delete"
cancelLabel="Cancel"
destructive
onConfirm={onDelete}
onCancel={() => setShowDeleteConfirm(false)}

View File

@@ -110,7 +110,7 @@ export function UsersAdminPage(): JSX.Element {
<section className="card-product flex flex-col gap-md">
<h2 className="text-[20px] font-medium">Create account</h2>
<form onSubmit={onCreate} className="grid grid-cols-1 md:grid-cols-4 gap-md items-end">
<form onSubmit={onCreate} className="grid grid-cols-1 md:grid-cols-4 gap-md items-start">
<FormField label="Username" htmlFor="new-username" required>
<TextInput
id="new-username"
@@ -137,9 +137,11 @@ export function UsersAdminPage(): JSX.Element {
options={ROLE_OPTIONS}
/>
</FormField>
<button type="submit" className="btn-primary" disabled={createMutation.isPending}>
{createMutation.isPending ? 'Creating…' : 'Create'}
</button>
<div className="self-end">
<button type="submit" className="btn-primary w-full" disabled={createMutation.isPending}>
{createMutation.isPending ? 'Creating…' : 'Create'}
</button>
</div>
</form>
{createError ? (
<div role="alert" className="text-[14px] text-bloom-deep">

View File

@@ -95,54 +95,54 @@ describe('SimulationFormPage — redteam mode (edit existing)', () => {
expect(screen.getByLabelText(/Executed at/i)).not.toBeDisabled();
});
it('shows "Marquer en revue" button when status is pending', async () => {
it('shows "Mark for review" button when status is pending', async () => {
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => {
expect(screen.getByRole('button', { name: /Marquer en revue/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Mark for review/i })).toBeInTheDocument();
});
});
it('does not show "Clôturer" when status is pending', async () => {
it('does not show "Close" when status is pending', async () => {
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => screen.getByRole('button', { name: /Marquer en revue/i }));
expect(screen.queryByRole('button', { name: /Clôturer/i })).toBeNull();
await waitFor(() => screen.getByRole('button', { name: /Mark for review/i }));
expect(screen.queryByRole('button', { name: /^Close$/i })).toBeNull();
});
it('shows "Marquer en revue" for in_progress status', async () => {
it('shows "Mark for review" for in_progress status', async () => {
mock.onGet('/simulations/7').reply(200, { ...BASE_SIM, status: 'in_progress' });
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => {
expect(screen.getByRole('button', { name: /Marquer en revue/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /Mark for review/i })).toBeInTheDocument();
});
});
it('shows "Clôturer" button when status is review_required', async () => {
it('shows "Close" button when status is review_required', async () => {
mock.onGet('/simulations/7').reply(200, { ...BASE_SIM, status: 'review_required' });
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => {
expect(screen.getByRole('button', { name: /Clôturer/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Close$/i })).toBeInTheDocument();
});
});
it('shows "Supprimer" button for redteam', async () => {
it('shows "Delete" button for redteam', async () => {
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => {
expect(screen.getByRole('button', { name: /Supprimer/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Delete$/i })).toBeInTheDocument();
});
});
});
@@ -242,13 +242,13 @@ describe('SimulationFormPage — SOC role + review_required (can edit SOC fields
expect(screen.queryByTestId('soc-blocked-banner')).toBeNull();
});
it('shows "Clôturer" for SOC when review_required', async () => {
it('shows "Close" for SOC when review_required', async () => {
renderWithProviders(<EditPage />, {
routerProps: { initialEntries: ['/engagements/42/simulations/7/edit'] },
});
await waitFor(() => {
expect(screen.getByRole('button', { name: /Clôturer/i })).toBeInTheDocument();
expect(screen.getByRole('button', { name: /^Close$/i })).toBeInTheDocument();
});
});
});