

























@@ -181,6 +181,7 @@ type DiscordQaScenarioResult = {
181181title: string;
182182status: "pass" | "fail";
183183details: string;
184+rttMs?: number;
184185};
185186186187type DiscordQaRunResult = {
@@ -764,6 +765,18 @@ function normalizeDiscordReactionSnapshot(params: {
764765};
765766}
766767768+function computeDiscordRttMs(triggerTimestamp?: string, replyTimestamp?: string) {
769+if (!triggerTimestamp || !replyTimestamp) {
770+return undefined;
771+}
772+const triggerAtMs = Date.parse(triggerTimestamp);
773+const replyAtMs = Date.parse(replyTimestamp);
774+if (!Number.isFinite(triggerAtMs) || !Number.isFinite(replyAtMs)) {
775+return undefined;
776+}
777+return Math.max(0, Math.round(replyAtMs - triggerAtMs));
778+}
779+767780function collectSeenReactionSequence(
768781snapshots: readonly DiscordReactionSnapshot[],
769782expectedSequence: readonly string[],
@@ -1766,13 +1779,15 @@ export async function runDiscordQaLive(params: {
17661779expectedTextIncludes: scenarioRun.expectedTextIncludes,
17671780message: matched.message,
17681781});
1782+const rttMs = computeDiscordRttMs(sent.timestamp, matched.message.timestamp);
17691783scenarioResults.push({
17701784id: scenario.id,
17711785title: scenario.title,
17721786status: "pass",
17731787details: redactPublicMetadata
17741788 ? "reply matched"
17751789 : `reply message ${matched.message.messageId} matched`,
1790+ ...(rttMs === undefined ? {} : { rttMs }),
17761791});
17771792} catch (error) {
17781793if (scenarioRun.kind === "channel-message" && !scenarioRun.expectReply) {
@@ -1931,6 +1946,7 @@ export const __testing = {
19311946 buildDiscordQaConfig,
19321947 buildDiscordWebMessageUrl,
19331948 buildObservedMessagesArtifact,
1949+ computeDiscordRttMs,
19341950 findScenario,
19351951 getCurrentDiscordUser,
19361952 getChannelMessage,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。