conversation-session-mention-selection.test.ts 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import { readFile } from "node:fs/promises";
  2. import { clearAppData } from "#e2e/helpers/desktop-app";
  3. import { prepareV4ConversationE2E } from "#e2e/helpers/v4-conversation";
  4. import { registerMentionSelectionCases } from "#e2e/helpers/mention-selection-cases";
  5. // E2E_MENTION_SELECTION:仅编辑草稿;不发送 prompt,不需要 synthetic provider 响应。
  6. describe("mention selection and canonical clipboard", () => {
  7. before(async () => {
  8. await prepareV4ConversationE2E();
  9. await assertNoProviderRequests();
  10. });
  11. afterEach(async () => {
  12. await assertNoProviderRequests();
  13. });
  14. after(async () => {
  15. await browser.electron.restoreAllMocks();
  16. await clearAppData();
  17. });
  18. registerMentionSelectionCases();
  19. });
  20. async function assertNoProviderRequests() {
  21. const capturePath = process.env.E2E_PROVIDER_CAPTURE_PATH?.trim();
  22. if (!capturePath)
  23. throw new Error("Provider capture path is required for the no-request assertion");
  24. // 缺少取证文件不能被当作零请求,否则 fixture 隔离可能假通过。
  25. const capture = JSON.parse(await readFile(capturePath, "utf8"));
  26. expect(capture.records).toEqual([]);
  27. }