interactive.test.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import { test } from "@microsoft/tui-test"
  2. import { CLINE_BIN } from "./helpers/constants.js"
  3. import { assertApiTab, assertAutoApproveTab, assertFeaturesTab, assertOtherTab } from "./helpers/page-objects/settings.js"
  4. import { expectVisible, testEnv, typeAndSubmit } from "./utils.js"
  5. test.describe("cline interactive basics", () => {
  6. test.use({
  7. program: { file: CLINE_BIN, args: ["--tui"] },
  8. rows: 50,
  9. columns: 120,
  10. env: testEnv("default"),
  11. })
  12. test("shows logo, prompt, mode toggles, and hints", async ({ terminal }) => {
  13. await expectVisible(terminal, ["What can I do for you?", "@@@@@@", "Plan", "Act", "@ for files", "Tab"])
  14. })
  15. test("shows slash commands after / input", async ({ terminal }) => {
  16. await expectVisible(terminal, "What can I do for you?")
  17. await typeAndSubmit(terminal, "/")
  18. await expectVisible(terminal, ["/help", "/settings", "/models"], {
  19. timeout: 5000,
  20. })
  21. })
  22. test("opens /settings and navigates tabs with left/right arrows", async ({ terminal }) => {
  23. await expectVisible(terminal, "What can I do for you?")
  24. await typeAndSubmit(terminal, "/settings")
  25. await expectVisible(terminal, "Settings (Esc to close)")
  26. // API tab (default)
  27. await assertApiTab(terminal)
  28. await expectVisible(terminal, "Use separate models for Plan and Act")
  29. // Auto-approve tab
  30. terminal.keyRight()
  31. await assertAutoApproveTab(terminal)
  32. // Features tab
  33. terminal.keyRight()
  34. await assertFeaturesTab(terminal)
  35. await expectVisible(terminal, ["Strict plan mode", "Native tool call", "Parallel tool calling"])
  36. // Account tab
  37. terminal.keyRight()
  38. await expectVisible(terminal, ["Sign in to access Cline features", "Sign in with Cline"])
  39. // Other tab
  40. terminal.keyRight()
  41. await assertOtherTab(terminal)
  42. // Left once from Other should move back to Account
  43. terminal.keyLeft()
  44. await expectVisible(terminal, "Sign in to access Cline features")
  45. // Two rights from Account should wrap back to API
  46. terminal.keyRight()
  47. await assertOtherTab(terminal)
  48. terminal.keyRight()
  49. await assertApiTab(terminal)
  50. })
  51. })