




















@@ -27,6 +27,13 @@ function describeFetchBody(body: BodyInit | null | undefined) {
2727return `[${body.constructor.name}]`;
2828}
292930+function phaseStatus(
31+phases: Array<{ name: string; status: string }>,
32+name: string,
33+): string | undefined {
34+return phases.find((phase) => phase.name === name)?.status;
35+}
36+3037describe("mantis Slack desktop smoke runtime", () => {
3138let repoRoot: string;
3239@@ -137,11 +144,11 @@ describe("mantis Slack desktop smoke runtime", () => {
137144.filter((entry) => entry.command === "rsync")
138145.flatMap((entry) => entry.args);
139146expect(rsyncArgs).not.toContain("--delete");
140-expect(rsyncArgs).toEqual(
141-expect.arrayContaining([
142- "crabbox@203.0.113.10:/tmp/openclaw-mantis-slack-desktop-2026-05-04T13-00-00-000Z/",
143- "crabbox@203.0.113.10:/tmp/openclaw-mantis-slack-desktop-2026-05-04T13-00-00-000Z/slack-qa/",
144-]),
147+expect(rsyncArgs).toContain(
148+"crabbox@203.0.113.10:/tmp/openclaw-mantis-slack-desktop-2026-05-04T13-00-00-000Z/",
149+);
150+expect(rsyncArgs).toContain(
151+"crabbox@203.0.113.10:/tmp/openclaw-mantis-slack-desktop-2026-05-04T13-00-00-000Z/slack-qa/",
145152);
146153await expect(fs.readFile(result.screenshotPath ?? "", "utf8")).resolves.toBe("png");
147154await expect(fs.readFile(result.videoPath ?? "", "utf8")).resolves.toBe("mp4");
@@ -151,24 +158,18 @@ describe("mantis Slack desktop smoke runtime", () => {
151158status: string;
152159timings: { phases: { name: string; status: string }[]; totalMs: number };
153160};
154-expect(summary).toMatchObject({
155-crabbox: {
156-id: "cbx_abc123",
157-vncCommand: "/tmp/crabbox vnc --provider hetzner --id cbx_abc123 --open",
158-},
159-hydrateMode: "source",
160-status: "pass",
161-});
162-expect(summary.timings.totalMs).toBeGreaterThanOrEqual(0);
163-expect(summary.timings.phases.map((phase) => phase.name)).toEqual(
164-expect.arrayContaining([
165-"crabbox.warmup",
166-"crabbox.inspect",
167-"credentials.prepare",
168-"crabbox.remote_run",
169-"artifacts.copy",
170-]),
161+expect(summary.crabbox.id).toBe("cbx_abc123");
162+expect(summary.crabbox.vncCommand).toBe(
163+"/tmp/crabbox vnc --provider hetzner --id cbx_abc123 --open",
171164);
165+expect(summary.hydrateMode).toBe("source");
166+expect(summary.status).toBe("pass");
167+expect(summary.timings.totalMs).toBeGreaterThanOrEqual(0);
168+expect(summary.timings.phases.map((phase) => phase.name)).toContain("crabbox.warmup");
169+expect(summary.timings.phases.map((phase) => phase.name)).toContain("crabbox.inspect");
170+expect(summary.timings.phases.map((phase) => phase.name)).toContain("credentials.prepare");
171+expect(summary.timings.phases.map((phase) => phase.name)).toContain("crabbox.remote_run");
172+expect(summary.timings.phases.map((phase) => phase.name)).toContain("artifacts.copy");
172173});
173174174175it("supports prehydrated remote workspaces without installing or building inside the VM", async () => {
@@ -319,28 +320,22 @@ describe("mantis Slack desktop smoke runtime", () => {
319320});
320321321322expect(result.status).toBe("pass");
322-expect(events).toEqual(
323-expect.arrayContaining([
324-"/tmp/crabbox:warmup",
325-"/tmp/crabbox:inspect",
326-"acquire",
327-"/tmp/crabbox:run",
328-"release",
329-]),
330-);
323+expect(events).toContain("/tmp/crabbox:warmup");
324+expect(events).toContain("/tmp/crabbox:inspect");
325+expect(events).toContain("acquire");
326+expect(events).toContain("/tmp/crabbox:run");
327+expect(events).toContain("release");
331328expect(events.indexOf("acquire")).toBeGreaterThan(events.indexOf("/tmp/crabbox:inspect"));
332329expect(events.indexOf("acquire")).toBeLessThan(events.indexOf("/tmp/crabbox:run"));
333330const runCommand = commands.find(
334331(entry) => entry.command === "/tmp/crabbox" && entry.args[0] === "run",
335332);
336-expect(runCommand?.env).toMatchObject({
337-OPENCLAW_MANTIS_SLACK_APP_TOKEN: "xapp-leased",
338-OPENCLAW_MANTIS_SLACK_BOT_TOKEN: "xoxb-leased",
339-OPENCLAW_MANTIS_SLACK_CHANNEL_ID: "CLEASED",
340-OPENCLAW_QA_SLACK_CHANNEL_ID: "CLEASED",
341-OPENCLAW_QA_SLACK_SUT_APP_TOKEN: "xapp-leased",
342-OPENCLAW_QA_SLACK_SUT_BOT_TOKEN: "xoxb-leased",
343-});
333+expect(runCommand?.env?.OPENCLAW_MANTIS_SLACK_APP_TOKEN).toBe("xapp-leased");
334+expect(runCommand?.env?.OPENCLAW_MANTIS_SLACK_BOT_TOKEN).toBe("xoxb-leased");
335+expect(runCommand?.env?.OPENCLAW_MANTIS_SLACK_CHANNEL_ID).toBe("CLEASED");
336+expect(runCommand?.env?.OPENCLAW_QA_SLACK_CHANNEL_ID).toBe("CLEASED");
337+expect(runCommand?.env?.OPENCLAW_QA_SLACK_SUT_APP_TOKEN).toBe("xapp-leased");
338+expect(runCommand?.env?.OPENCLAW_QA_SLACK_SUT_BOT_TOKEN).toBe("xoxb-leased");
344339const remoteScript = runCommand?.args.at(-1);
345340expect(remoteScript).toContain("setup_gateway=1");
346341expect(remoteScript).toContain("openclaw gateway run");
@@ -403,14 +398,14 @@ describe("mantis Slack desktop smoke runtime", () => {
403398});
404399405400expect(result.status).toBe("fail");
406-expect(commands).toEqual(
407-expect.arrayContaining([
408-expect.objectContaining({
409-args: ["stop", "--provider", "hetzner", "cbx_fade123"],
410-command: "/tmp/crabbox",
411-}),
412-]),
413-);
401+expect(
402+commands.some(
403+(entry) =>
404+entry.command === "/tmp/crabbox" &&
405+JSON.stringify(entry.args) ===
406+ JSON.stringify(["stop", "--provider", "hetzner", "cbx_fade123"]),
407+),
408+).toBe(true);
414409});
415410416411it("passes gateway setup when Crabbox returns non-zero after remote metadata proves success", async () => {
@@ -477,11 +472,7 @@ describe("mantis Slack desktop smoke runtime", () => {
477472};
478473expect(summary.status).toBe("pass");
479474expect(summary.warning).toBeUndefined();
480-expect(summary.timings.phases).toEqual(
481-expect.arrayContaining([
482-expect.objectContaining({ name: "crabbox.remote_run", status: "accepted" }),
483-]),
484-);
475+expect(phaseStatus(summary.timings.phases, "crabbox.remote_run")).toBe("accepted");
485476});
486477487478it("copies the screenshot before reporting a failed remote Slack QA run", async () => {
@@ -539,11 +530,7 @@ describe("mantis Slack desktop smoke runtime", () => {
539530expect(summary.status).toBe("fail");
540531expect(summary.hydrateMode).toBe("source");
541532expect(summary.timings.totalMs).toBeGreaterThanOrEqual(0);
542-expect(summary.timings.phases).toEqual(
543-expect.arrayContaining([
544-expect.objectContaining({ name: "crabbox.remote_run", status: "fail" }),
545-]),
546-);
533+expect(phaseStatus(summary.timings.phases, "crabbox.remote_run")).toBe("fail");
547534expect(summary.error).toContain("remote Slack QA failed");
548535expect(summary.artifacts.screenshotPath).toContain("slack-desktop-smoke.png");
549536expect(summary.artifacts.videoPath).toContain("slack-desktop-smoke.mp4");
@@ -597,20 +584,18 @@ describe("mantis Slack desktop smoke runtime", () => {
597584});
598585599586expect(result.status).toBe("pass");
600-expect(commands).toEqual(
601-expect.arrayContaining([
602-expect.objectContaining({
603-args: expect.arrayContaining(["--id", "tbx_abc-123_more"]),
604-command: "/tmp/crabbox",
605-}),
606-]),
607-);
587+expect(
588+commands.some(
589+(entry) =>
590+entry.command === "/tmp/crabbox" &&
591+entry.args.includes("--id") &&
592+ entry.args.includes("tbx_abc-123_more"),
593+),
594+).toBe(true);
608595const summary = JSON.parse(await fs.readFile(result.summaryPath, "utf8")) as {
609596crabbox: { id: string; provider: string };
610597};
611-expect(summary.crabbox).toMatchObject({
612-id: "tbx_abc-123_more",
613-provider: "blacksmith-testbox",
614-});
598+expect(summary.crabbox.id).toBe("tbx_abc-123_more");
599+expect(summary.crabbox.provider).toBe("blacksmith-testbox");
615600});
616601});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。