From addee8befdcb5632f9a9c391fe8ff0e83741e921 Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Mon, 2 Nov 2026 13:41:25 +0530 Subject: [PATCH] test(research): verify expanded question after browser Back Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- .../research-route-reading.mjs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/personal-workspace-browser/research-route-reading.mjs b/examples/personal-workspace-browser/research-route-reading.mjs index 8baebfaa54..393b02d7cf 100644 --- a/examples/personal-workspace-browser/research-route-reading.mjs +++ b/examples/personal-workspace-browser/research-route-reading.mjs @@ -224,11 +224,21 @@ export const researchRouteReadingScenario = { await page.reload({waitUntil: "domcontentloaded"}); await reader.waitFor(); assert.match(new URL(page.url()).searchParams.get("research_node"), /route-0-end/); + await page.waitForFunction(() => new URLSearchParams(location.search).has("research_finding")); + const readingBeforeGraph = new URL(page.url()); await reader.getByRole("button", {name: "Whole graph", exact: true}).click(); await page.goBack(); await reader.waitFor(); - await reader.getByRole("button", {name: "Full research question", exact: true}).click(); - assert.match(await reader.locator(".research-question-text").innerText(), /末端研究/); + // Back restores the expanded question itself, rather than its help trigger. + const restoredQuestion = reader.locator(".research-reader-question > summary > span"); + await restoredQuestion.waitFor(); + assert.equal(await restoredQuestion.innerText(), capture.events.find(event => event.result_id === "route-0-end" && event.event_kind === "node").title, + "Back restores the complete original question without another activation"); + assert(await reader.locator(".research-reader-question").evaluate(element => element.open), "Back retains expanded-question reading intent"); + const restoredReading = new URL(page.url()); + for (const key of ["research_goal", "research_node", "research_finding", "research_question"]) { + assert.equal(restoredReading.searchParams.get(key), readingBeforeGraph.searchParams.get(key), `Back retains the original ${key}`); + } await page.keyboard.press("Escape"); // A grouped reading context survives the document/URL boundary, rather // than living only in an in-memory opener ref. Navigation is a read.