context.spec.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { test, expect } from "../fixtures"
  2. import { promptSelector } from "../selectors"
  3. import { withSession } from "../actions"
  4. test("context panel can be opened from the prompt", async ({ page, sdk, gotoSession }) => {
  5. const title = `e2e smoke context ${Date.now()}`
  6. await withSession(sdk, title, async (session) => {
  7. await sdk.session.promptAsync({
  8. sessionID: session.id,
  9. noReply: true,
  10. parts: [
  11. {
  12. type: "text",
  13. text: "seed context",
  14. },
  15. ],
  16. })
  17. await expect
  18. .poll(async () => {
  19. const messages = await sdk.session.messages({ sessionID: session.id, limit: 1 }).then((r) => r.data ?? [])
  20. return messages.length
  21. })
  22. .toBeGreaterThan(0)
  23. await gotoSession(session.id)
  24. const contextButton = page
  25. .locator('[data-component="button"]')
  26. .filter({ has: page.locator('[data-component="progress-circle"]').first() })
  27. .first()
  28. await expect(contextButton).toBeVisible()
  29. await contextButton.click()
  30. const tabs = page.locator('[data-component="tabs"][data-variant="normal"]')
  31. await expect(tabs.getByRole("tab", { name: "Context" })).toBeVisible()
  32. })
  33. })