session-child-navigation.spec.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { seedSessionTask, withSession } from "../actions"
  2. import { test, expect } from "../fixtures"
  3. test("task tool child-session link does not trigger stale show errors", async ({ page, sdk, gotoSession }) => {
  4. test.setTimeout(120_000)
  5. const errs: string[] = []
  6. const onError = (err: Error) => {
  7. errs.push(err.message)
  8. }
  9. page.on("pageerror", onError)
  10. await withSession(sdk, `e2e child nav ${Date.now()}`, async (session) => {
  11. const child = await seedSessionTask(sdk, {
  12. sessionID: session.id,
  13. description: "Open child session",
  14. prompt: "Search the repository for AssistantParts and then reply with exactly CHILD_OK.",
  15. })
  16. try {
  17. await gotoSession(session.id)
  18. const link = page
  19. .locator("a.subagent-link")
  20. .filter({ hasText: /open child session/i })
  21. .first()
  22. await expect(link).toBeVisible({ timeout: 30_000 })
  23. await link.click()
  24. await expect(page).toHaveURL(new RegExp(`/session/${child.sessionID}(?:[/?#]|$)`), { timeout: 30_000 })
  25. await page.waitForTimeout(1000)
  26. expect(errs).toEqual([])
  27. } finally {
  28. page.off("pageerror", onError)
  29. }
  30. })
  31. })