mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 14:30:45 +00:00
test: speed extension and contract scenarios
This commit is contained in:
@@ -325,6 +325,7 @@ describe("qa-lab server", () => {
|
||||
port: 0,
|
||||
repoRoot,
|
||||
embeddedGateway: "disabled",
|
||||
selfCheckWaitTimeoutMs: 1,
|
||||
});
|
||||
cleanups.push(async () => {
|
||||
await lab.stop();
|
||||
|
||||
@@ -244,6 +244,7 @@ export async function startQaLabServer(
|
||||
transportId: "qa-channel",
|
||||
outputPath: params?.outputPath,
|
||||
repoRoot,
|
||||
waitTimeoutMs: params?.selfCheckWaitTimeoutMs,
|
||||
});
|
||||
latestScenarioRun = withQaLabRunCounts({
|
||||
kind: "self-check",
|
||||
|
||||
@@ -55,6 +55,7 @@ export type QaLabServerStartParams = {
|
||||
autoKickoffTarget?: string;
|
||||
embeddedGateway?: string;
|
||||
sendKickoffOnStart?: boolean;
|
||||
selfCheckWaitTimeoutMs?: number;
|
||||
};
|
||||
|
||||
export type QaLabServerHandle = {
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { extractQaToolPayload } from "./extract-tool-payload.js";
|
||||
import type { QaScenarioDefinition } from "./scenario.js";
|
||||
|
||||
export function createQaSelfCheckScenario(): QaScenarioDefinition {
|
||||
export function createQaSelfCheckScenario(options?: {
|
||||
waitTimeoutMs?: number;
|
||||
}): QaScenarioDefinition {
|
||||
const waitTimeoutMs = options?.waitTimeoutMs ?? 5_000;
|
||||
return {
|
||||
name: "Synthetic Slack-class roundtrip",
|
||||
steps: [
|
||||
@@ -18,7 +21,7 @@ export function createQaSelfCheckScenario(): QaScenarioDefinition {
|
||||
kind: "message-text",
|
||||
textIncludes: "qa-echo: hello from qa",
|
||||
direction: "outbound",
|
||||
timeoutMs: 5_000,
|
||||
timeoutMs: waitTimeoutMs,
|
||||
});
|
||||
},
|
||||
},
|
||||
@@ -52,7 +55,7 @@ export function createQaSelfCheckScenario(): QaScenarioDefinition {
|
||||
kind: "message-text",
|
||||
textIncludes: "qa-echo: inside thread",
|
||||
direction: "outbound",
|
||||
timeoutMs: 5_000,
|
||||
timeoutMs: waitTimeoutMs,
|
||||
});
|
||||
return threadId;
|
||||
},
|
||||
|
||||
@@ -29,6 +29,7 @@ export async function runQaSelfCheckAgainstState(params: {
|
||||
outputPath?: string;
|
||||
repoRoot?: string;
|
||||
notes?: string[];
|
||||
waitTimeoutMs?: number;
|
||||
}): Promise<QaSelfCheckResult> {
|
||||
const startedAt = new Date();
|
||||
const transport = createQaTransportAdapter({
|
||||
@@ -36,16 +37,19 @@ export async function runQaSelfCheckAgainstState(params: {
|
||||
state: params.state,
|
||||
});
|
||||
params.state.reset();
|
||||
const scenarioResult = await runQaScenario(createQaSelfCheckScenario(), {
|
||||
state: params.state,
|
||||
performAction: async (action, args) =>
|
||||
await transport.handleAction({
|
||||
action,
|
||||
args,
|
||||
cfg: params.cfg,
|
||||
accountId: transport.accountId,
|
||||
}),
|
||||
});
|
||||
const scenarioResult = await runQaScenario(
|
||||
createQaSelfCheckScenario({ waitTimeoutMs: params.waitTimeoutMs }),
|
||||
{
|
||||
state: params.state,
|
||||
performAction: async (action, args) =>
|
||||
await transport.handleAction({
|
||||
action,
|
||||
args,
|
||||
cfg: params.cfg,
|
||||
accountId: transport.accountId,
|
||||
}),
|
||||
},
|
||||
);
|
||||
const checks = [
|
||||
{
|
||||
name: "QA self-check scenario",
|
||||
|
||||
Reference in New Issue
Block a user