mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-02 02:01:33 +00:00
refactor(qa): migrate Telegram scenarios into QA Lab (#108430)
* refactor(qa): migrate Telegram scenarios into QA Lab * refactor(qa): remove retired Telegram runner exports
This commit is contained in:
@@ -80,35 +80,11 @@ function makeTelegramOutput({ includeReport = true, summary = {} } = {}) {
|
||||
]),
|
||||
);
|
||||
if (includeReport) {
|
||||
writeFileSync(path.join(dir, "telegram-qa-report.md"), "# Telegram QA\n\npass\n");
|
||||
writeFileSync(path.join(dir, "qa-suite-report.md"), "# Telegram QA\n\npass\n");
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
|
||||
function makeLegacyTelegramOutput() {
|
||||
const dir = mkdtempSync(path.join(tmpdir(), "mantis-telegram-evidence-test-"));
|
||||
tempDirs.push(dir);
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(
|
||||
path.join(dir, "telegram-qa-summary.json"),
|
||||
JSON.stringify({
|
||||
credentials: { source: "convex" },
|
||||
counts: { total: 1, passed: 1, failed: 0 },
|
||||
scenarios: [
|
||||
{
|
||||
id: "telegram-status-command",
|
||||
title: "Telegram status command reply",
|
||||
status: "pass",
|
||||
details: "Observed expected status response.",
|
||||
},
|
||||
],
|
||||
}),
|
||||
);
|
||||
writeFileSync(path.join(dir, "telegram-qa-observed-messages.json"), JSON.stringify([]));
|
||||
writeFileSync(path.join(dir, "telegram-qa-report.md"), "# Telegram QA\n\npass\n");
|
||||
return dir;
|
||||
}
|
||||
|
||||
describe("scripts/mantis/build-telegram-evidence", () => {
|
||||
it("renders redacted Telegram observed messages as a transcript HTML page", () => {
|
||||
const html = renderTelegramEvidenceHtml({
|
||||
@@ -202,21 +178,6 @@ describe("scripts/mantis/build-telegram-evidence", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("renders historical Telegram summaries when evidence summaries are absent", () => {
|
||||
const dir = makeLegacyTelegramOutput();
|
||||
|
||||
const result = writeTelegramEvidence(["--output-dir", dir]);
|
||||
|
||||
expect(readFileSync(result.transcriptPath, "utf8")).toContain("Telegram status command reply");
|
||||
expect(result.manifest.comparison.pass).toBe(true);
|
||||
expect(
|
||||
result.manifest.artifacts.find((artifact) => artifact.targetPath === "summary.json"),
|
||||
).toMatchObject({ path: "telegram-qa-summary.json" });
|
||||
expect(result.manifest.artifacts.map((artifact) => artifact.targetPath)).toContain(
|
||||
"observed-messages.json",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not fabricate a required report artifact for passing Telegram summaries", () => {
|
||||
const dir = makeTelegramOutput({ includeReport: false });
|
||||
|
||||
@@ -250,7 +211,7 @@ describe("scripts/mantis/build-telegram-evidence", () => {
|
||||
const result = writeTelegramEvidence(["--output-dir", dir]);
|
||||
|
||||
expect(result.manifest.comparison.pass).toBe(false);
|
||||
expect(readFileSync(path.join(dir, "telegram-qa-report.md"), "utf8")).toContain(
|
||||
expect(readFileSync(path.join(dir, "qa-suite-report.md"), "utf8")).toContain(
|
||||
"Telegram QA report was unavailable",
|
||||
);
|
||||
expect(loadEvidenceManifest(result.manifestPath).comparison.pass).toBe(false);
|
||||
|
||||
@@ -284,15 +284,15 @@ describe("package Telegram live Docker E2E", () => {
|
||||
|
||||
it("defaults package Telegram RTT for the normal package live lane", () => {
|
||||
expect(testing.resolveRttOptions({})).toEqual({
|
||||
rttCount: 20,
|
||||
rttTimeoutMs: undefined,
|
||||
maxRttFailures: 20,
|
||||
rttCheckIds: [],
|
||||
scenarioId: "channel-canary",
|
||||
count: 20,
|
||||
timeoutMs: 30_000,
|
||||
maxFailures: 20,
|
||||
});
|
||||
});
|
||||
|
||||
it("does not force default RTT onto focused non-RTT scenario runs", () => {
|
||||
expect(testing.resolveRttOptions({}, ["telegram-canary"])).toEqual({});
|
||||
expect(testing.resolveRttOptions({}, ["telegram-status-command"])).toBeUndefined();
|
||||
});
|
||||
|
||||
it("maps repeated RTT env onto package Telegram live options", () => {
|
||||
@@ -301,16 +301,40 @@ describe("package Telegram live Docker E2E", () => {
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_SAMPLES: "7",
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_TIMEOUT_MS: "45000",
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_MAX_FAILURES: "2",
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_CHECKS: "telegram-mentioned-message-reply",
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_CHECKS: "channel-canary",
|
||||
}),
|
||||
).toEqual({
|
||||
rttCount: 7,
|
||||
rttTimeoutMs: 45_000,
|
||||
maxRttFailures: 2,
|
||||
rttCheckIds: ["telegram-mentioned-message-reply"],
|
||||
scenarioId: "channel-canary",
|
||||
count: 7,
|
||||
timeoutMs: 45_000,
|
||||
maxFailures: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it("builds a generic suite probe for the Telegram RTT lane", () => {
|
||||
const probe = testing.createRoundTripProbe(testing.resolveRttOptions({}));
|
||||
|
||||
expect(probe).toMatchObject({
|
||||
scenarioId: "channel-canary",
|
||||
count: 20,
|
||||
timeoutMs: 30_000,
|
||||
markerPrefix: "QA-TELEGRAM-RTT",
|
||||
textPrefix: "@openclaw Telegram RTT check. Reply exactly: ",
|
||||
chainReplies: true,
|
||||
input: {
|
||||
conversation: { id: "telegram-rtt-room", kind: "group" },
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects retired RTT scenario ids", () => {
|
||||
expect(() =>
|
||||
testing.resolveRttOptions({
|
||||
OPENCLAW_NPM_TELEGRAM_RTT_CHECKS: "telegram-mentioned-message-reply",
|
||||
}),
|
||||
).toThrow("unknown Telegram QA RTT check: telegram-mentioned-message-reply");
|
||||
});
|
||||
|
||||
it("rejects invalid repeated RTT env", () => {
|
||||
expect(() =>
|
||||
testing.resolveRttOptions({
|
||||
|
||||
Reference in New Issue
Block a user