Skip to content

Commit 0baa10c

Browse files
committed
test(ui): restore history after agent tool navigation
1 parent 60f132a commit 0baa10c

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

‎ui/src/pages/agents/panels-tools-skills.browser.test.ts‎

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,21 @@ describe("agents tools panel (browser)", () => {
417417
expect(group.open).toBe(false);
418418
expect(tool.open).toBe(false);
419419

420-
chip.click();
421-
await new Promise((resolve) => {
422-
requestAnimationFrame(resolve);
423-
});
420+
const previousUrl = `${window.location.pathname}${window.location.search}${window.location.hash}`;
421+
try {
422+
chip.click();
423+
await new Promise((resolve) => {
424+
requestAnimationFrame(resolve);
425+
});
424426

425-
expect(group.open).toBe(true);
426-
expect(tool.open).toBe(true);
427-
428-
container.remove();
427+
expect(group.open).toBe(true);
428+
expect(tool.open).toBe(true);
429+
} finally {
430+
// Hash links mutate shared jsdom history; restore the actual prior URL
431+
// so a later Settings route never inherits this tool-card deep link.
432+
window.history.replaceState({}, "", previousUrl);
433+
container.remove();
434+
}
429435
});
430436
});
431437

0 commit comments

Comments
 (0)