mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-22 16:01:14 +00:00
* refactor(plugins): trim activation and contract exports * test(plugins): restore fixture cleanup * refactor(plugins): trim install and loader exports * test(plugins): fully reset loader caches * refactor(plugins): trim metadata and catalog exports * test(plugins): preserve catalog trust coverage * refactor(plugins): trim provider and plugin exports * refactor(plugins): trim runtime and tool exports * test(plugins): update dead-export consumers * test(plugins): remove empty dead-export suites * refactor(plugins): align exports with split registry * refactor(plugins): trim drifted loader exports * style(plugins): format test fixtures * refactor(scripts): use supported plugin APIs * refactor(plugins): finish dead export cleanup * chore(deadcode): refresh export baseline * test(cli): mock production memory state * chore(deadcode): sync latest export baseline * fix(tests): keep plugin fixtures inside core * chore(deadcode): refresh rebased export baseline * chore(deadcode): sync current ratchets * fix(plugins): retain reserved slot invariant * fix(plugins): preserve dead-export invariants * test(plugins): use neutral catalog query fixture * test(plugins): satisfy catalog lint * test(plugins): preserve integrity drift coverage * fix(ci): register skill experience live proof
64 lines
1.9 KiB
TypeScript
64 lines
1.9 KiB
TypeScript
/**
|
|
* Integration tests for browser plugin bootstrap through the gateway server.
|
|
*/
|
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
import { createBundledBrowserPluginFixture } from "../../test/helpers/browser-bundled-plugin-fixture.js";
|
|
import type { OpenClawConfig } from "../config/config.js";
|
|
import { clearPluginLoaderCache } from "../plugins/loader.test-fixtures.js";
|
|
import { resetPluginRuntimeStateForTest } from "../plugins/runtime.js";
|
|
import { loadGatewayStartupPlugins } from "./server-plugin-bootstrap.js";
|
|
|
|
function resetPluginState() {
|
|
clearPluginLoaderCache();
|
|
resetPluginRuntimeStateForTest();
|
|
}
|
|
|
|
function createTestLog() {
|
|
return {
|
|
info() {},
|
|
warn() {},
|
|
error() {},
|
|
debug() {},
|
|
};
|
|
}
|
|
|
|
describe("loadGatewayStartupPlugins browser plugin integration", () => {
|
|
let bundledFixture: ReturnType<typeof createBundledBrowserPluginFixture> | null = null;
|
|
|
|
beforeEach(() => {
|
|
bundledFixture = createBundledBrowserPluginFixture();
|
|
vi.stubEnv("OPENCLAW_BUNDLED_PLUGINS_DIR", bundledFixture.rootDir);
|
|
resetPluginState();
|
|
});
|
|
|
|
afterEach(() => {
|
|
resetPluginState();
|
|
vi.unstubAllEnvs();
|
|
bundledFixture?.cleanup();
|
|
bundledFixture = null;
|
|
});
|
|
|
|
it("adds browser.request and the browser control service from the bundled plugin", () => {
|
|
const loaded = loadGatewayStartupPlugins({
|
|
cfg: {
|
|
plugins: {
|
|
allow: ["browser"],
|
|
},
|
|
} as OpenClawConfig,
|
|
workspaceDir: process.cwd(),
|
|
log: createTestLog(),
|
|
coreGatewayHandlers: {},
|
|
baseMethods: [],
|
|
pluginIds: ["browser"],
|
|
logDiagnostics: false,
|
|
});
|
|
|
|
expect(loaded.gatewayMethods).toContain("browser.request");
|
|
expect(
|
|
loaded.pluginRegistry.services.some(
|
|
(entry) => entry.pluginId === "browser" && entry.service.id === "browser-control",
|
|
),
|
|
).toBe(true);
|
|
});
|
|
});
|