docs(browser): add an interaction example that captures the visible result (#750)
* docs(browser): add an interaction example that captures the visible result Fixes #728 Co-authored-by: Cursor <cursoragent@cursor.com> * docs(browser): wait for asynchronous search results before capture --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: N0zoM1z0 <1705004398@qq.com>
This commit is contained in:
co-authored by
Cursor
N0zoM1z0
parent
9a4e6da5a9
commit
91daaa68ae
@@ -64,22 +64,24 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
describe("canonical product catalog", () => {
|
||||
it("admits the documented minimal browser scenario through the named contract", async () => {
|
||||
it("admits every documented browser scenario through the named contract", async () => {
|
||||
const guide = await readFile(
|
||||
join(root, "docs/browser-scenario-contract.md"),
|
||||
"utf8",
|
||||
);
|
||||
const example = /```json\n([\s\S]*?)\n```/u.exec(guide)?.[1];
|
||||
if (example === undefined)
|
||||
throw new Error("Missing browser scenario example");
|
||||
const examples = [
|
||||
...guide.matchAll(/```json\r?\n([\s\S]*?)\r?\n```/gu),
|
||||
].map((match) => match[1] ?? "");
|
||||
expect(examples.length).toBeGreaterThanOrEqual(2);
|
||||
const contract = TOOL_CONTRACTS.find(
|
||||
({ name }) => name === "capture_browser_scenario",
|
||||
);
|
||||
if (contract === undefined)
|
||||
throw new Error("Missing browser scenario contract");
|
||||
expect(contract.inputSchema.safeParse(JSON.parse(example)).success).toBe(
|
||||
true,
|
||||
);
|
||||
for (const example of examples)
|
||||
expect(contract.inputSchema.safeParse(JSON.parse(example)).success).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it("matches every source-derived checked-in product fact", async () => {
|
||||
|
||||
Reference in New Issue
Block a user