test(e2e): sprint 5 acceptance — US-26 / US-27 / US-28 + adaptations dropdown sprint 2-4
- us26: add AC-26.4 isinstance guard (technique_ids string→400) + AC-26.7 cascade test (DELETE template does not affect instantiated sim) - us27: add NIT-1 dropdown Escape/click-outside close, NIT-2 empty-engagement dropdown visibility - 49 sprint 5 tests passing, 206/207 full suite passing (us1 pre-existing isolation issue) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -336,4 +336,61 @@ test.describe('US-27 — instantiate from template', () => {
|
||||
|
||||
await deleteSimulation(redteamToken, simId);
|
||||
});
|
||||
|
||||
// NIT 1 — Dropdown closes on Escape key and on outside click
|
||||
test('NIT-1 — dropdown closes on Escape key press', async ({
|
||||
page,
|
||||
context,
|
||||
}) => {
|
||||
await seedTokenInStorage(context, redteamToken);
|
||||
await page.goto(`/engagements/${engagementId}`);
|
||||
|
||||
await page.getByTestId('new-simulation-dropdown-toggle').click();
|
||||
// Menu is open
|
||||
await expect(page.getByTestId('from-template-btn')).toBeVisible({ timeout: 3_000 });
|
||||
|
||||
// Press Escape
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(page.getByTestId('from-template-btn')).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
|
||||
test('NIT-1 — dropdown closes when clicking outside', async ({
|
||||
page,
|
||||
context,
|
||||
}) => {
|
||||
await seedTokenInStorage(context, redteamToken);
|
||||
await page.goto(`/engagements/${engagementId}`);
|
||||
|
||||
await page.getByTestId('new-simulation-dropdown-toggle').click();
|
||||
await expect(page.getByTestId('from-template-btn')).toBeVisible({ timeout: 3_000 });
|
||||
|
||||
// Click somewhere outside the dropdown (page heading)
|
||||
await page.getByRole('heading').first().click({ force: true });
|
||||
await expect(page.getByTestId('from-template-btn')).not.toBeVisible({ timeout: 3_000 });
|
||||
});
|
||||
|
||||
// NIT 2 — Empty-engagement SimulationList still shows dropdown
|
||||
test('NIT-2 — engagement with 0 simulations still shows New simulation dropdown', async ({
|
||||
page,
|
||||
context,
|
||||
}) => {
|
||||
// Create a fresh engagement with no simulations
|
||||
const eng = await createEngagement(redteamToken, {
|
||||
name: 'US27 empty eng dropdown',
|
||||
start_date: '2026-01-01',
|
||||
});
|
||||
|
||||
await seedTokenInStorage(context, redteamToken);
|
||||
await page.goto(`/engagements/${eng.id}`);
|
||||
|
||||
// Primary button visible even in empty state
|
||||
await expect(page.getByTestId('new-simulation-btn')).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Chevron also visible and functional
|
||||
await page.getByTestId('new-simulation-dropdown-toggle').click();
|
||||
await expect(page.getByTestId('from-template-btn')).toBeVisible({ timeout: 3_000 });
|
||||
|
||||
const tok = await adminToken();
|
||||
await deleteEngagement(tok, eng.id);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user