feat: add investigation map workspace view
This commit is contained in:
@@ -367,4 +367,75 @@ test("update submission replaces response panel with loading card, preserves con
|
||||
await expect(rwTextarea).toBeVisible();
|
||||
await expect(overlay).not.toBeVisible({ timeout: 3_000 });
|
||||
}
|
||||
});
|
||||
|
||||
/* ═══════ Test: investigation map appears and evolves across turns ═ */
|
||||
|
||||
test("investigation map: appears after start, topics evolve across mocked turns", async ({ page }) => {
|
||||
await page.goto("/");
|
||||
|
||||
await page.evaluate(() => {
|
||||
window.__MOCK_ENABLED = true;
|
||||
window.__MOCK_DELAY = "instant";
|
||||
window.__MOCK_SCENARIO = "complete";
|
||||
});
|
||||
|
||||
const textarea = page.locator("textarea[placeholder*=Describe]");
|
||||
await textarea.fill(INVESTIGATION_SCENARIOS[0].centralStatement);
|
||||
await page.getByRole("button", { name: "Analyse" }).click();
|
||||
|
||||
await waitForLoading(page);
|
||||
await waitForWorkspaceReady(page);
|
||||
|
||||
// Verify the investigation map card is present after start
|
||||
const mapCard = page.locator('[aria-label="Investigation map"]');
|
||||
await expect(mapCard).toBeVisible();
|
||||
|
||||
// Map heading visible
|
||||
await expect(mapCard.getByRole("heading", { name: "Investigation Map" })).toBeVisible();
|
||||
|
||||
// Helper text visible
|
||||
await expect(mapCard.getByText(/building an understanding/i)).toBeVisible();
|
||||
|
||||
// At turn 0 (initial analysis): one topic established, one current, rest unknown
|
||||
const establishedTopics = page.locator('[data-testid="map-topic-established"]');
|
||||
const currentTopics = page.locator('[data-testid="map-topic-current"]');
|
||||
const unknownTopics = page.locator('[data-testid="map-topic-unknown"]');
|
||||
|
||||
await expect(establishedTopics).toHaveCount(1);
|
||||
await expect(currentTopics).toHaveCount(1);
|
||||
await expect(unknownTopics).toHaveCount(6);
|
||||
|
||||
// Submit first answer → turn 1: one more established, next topic becomes current
|
||||
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
|
||||
if (await answerTextarea.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea.fill("The figures are comparable.");
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
|
||||
await waitForLoading(page);
|
||||
await waitForWorkspaceReady(page);
|
||||
|
||||
// Current investigation remains visible (context preserved)
|
||||
await expect(page.getByRole("heading", { name: "Current investigation" })).toBeVisible({ timeout: 5_000 });
|
||||
|
||||
// Map should update: 2 established, 1 current, 5 unknown
|
||||
await expect(establishedTopics).toHaveCount(2);
|
||||
await expect(currentTopics).toHaveCount(1);
|
||||
await expect(unknownTopics).toHaveCount(5);
|
||||
|
||||
// Submit second answer → turn 2
|
||||
const answerTextarea2 = page.locator('textarea[placeholder*=Answer]');
|
||||
if (await answerTextarea2.isVisible({ timeout: 3000 })) {
|
||||
await answerTextarea2.fill("Complaint rate fell from 2.0 to 1.9 per 100 units.");
|
||||
await page.getByRole("button", { name: "Update situation" }).click();
|
||||
|
||||
await waitForLoading(page);
|
||||
await waitForWorkspaceReady(page);
|
||||
|
||||
// After second update: 3 established, current shifts again
|
||||
await expect(establishedTopics).toHaveCount(3);
|
||||
await expect(currentTopics).toHaveCount(1);
|
||||
await expect(unknownTopics).toHaveCount(4);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user