mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 15:50:46 +00:00
test: share matrix qa summary fixtures
This commit is contained in:
@@ -7,6 +7,72 @@ afterEach(() => {
|
|||||||
vi.useRealTimers();
|
vi.useRealTimers();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
type MatrixQaSummaryInput = Parameters<typeof liveTesting.buildMatrixQaSummary>[0];
|
||||||
|
type MatrixQaSummaryInputOverrides = Partial<Omit<MatrixQaSummaryInput, "timings">> & {
|
||||||
|
timings?: Partial<MatrixQaSummaryInput["timings"]>;
|
||||||
|
};
|
||||||
|
|
||||||
|
function buildMatrixQaSummaryInput(
|
||||||
|
overrides: MatrixQaSummaryInputOverrides = {},
|
||||||
|
): MatrixQaSummaryInput {
|
||||||
|
const timings: MatrixQaSummaryInput["timings"] = {
|
||||||
|
artifactWriteMs: 5,
|
||||||
|
canaryMs: 40,
|
||||||
|
harnessBootMs: 100,
|
||||||
|
initialGatewayBootMs: 200,
|
||||||
|
provisioningMs: 300,
|
||||||
|
scenarioGatewayBootMs: 50,
|
||||||
|
scenarioRestartGatewayMs: 60,
|
||||||
|
scenarioTransportInterruptMs: 70,
|
||||||
|
scenarios: [],
|
||||||
|
totalMs: 825,
|
||||||
|
...overrides.timings,
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
artifactPaths: {
|
||||||
|
observedEvents: "/tmp/observed.json",
|
||||||
|
report: "/tmp/report.md",
|
||||||
|
summary: "/tmp/summary.json",
|
||||||
|
},
|
||||||
|
checks: [{ name: "Matrix harness ready", status: "pass" }],
|
||||||
|
config: {
|
||||||
|
default: liveTesting.buildMatrixQaConfigSnapshot({
|
||||||
|
driverUserId: "@driver:matrix-qa.test",
|
||||||
|
observerUserId: "@observer:matrix-qa.test",
|
||||||
|
sutUserId: "@sut:matrix-qa.test",
|
||||||
|
topology: {
|
||||||
|
defaultRoomId: "!room:matrix-qa.test",
|
||||||
|
defaultRoomKey: "main",
|
||||||
|
rooms: [],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
scenarios: [],
|
||||||
|
},
|
||||||
|
finishedAt: "2026-04-10T10:05:00.000Z",
|
||||||
|
harness: {
|
||||||
|
baseUrl: "http://127.0.0.1:28008/",
|
||||||
|
composeFile: "/tmp/docker-compose.yml",
|
||||||
|
dmRoomIds: [],
|
||||||
|
image: "ghcr.io/matrix-construct/tuwunel:v1.5.1",
|
||||||
|
roomId: "!room:matrix-qa.test",
|
||||||
|
roomIds: ["!room:matrix-qa.test"],
|
||||||
|
serverName: "matrix-qa.test",
|
||||||
|
},
|
||||||
|
observedEventCount: 4,
|
||||||
|
scenarios: [],
|
||||||
|
startedAt: "2026-04-10T10:00:00.000Z",
|
||||||
|
sutAccountId: "sut",
|
||||||
|
userIds: {
|
||||||
|
driver: "@driver:matrix-qa.test",
|
||||||
|
observer: "@observer:matrix-qa.test",
|
||||||
|
sut: "@sut:matrix-qa.test",
|
||||||
|
},
|
||||||
|
...overrides,
|
||||||
|
timings,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
describe("matrix live qa runtime", () => {
|
describe("matrix live qa runtime", () => {
|
||||||
it("injects a temporary Matrix account into the QA gateway config", () => {
|
it("injects a temporary Matrix account into the QA gateway config", () => {
|
||||||
const baseCfg: OpenClawConfig = {
|
const baseCfg: OpenClawConfig = {
|
||||||
@@ -265,81 +331,38 @@ describe("matrix live qa runtime", () => {
|
|||||||
|
|
||||||
it("preserves negative-scenario artifacts in the Matrix summary", () => {
|
it("preserves negative-scenario artifacts in the Matrix summary", () => {
|
||||||
expect(
|
expect(
|
||||||
liveTesting.buildMatrixQaSummary({
|
liveTesting.buildMatrixQaSummary(
|
||||||
artifactPaths: {
|
buildMatrixQaSummaryInput({
|
||||||
observedEvents: "/tmp/observed.json",
|
|
||||||
report: "/tmp/report.md",
|
|
||||||
summary: "/tmp/summary.json",
|
|
||||||
},
|
|
||||||
checks: [{ name: "Matrix harness ready", status: "pass" }],
|
|
||||||
config: {
|
|
||||||
default: liveTesting.buildMatrixQaConfigSnapshot({
|
|
||||||
driverUserId: "@driver:matrix-qa.test",
|
|
||||||
observerUserId: "@observer:matrix-qa.test",
|
|
||||||
sutUserId: "@sut:matrix-qa.test",
|
|
||||||
topology: {
|
|
||||||
defaultRoomId: "!room:matrix-qa.test",
|
|
||||||
defaultRoomKey: "main",
|
|
||||||
rooms: [],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
scenarios: [],
|
|
||||||
},
|
|
||||||
finishedAt: "2026-04-10T10:05:00.000Z",
|
|
||||||
harness: {
|
|
||||||
baseUrl: "http://127.0.0.1:28008/",
|
|
||||||
composeFile: "/tmp/docker-compose.yml",
|
|
||||||
dmRoomIds: [],
|
|
||||||
image: "ghcr.io/matrix-construct/tuwunel:v1.5.1",
|
|
||||||
roomId: "!room:matrix-qa.test",
|
|
||||||
roomIds: ["!room:matrix-qa.test"],
|
|
||||||
serverName: "matrix-qa.test",
|
|
||||||
},
|
|
||||||
observedEventCount: 4,
|
|
||||||
scenarios: [
|
|
||||||
{
|
|
||||||
id: "matrix-mention-gating",
|
|
||||||
title: "Matrix room message without mention does not trigger",
|
|
||||||
status: "pass",
|
|
||||||
details: "no reply",
|
|
||||||
artifacts: {
|
|
||||||
actorUserId: "@driver:matrix-qa.test",
|
|
||||||
driverEventId: "$driver",
|
|
||||||
expectedNoReplyWindowMs: 8_000,
|
|
||||||
token: "MATRIX_QA_NOMENTION_TOKEN",
|
|
||||||
triggerBody: "reply with only this exact marker: MATRIX_QA_NOMENTION_TOKEN",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
startedAt: "2026-04-10T10:00:00.000Z",
|
|
||||||
sutAccountId: "sut",
|
|
||||||
timings: {
|
|
||||||
artifactWriteMs: 5,
|
|
||||||
canaryMs: 40,
|
|
||||||
harnessBootMs: 100,
|
|
||||||
initialGatewayBootMs: 200,
|
|
||||||
provisioningMs: 300,
|
|
||||||
scenarioGatewayBootMs: 50,
|
|
||||||
scenarioRestartGatewayMs: 60,
|
|
||||||
scenarioTransportInterruptMs: 70,
|
|
||||||
scenarios: [
|
scenarios: [
|
||||||
{
|
{
|
||||||
durationMs: 80,
|
|
||||||
gatewayBootMs: 0,
|
|
||||||
gatewayRestartMs: 0,
|
|
||||||
id: "matrix-mention-gating",
|
id: "matrix-mention-gating",
|
||||||
title: "Matrix room message without mention does not trigger",
|
title: "Matrix room message without mention does not trigger",
|
||||||
transportInterruptMs: 0,
|
status: "pass",
|
||||||
|
details: "no reply",
|
||||||
|
artifacts: {
|
||||||
|
actorUserId: "@driver:matrix-qa.test",
|
||||||
|
driverEventId: "$driver",
|
||||||
|
expectedNoReplyWindowMs: 8_000,
|
||||||
|
token: "MATRIX_QA_NOMENTION_TOKEN",
|
||||||
|
triggerBody: "reply with only this exact marker: MATRIX_QA_NOMENTION_TOKEN",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
totalMs: 905,
|
timings: {
|
||||||
},
|
scenarios: [
|
||||||
userIds: {
|
{
|
||||||
driver: "@driver:matrix-qa.test",
|
durationMs: 80,
|
||||||
observer: "@observer:matrix-qa.test",
|
gatewayBootMs: 0,
|
||||||
sut: "@sut:matrix-qa.test",
|
gatewayRestartMs: 0,
|
||||||
},
|
id: "matrix-mention-gating",
|
||||||
}),
|
title: "Matrix room message without mention does not trigger",
|
||||||
|
transportInterruptMs: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
totalMs: 905,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
),
|
||||||
).toMatchObject({
|
).toMatchObject({
|
||||||
counts: {
|
counts: {
|
||||||
total: 2,
|
total: 2,
|
||||||
@@ -363,78 +386,36 @@ describe("matrix live qa runtime", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("keeps failing Matrix scenario details and timings complete in summary + report output", () => {
|
it("keeps failing Matrix scenario details and timings complete in summary + report output", () => {
|
||||||
const summary = liveTesting.buildMatrixQaSummary({
|
const summary = liveTesting.buildMatrixQaSummary(
|
||||||
artifactPaths: {
|
buildMatrixQaSummaryInput({
|
||||||
observedEvents: "/tmp/observed.json",
|
observedEventCount: 6,
|
||||||
report: "/tmp/report.md",
|
|
||||||
summary: "/tmp/summary.json",
|
|
||||||
},
|
|
||||||
checks: [{ name: "Matrix harness ready", status: "pass" }],
|
|
||||||
config: {
|
|
||||||
default: liveTesting.buildMatrixQaConfigSnapshot({
|
|
||||||
driverUserId: "@driver:matrix-qa.test",
|
|
||||||
observerUserId: "@observer:matrix-qa.test",
|
|
||||||
sutUserId: "@sut:matrix-qa.test",
|
|
||||||
topology: {
|
|
||||||
defaultRoomId: "!room:matrix-qa.test",
|
|
||||||
defaultRoomKey: "main",
|
|
||||||
rooms: [],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
scenarios: [],
|
|
||||||
},
|
|
||||||
finishedAt: "2026-04-10T10:05:00.000Z",
|
|
||||||
harness: {
|
|
||||||
baseUrl: "http://127.0.0.1:28008/",
|
|
||||||
composeFile: "/tmp/docker-compose.yml",
|
|
||||||
dmRoomIds: [],
|
|
||||||
image: "ghcr.io/matrix-construct/tuwunel:v1.5.1",
|
|
||||||
roomId: "!room:matrix-qa.test",
|
|
||||||
roomIds: ["!room:matrix-qa.test"],
|
|
||||||
serverName: "matrix-qa.test",
|
|
||||||
},
|
|
||||||
observedEventCount: 6,
|
|
||||||
scenarios: [
|
|
||||||
{
|
|
||||||
id: "matrix-reaction-not-a-reply",
|
|
||||||
title: "Matrix reactions do not trigger a fresh bot reply",
|
|
||||||
status: "fail",
|
|
||||||
details: [
|
|
||||||
"unexpected SUT reply after reaction from @driver:matrix-qa.test",
|
|
||||||
"reaction event: $reaction",
|
|
||||||
"unexpected reply event: $reply",
|
|
||||||
].join("\n"),
|
|
||||||
},
|
|
||||||
],
|
|
||||||
startedAt: "2026-04-10T10:00:00.000Z",
|
|
||||||
sutAccountId: "sut",
|
|
||||||
timings: {
|
|
||||||
artifactWriteMs: 5,
|
|
||||||
canaryMs: 40,
|
|
||||||
harnessBootMs: 100,
|
|
||||||
initialGatewayBootMs: 200,
|
|
||||||
provisioningMs: 300,
|
|
||||||
scenarioGatewayBootMs: 50,
|
|
||||||
scenarioRestartGatewayMs: 60,
|
|
||||||
scenarioTransportInterruptMs: 70,
|
|
||||||
scenarios: [
|
scenarios: [
|
||||||
{
|
{
|
||||||
durationMs: 8_000,
|
|
||||||
gatewayBootMs: 0,
|
|
||||||
gatewayRestartMs: 0,
|
|
||||||
id: "matrix-reaction-not-a-reply",
|
id: "matrix-reaction-not-a-reply",
|
||||||
title: "Matrix reactions do not trigger a fresh bot reply",
|
title: "Matrix reactions do not trigger a fresh bot reply",
|
||||||
transportInterruptMs: 0,
|
status: "fail",
|
||||||
|
details: [
|
||||||
|
"unexpected SUT reply after reaction from @driver:matrix-qa.test",
|
||||||
|
"reaction event: $reaction",
|
||||||
|
"unexpected reply event: $reply",
|
||||||
|
].join("\n"),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
totalMs: 825,
|
timings: {
|
||||||
},
|
scenarios: [
|
||||||
userIds: {
|
{
|
||||||
driver: "@driver:matrix-qa.test",
|
durationMs: 8_000,
|
||||||
observer: "@observer:matrix-qa.test",
|
gatewayBootMs: 0,
|
||||||
sut: "@sut:matrix-qa.test",
|
gatewayRestartMs: 0,
|
||||||
},
|
id: "matrix-reaction-not-a-reply",
|
||||||
});
|
title: "Matrix reactions do not trigger a fresh bot reply",
|
||||||
|
transportInterruptMs: 0,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
totalMs: 825,
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
expect(summary).toMatchObject({
|
expect(summary).toMatchObject({
|
||||||
counts: {
|
counts: {
|
||||||
|
|||||||
Reference in New Issue
Block a user