Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

test: template e2e tests follow the switched-off skill rule

AdityaUmale8e5fe0310044
diff --git a/server/cloud-team-templates.e2e.test.ts b/server/cloud-team-templates.e2e.test.ts
index 47fc883f47..01f459b895 100644
--- a/server/cloud-team-templates.e2e.test.ts
+++ b/server/cloud-team-templates.e2e.test.ts
@@ -59,6 +59,8 @@ beforeAll(async () => {
expect(seeded.status, JSON.stringify(seeded.body)).toBe(201);
reporter = seeded.body.bots[0];
expect((await as("olive", "PUT", `/api/bots/${reporter.id}/access`, { everyone: "chat", people: {} })).status).toBe(200);
+ // Skills from a template arrive switched off, and a template carries only switched-on ones.
+ expect((await as("olive", "PATCH", `/api/bots/${reporter.id}/skills/report`, { enabled: true })).status).toBe(200);
const skills = (await as("olive", "GET", `/api/bots/${reporter.id}/skills`)).body.skills;
expect(skills).toEqual([expect.objectContaining({ name: "report", files: ["scripts/report.py"] })]);
}, hostTimeout(240_000));
diff --git a/server/team-package-skills.e2e.test.ts b/server/team-package-skills.e2e.test.ts
index 064627c564..cebadac4a8 100644
--- a/server/team-package-skills.e2e.test.ts
+++ b/server/team-package-skills.e2e.test.ts
@@ -52,12 +52,14 @@ it("a bot template carries its skills, which arrive disabled; originals stay; a
method: "PATCH", body: JSON.stringify({ enabled: true }),
}, url);
const card = await post("/api/share/export", { botId: source.id });
- expect(card).toMatchObject({ scope: "bot", status: "draft", counts: { bots: 1, skills: 2 } });
+ expect(card).toMatchObject({ scope: "bot", status: "draft", counts: { bots: 1, skills: 1 } });
+ expect(card.skipped).toContain("skills switched off on the bot (skills[private-notes])");
const savedTo = mkdtempSync(join(tmpdir(), "omb-skill-template-"));
let copied;
try {
const saved = await post(`/api/share/${card.id}/save`, { path: savedTo });
expect(readFileSync(join(saved.path, "skills", "source-check", "SKILL.md"), "utf8")).toBe(sharedText);
+ expect(existsSync(join(saved.path, "skills", "private-notes"))).toBe(false);
copied = await post("/api/share/import", { path: saved.path });
} finally {
rmSync(savedTo, { recursive: true, force: true });
@@ -65,7 +67,7 @@ it("a bot template carries its skills, which arrive disabled; originals stay; a
const target = copied.bots.find((bot: { name: string }) => bot.name === "Package skill probe 2");
expect(target).toBeDefined();
expect((await request(`/api/bots/${target.id}/skills`, {}, url)).skills.map((skill: { name: string; enabled: boolean }) => [skill.name, skill.enabled]).sort())
- .toEqual([["private-notes", false], ["source-check", false]]);
+ .toEqual([["source-check", false]]);
await command("send", "--bot", target.id, "--text", "Confirm this isolated copy is ready.");
expect(await command("wait", "--bot", target.id, "--timeout", "30")).toMatchObject({ status: "settled" });
const messages = await command("messages", "--bot", target.id, "--limit", "10");