Commits merged: - chore(test-isolation): broaden runtime ignore list for live fusion app paths - feat(FN-3573): complete Step 2 — add plugin setup API client helpers - feat(FN-3573): complete Step 1 — backfill plugin setup routes Files changed: plugins/fusion-plugin-agent-browser/README.md | 26 ++++++ plugins/fusion-plugin-agent-browser/manifest.json | 15 ++++ plugins/fusion-plugin-agent-browser/package.json | 25 ++++++ .../src/__tests__/index.test.ts | 66 +++++++++++++++ .../src/__tests__/prompts.test.ts | 21 +++++ .../src/__tests__/setup.test.ts | 39 +++++++++ .../src/__tests__/skills.test.ts | 9 ++ .../src/__tests__/tools.test.ts | 55 ++++++++++++ .../src/__tests__/types.test.ts | 16 ++++ .../src/__tests__/workflow-steps.test.ts | 10 +++ plugins/fusion-plugin-agent-browser/src/index.ts | 67 +++++++++++++++ plugins/fusion-plugin-agent-browser/src/probe.ts | 98 ++++++++++++++++++++++ plugins/fusion-plugin-agent-browser/src/prompts.ts | 23 +++++ plugins/fusion-plugin-agent-browser/src/setup.ts | 31 +++++++ plugins/fusion-plugin-agent-browser/src/skills.ts | 12 +++ plugins/fusion-plugin-agent-browser/src/tools.ts | 34 ++++++++ plugins/fusion-plugin-agent-browser/src/types.ts | 56 +++++++++++++ .../src/workflow-steps.ts | 15 ++++ plugins/fusion-plugin-agent-browser/tsconfig.json | 9 ++ .../fusion-plugin-agent-browser/vitest.config.ts | 22 +++++ pnpm-lock.yaml | 16 ++++ pnpm-workspace.yaml | 1 + 22 files changed, 666 insertions(+) Fusion-Task-Id: FN-3573
40 lines
1.4 KiB
TypeScript
40 lines
1.4 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
import { checkSetup } from "../setup.js";
|
|
import type { PluginContext } from "@fusion/plugin-sdk";
|
|
import { probeAgentBrowserBinary } from "../probe.js";
|
|
|
|
vi.mock("../probe.js", () => ({
|
|
probeAgentBrowserBinary: vi.fn(),
|
|
}));
|
|
|
|
const probeMock = vi.mocked(probeAgentBrowserBinary);
|
|
|
|
const ctx: PluginContext = {
|
|
pluginId: "fusion-plugin-agent-browser",
|
|
taskStore: {} as PluginContext["taskStore"],
|
|
settings: {},
|
|
logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
|
|
emitEvent: () => undefined,
|
|
};
|
|
|
|
describe("setup hooks", () => {
|
|
it("returns not-installed when binary is missing", async () => {
|
|
probeMock.mockResolvedValueOnce({ available: false, reason: "`agent-browser` not found on PATH", notFound: true });
|
|
const result = await checkSetup(ctx);
|
|
expect(result.status).toBe("not-installed");
|
|
});
|
|
|
|
it("returns installed when probe succeeds", async () => {
|
|
probeMock.mockResolvedValueOnce({ available: true, version: "1.2.3", binaryPath: "/usr/bin/agent-browser" });
|
|
const result = await checkSetup(ctx);
|
|
expect(result.status).toBe("installed");
|
|
expect(result.version).toBe("1.2.3");
|
|
});
|
|
|
|
it("returns error for non-not-found probe failures", async () => {
|
|
probeMock.mockResolvedValueOnce({ available: false, reason: "Probe timed out after 1000ms" });
|
|
const result = await checkSetup(ctx);
|
|
expect(result.status).toBe("error");
|
|
});
|
|
});
|