mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 12:42:54 +00:00
Summary: - The branch documents friendly browser tab references across docs, the browser skill, CLI help, and tool schema descriptions, and adds tests for target reference resolution and tab alias behavior. - PR surface: Source +24, Tests +328, Docs +9. Total +361 across 21 files. - Reproducibility: yes. for the documentation mismatch by source inspection: current main supports friendly ta ... schema/help surfaces still emphasize raw CDP target ids. Runtime behavior itself is not a new failing path. Automerge notes: - PR branch already contained follow-up commit before automerge: refactor(browser): share tab reference CLI help Validation: - ClawSweeper review passed for head118af80b0b. - Required merge gates passed before the squash merge. Prepared head SHA:118af80b0bReview: https://github.com/openclaw/openclaw/pull/88393#issuecomment-4583558133 Co-authored-by: FMLS <kfliuyang@gmail.com> Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com> Approved-by: hxy91819 Co-authored-by: hxy91819 <8814856+hxy91819@users.noreply.github.com>
33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { BrowserToolSchema } from "./browser-tool.schema.js";
|
|
import { ACT_MAX_VIEWPORT_DIMENSION } from "./browser/act-policy.js";
|
|
|
|
type SchemaRecord = Record<string, { maximum?: number; properties?: SchemaRecord }>;
|
|
type SchemaProperty = {
|
|
description?: string;
|
|
maximum?: number;
|
|
properties?: SchemaRecord;
|
|
};
|
|
type BrowserSchemaRecord = Record<string, SchemaProperty>;
|
|
|
|
describe("browser tool schema", () => {
|
|
it("advertises the viewport resize maximum on nested and flattened act params", () => {
|
|
const properties = BrowserToolSchema.properties as SchemaRecord;
|
|
const requestProperties = properties.request.properties ?? {};
|
|
|
|
expect(properties.width.maximum).toBe(ACT_MAX_VIEWPORT_DIMENSION);
|
|
expect(properties.height.maximum).toBe(ACT_MAX_VIEWPORT_DIMENSION);
|
|
expect(requestProperties.width.maximum).toBe(ACT_MAX_VIEWPORT_DIMENSION);
|
|
expect(requestProperties.height.maximum).toBe(ACT_MAX_VIEWPORT_DIMENSION);
|
|
});
|
|
|
|
it("describes targetId as a compatible tab reference", () => {
|
|
const properties = BrowserToolSchema.properties as BrowserSchemaRecord;
|
|
const requestProperties = properties.request.properties as BrowserSchemaRecord;
|
|
|
|
expect(properties.targetId.description).toContain("Prefer suggestedTargetId");
|
|
expect(properties.targetId.description).toContain("raw CDP targetId");
|
|
expect(requestProperties.targetId.description).toBe(properties.targetId.description);
|
|
});
|
|
});
|