Initial rrweb SGrobot skill package
This commit is contained in:
28
tests/customer_callback_demo.test.mjs
Normal file
28
tests/customer_callback_demo.test.mjs
Normal file
@@ -0,0 +1,28 @@
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { generateSgRobotArtifacts } from "../scripts/generate_sgrobot_flow.mjs";
|
||||
|
||||
test("recorded customer callback flow generates SGrobot-compliant artifacts", async () => {
|
||||
const trace = JSON.parse(await readFile("examples/recordings/customer-callback-trace.json", "utf8"));
|
||||
const result = generateSgRobotArtifacts(trace, { defaultMode: "execute" });
|
||||
|
||||
const plan = result.files.get("plan_templates/rrweb-customer-callback-draft/PlanTemplate.toml");
|
||||
const skill = result.files.get(".sgclaw-workspace/skills/rrweb-customer-callback-draft-execute/SKILL.toml");
|
||||
const script = result.files.get(".sgclaw-workspace/skills/rrweb-customer-callback-draft-execute/scripts/execute_trace.js");
|
||||
const evidence = result.files.get(".sgclaw-workspace/skills/rrweb-customer-callback-draft-execute/trace.semantic.json");
|
||||
|
||||
assert.equal(result.summary.planId, "rrweb-customer-callback-draft");
|
||||
assert.equal(result.summary.skillName, "rrweb-customer-callback-draft-execute");
|
||||
assert.equal(result.summary.requiresApproval, true);
|
||||
assert.match(plan, /skills = \["browser\.open_url"\]/);
|
||||
assert.match(plan, /skills = \["rrweb-customer-callback-draft-execute"\]/);
|
||||
assert.match(plan, /requires_approval = true/);
|
||||
assert.match(skill, /kind = "sgbrowser_action"/);
|
||||
assert.match(skill, /command = "sgBrowserExcuteJsCodeByDomain"/);
|
||||
assert.match(skill, /script_path = "scripts\/execute_trace.js"/);
|
||||
assert.match(script, /"type": "select"/);
|
||||
assert.match(script, /"type": "fill"/);
|
||||
assert.match(script, /"risk": "write"/);
|
||||
assert.equal(JSON.parse(evidence).steps.length, 4);
|
||||
});
|
||||
Reference in New Issue
Block a user