From 7c011db6d9cd180f1f7454fa2b953c1ccad1cf72 Mon Sep 17 00:00:00 2001 From: Knacky Date: Thu, 28 May 2026 07:15:04 +0200 Subject: [PATCH] =?UTF-8?q?test(e2e):=20sprint=205=20acceptance=20tests=20?= =?UTF-8?q?=E2=80=94=20US-26=20=E2=86=92=20US-28=20+=20dropdown=20adaptati?= =?UTF-8?q?ons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add three new spec files: - us26-templates-crud: API CRUD (AC-26.3–26.7) + UI list/form/delete/redirect (AC-26.8) - us27-instantiate-from-template: template_id copy + name override + 404 + decoupling (AC-27.1–27.3) + no auto-transition/engagement-activate (AC-27.4–27.5) + dropdown UI + picker modal + empty state + SOC gate (AC-27.6–27.7) - us28-templates-nav: Templates link admin+redteam only, SOC redirect, form editable (AC-28.1–28.3) Adapt sprint 2/3 e2e for sprint 5 dropdown: - us4-engagements: getByRole link "New simulation" → getByTestId "new-simulation-btn" - us7-simulation-create: same — split-button dropdown replaced the link Suite: 201 passed (1 pre-existing flaky in us3 re DB state, unrelated to sprint 5). Co-Authored-By: Claude Sonnet 4.6 --- e2e/tests/us26-templates-crud.spec.ts | 322 +++++++++++++++++ .../us27-instantiate-from-template.spec.ts | 339 ++++++++++++++++++ e2e/tests/us28-templates-nav.spec.ts | 136 +++++++ e2e/tests/us4-engagements.spec.ts | 6 +- e2e/tests/us7-simulation-create.spec.ts | 10 +- 5 files changed, 803 insertions(+), 10 deletions(-) create mode 100644 e2e/tests/us26-templates-crud.spec.ts create mode 100644 e2e/tests/us27-instantiate-from-template.spec.ts create mode 100644 e2e/tests/us28-templates-nav.spec.ts diff --git a/e2e/tests/us26-templates-crud.spec.ts b/e2e/tests/us26-templates-crud.spec.ts new file mode 100644 index 0000000..32f6f2a --- /dev/null +++ b/e2e/tests/us26-templates-crud.spec.ts @@ -0,0 +1,322 @@ +/** + * US-26 — Admin/redteam creates and manages simulation templates. + * Covers AC-26.3 → AC-26.8 (API CRUD + UI). + * AC-26.1/2 (model + migration) tested implicitly via API assertions. + */ +import { test, expect } from '@playwright/test'; +import { + adminToken, + deleteUserByUsername, + ensureUser, + login, + makeClient, +} from '../fixtures/api'; +import { seedTokenInStorage } from '../fixtures/auth'; + +const REDTEAM_USER = 'us26-redteam'; +const SOC_USER = 'us26-soc'; +const PASS = 'us26-pass-strong'; + +interface Template { + id: number; + name: string; + description: string | null; + commands: string | null; + prerequisites: string | null; + techniques: { id: string; name: string }[]; + tactics: { id: string; name: string }[]; + created_at: string; + updated_at: string | null; + created_by: { id: number; username: string }; +} + +async function createTemplate( + token: string, + payload: { name: string; description?: string; commands?: string; technique_ids?: string[]; tactic_ids?: string[] }, +): Promise