From 43ab7073f1cc761ac50a5171cbfa9798b2693b48 Mon Sep 17 00:00:00 2001 From: Knacky Date: Wed, 27 May 2026 21:38:17 +0200 Subject: [PATCH] =?UTF-8?q?test(e2e):=20un-skip=20AC-21.6=20=E2=80=94=20ba?= =?UTF-8?q?ckend=20matrix=20fix=20landed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove test.fail annotation from AC-21.6 "Apply from modal includes tactic in result". GET /api/mitre/matrix now returns tactic_id in TA-format ("TA0007") so the PATCH succeeds and the tactic chip appears. Update button selector in both AC-21.6 tests from title*="discovery" to title*="TA0007" to match the fixed matrix response format. Suite: 158 passed, 0 failed. Co-Authored-By: Claude Sonnet 4.6 --- e2e/tests/us21-tactic-selection.spec.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/e2e/tests/us21-tactic-selection.spec.ts b/e2e/tests/us21-tactic-selection.spec.ts index 131c31b..e48e6d7 100644 --- a/e2e/tests/us21-tactic-selection.spec.ts +++ b/e2e/tests/us21-tactic-selection.spec.ts @@ -144,8 +144,8 @@ test.describe('US-21 — tactic selection', () => { const dialog = page.getByRole('dialog'); await expect(dialog).toBeVisible({ timeout: 10_000 }); - // Wait for matrix to load — matrix returns slug IDs, tactic header title contains "discovery" - const discoveryHeader = dialog.locator('button[title*="discovery"]').first(); + // Wait for matrix to load — tactic header title: "Discovery (TA0007) — click to tag this tactic" + const discoveryHeader = dialog.locator('button[title*="TA0007"]'); await expect(discoveryHeader).toBeVisible({ timeout: 10_000 }); await discoveryHeader.click(); @@ -158,16 +158,10 @@ test.describe('US-21 — tactic selection', () => { await deleteSimulation(redteamToken, sim.id); }); - test.fail('AC-21.6 — Apply from modal includes tactic in result (auto-save)', async ({ + test('AC-21.6 — Apply from modal includes tactic in result (auto-save)', async ({ page, context, }) => { - // KNOWN DEFECT: /api/mitre/matrix returns tactic_id as slug ("discovery") but - // PATCH /api/simulations/:id expects TA-format ("TA0007"). When a tactic is - // selected via the matrix modal and Apply is clicked, the PATCH body contains - // tactic_ids: ["discovery"] which the backend rejects with "unknown tactic id". - // Fix owner: backend-builder (matrix endpoint must return TA-format tactic IDs) - // OR frontend-builder (modal must map slug → TA format before saving). const sim = await createSimulation(redteamToken, engagementId, 'AC-21.6 apply tactic'); await seedTokenInStorage(context, redteamToken); @@ -177,8 +171,8 @@ test.describe('US-21 — tactic selection', () => { const dialog = page.getByRole('dialog'); await expect(dialog).toBeVisible({ timeout: 10_000 }); - // Wait for matrix to load — tactic header title uses slug: "Discovery (discovery)..." - const discoveryBtn = dialog.locator('button[title*="discovery"]').first(); + // Tactic header title: "Discovery (TA0007) — click to tag this tactic" + const discoveryBtn = dialog.locator('button[title*="TA0007"]'); await expect(discoveryBtn).toBeVisible({ timeout: 10_000 }); await discoveryBtn.click(); @@ -189,7 +183,7 @@ test.describe('US-21 — tactic selection', () => { // Modal closes await expect(dialog).not.toBeVisible({ timeout: 5_000 }); - // This assertion fails because PATCH with slug ID returns 400 + // Tactic chip appears after auto-save await expect(page.getByTestId('mitre-tactic-tag')).toBeVisible({ timeout: 8_000 }); await expect(page.getByTestId('techniques-tag-list')).toContainText('TA0007');