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');