fix(ci): stabilize browser bundled integration tests

This commit is contained in:
Peter Steinberger
2026-03-28 08:33:19 +00:00
parent a735a1a2d4
commit a631604247
4 changed files with 120 additions and 31 deletions

View File

@@ -1,5 +1,7 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
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 { clearPluginDiscoveryCache } from "../plugins/discovery.js";
import { clearPluginLoaderCache } from "../plugins/loader.js";
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
import { resetPluginRuntimeStateForTest } from "../plugins/runtime.js";
@@ -9,6 +11,7 @@ import { loadGatewayStartupPlugins } from "./server-plugin-bootstrap.js";
function resetPluginState() {
clearPluginLoaderCache();
clearPluginDiscoveryCache();
clearPluginManifestRegistryCache();
resetPluginRuntimeStateForTest();
}
@@ -23,12 +26,19 @@ function createTestLog() {
}
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", () => {