fix: localise update reasoning state

This commit is contained in:
2026-08-05 08:36:18 +01:00
parent 6d11c1d503
commit 61210c1200
4 changed files with 84 additions and 78 deletions
+29 -7
View File
@@ -308,7 +308,7 @@ test("loading overlay appears on submit and disappears after response", async ({
/* ═══════ Test: update loading hides workspace and shows overlay ═ */
test("update submission hides workspace, shows reasoning overlay, then restores workspace", async ({ page }) => {
test("update submission replaces response panel with loading card, preserves context", async ({ page }) => {
// Use normal (700ms) delay so the loading overlay is observable during updates
await page.goto("/");
@@ -326,23 +326,45 @@ test("update submission hides workspace, shows reasoning overlay, then restores
await waitForWorkspaceReady(page);
// Workspace visible after initial analysis
await expect(page.locator('[data-testid="reasoning-workspace"]')).toBeVisible();
const workspace = page.locator('[data-testid="reasoning-workspace"]');
await expect(workspace).toBeVisible();
// Submit an answer to trigger update loading
const answerTextarea = page.locator('textarea[placeholder*=Answer]');
if (await answerTextarea.isVisible({ timeout: 3000 })) {
// Current investigation visible before click
await expect(page.getByRole("heading", { name: "Current investigation" })).toBeVisible();
// Loading overlay absent before click
await expect(page.locator('[data-testid="loading-overlay"][role="status"]')).not.toBeVisible();
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 });
// Current investigation remains visible during update loading
await expect(page.getByRole("heading", { name: "Current investigation" })).toBeVisible({ timeout: 5_000 });
// Loading overlay should be visible (with role="status" for accessibility)
// Response textarea hidden — replaced by loading overlay
const rwTextarea = page.locator('#rw-answer');
await expect(rwTextarea).not.toBeVisible({ timeout: 3_000 });
// Loading overlay visible in response panel position
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/);
await expect(overlay.getByText(/Working through your situation/)).toHaveCount(1);
// Current understanding card remains visible (supporting context preserved)
const cuHeading = page.getByRole("heading", { name: "Current understanding" });
if (await cuHeading.isVisible({ timeout: 2_000 })) {
await expect(cuHeading).toBeVisible();
}
// After loading completes, workspace returns with updated question
await waitForWorkspaceReady(page);
await expect(workspace).toBeVisible();
await expect(rwTextarea).toBeVisible();
await expect(overlay).not.toBeVisible({ timeout: 3_000 });
}
});