fix: unify reasoning mode across submissions

This commit is contained in:
2026-08-05 08:27:22 +01:00
parent c87fd65e13
commit 6d11c1d503
5 changed files with 132 additions and 4 deletions
+41
View File
@@ -304,4 +304,45 @@ test("loading overlay appears on submit and disappears after response", async ({
// Normal journey test: wait directly for the stable resulting state.
await waitForWorkspaceReady(page);
});
/* ═══════ Test: update loading hides workspace and shows overlay ═ */
test("update submission hides workspace, shows reasoning overlay, then restores workspace", async ({ page }) => {
// Use normal (700ms) delay so the loading overlay is observable during updates
await page.goto("/");
await page.evaluate(() => {
window.__MOCK_ENABLED = true;
window.__MOCK_DELAY = "normal";
window.__MOCK_SCENARIO = "complete";
});
// Start investigation
const textarea = page.locator("textarea[placeholder*=Describe]");
await textarea.fill(INVESTIGATION_SCENARIOS[0].centralStatement);
await page.getByRole("button", { name: "Analyse" }).click();
await waitForWorkspaceReady(page);
// Workspace visible after initial analysis
await expect(page.locator('[data-testid="reasoning-workspace"]')).toBeVisible();
// Submit an answer to trigger update loading
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();
// Workspace should disappear during update loading (reasoning mode)
await expect(page.locator('[data-testid="reasoning-workspace"]')).not.toBeVisible({ timeout: 5_000 });
// Loading overlay should be visible (with role="status" for accessibility)
const overlay = page.locator('[data-testid="loading-overlay"][role="status"]');
await expect(overlay).toBeVisible({ timeout: 5_000 });
// Status text should indicate reasoning mode (update-specific copy)
const statusText = overlay.getByRole("status");
await expect(statusText).toHaveText(/Working through your situation/);
}
});