session.spec.ts 717 B

123456789101112131415161718192021
  1. import { test, expect } from "./fixtures"
  2. import { promptSelector } from "./utils"
  3. test("can open an existing session and type into the prompt", async ({ page, sdk, gotoSession }) => {
  4. const title = `e2e smoke ${Date.now()}`
  5. const created = await sdk.session.create({ title }).then((r) => r.data)
  6. if (!created?.id) throw new Error("Session create did not return an id")
  7. const sessionID = created.id
  8. try {
  9. await gotoSession(sessionID)
  10. const prompt = page.locator(promptSelector)
  11. await prompt.click()
  12. await page.keyboard.type("hello from e2e")
  13. await expect(prompt).toContainText("hello from e2e")
  14. } finally {
  15. await sdk.session.delete({ sessionID }).catch(() => undefined)
  16. }
  17. })