conversation-session-plugin-mcp-skill-workspace-isolation.test.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { clearAppData, getE2EAppDataPaths } from "#e2e/helpers/desktop-app";
  2. import { getPluginList } from "#e2e/helpers/plugin-management-lifecycle";
  3. import { PLUGIN_MCP_PLUGIN_ID } from "#e2e/helpers/plugin-mcp-skill";
  4. import {
  5. pluginConfigEnabled,
  6. readWorkspacePluginConfig,
  7. } from "#e2e/helpers/workspace-plugin-runtime";
  8. describe("WPL-001 Workspace Plugin workspace isolation E2E", () => {
  9. after(async () => {
  10. await browser.electron.restoreAllMocks();
  11. await clearAppData();
  12. });
  13. it("keeps User projection clean while Workspace A overrides and B inherits", async function () {
  14. this.timeout(120000);
  15. const { homeDir, workspace } = getE2EAppDataPaths();
  16. const workspaceB = `${homeDir}/WorkspaceB`;
  17. expect(pluginConfigEnabled(await readWorkspacePluginConfig())).toBe(true);
  18. const userPluginA = (await getPluginList(workspace, undefined, "user")).plugins.find(
  19. (item) => item.id === PLUGIN_MCP_PLUGIN_ID,
  20. );
  21. const workspacePluginA = (await getPluginList(workspace, undefined, "workspace")).plugins.find(
  22. (item) => item.id === PLUGIN_MCP_PLUGIN_ID,
  23. );
  24. const userPluginB = (await getPluginList(workspaceB, undefined, "user")).plugins.find(
  25. (item) => item.id === PLUGIN_MCP_PLUGIN_ID,
  26. );
  27. const workspacePluginB = (await getPluginList(workspaceB, undefined, "workspace")).plugins.find(
  28. (item) => item.id === PLUGIN_MCP_PLUGIN_ID,
  29. );
  30. expect(userPluginA).toMatchObject({ enabled: false, enabledSource: "user" });
  31. expect(userPluginB).toMatchObject({ enabled: false, enabledSource: "user" });
  32. expect(workspacePluginA).toMatchObject({
  33. enabled: true,
  34. enabledSource: "workspace",
  35. });
  36. expect(workspacePluginB).toMatchObject({
  37. enabled: false,
  38. enabledSource: "user",
  39. });
  40. expect(userPluginA?.id).toBe(workspacePluginA?.id);
  41. expect(workspacePluginB?.rootPath).toBeTruthy();
  42. });
  43. });