conversation-session-plugin-mcp-skill-workspace-root.test.ts 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. import { existsSync } from "node:fs";
  2. import { join } from "node:path";
  3. import { clearAppData, getE2EAppDataPaths } from "#e2e/helpers/desktop-app";
  4. import { PLUGIN_MCP_PLUGIN_ID, PLUGIN_MCP_PLUGIN_ROOT } from "#e2e/helpers/plugin-mcp-skill";
  5. import {
  6. assertWorkspacePluginUnavailable,
  7. readWorkspacePluginConfig,
  8. } from "#e2e/helpers/workspace-plugin-runtime";
  9. describe("WPL-014 Workspace Plugin root E2E", () => {
  10. after(async () => {
  11. await browser.electron.restoreAllMocks();
  12. await clearAppData();
  13. });
  14. it("ignores a project Plugin root without a User package record", async function () {
  15. this.timeout(240000);
  16. const { storageRoot } = getE2EAppDataPaths();
  17. const workspaceConfig = await readWorkspacePluginConfig();
  18. expect(workspaceConfig.plugins).toMatchObject({
  19. dirs: [PLUGIN_MCP_PLUGIN_ROOT],
  20. enabledPlugins: { [PLUGIN_MCP_PLUGIN_ID]: true },
  21. });
  22. const installedRecordsPath = join(storageRoot, "cli", "plugins", "installed_plugins.json");
  23. expect(existsSync(installedRecordsPath)).toBe(false);
  24. // 仓库中的目录声明不是用户安装授权,真实模型请求不能携带该插件的 MCP 工具。
  25. await assertWorkspacePluginUnavailable("E2E_PLUGIN_MCP_PING_WORKSPACE_ROOT");
  26. });
  27. });