
























@@ -3174,47 +3174,46 @@ describe("matrix live qa scenarios", () => {
3174317431753175const scenario = requireMatrixQaScenario("matrix-room-block-streaming");
317631763177-await expect(
3178-runMatrixQaScenario(scenario, {
3179-baseUrl: "http://127.0.0.1:28008/",
3180-canary: undefined,
3181-driverAccessToken: "driver-token",
3182-driverUserId: "@driver:matrix-qa.test",
3183-observedEvents: [],
3184-observerAccessToken: "observer-token",
3185-observerUserId: "@observer:matrix-qa.test",
3186-roomId: "!main:matrix-qa.test",
3187-restartGateway: undefined,
3188-syncState: {},
3189-sutAccessToken: "sut-token",
3190-sutUserId: "@sut:matrix-qa.test",
3191-timeoutMs: 8_000,
3192-topology: {
3193-defaultRoomId: "!main:matrix-qa.test",
3194-defaultRoomKey: "main",
3195-rooms: [
3196-{
3197-key: "block",
3198-kind: "group",
3199-memberRoles: ["driver", "observer", "sut"],
3200-memberUserIds: [
3201-"@driver:matrix-qa.test",
3202-"@observer:matrix-qa.test",
3203-"@sut:matrix-qa.test",
3204-],
3205-name: "Block",
3206-requireMention: true,
3207-roomId: "!block:matrix-qa.test",
3208-},
3209-],
3210-},
3211-}),
3212-).resolves.toMatchObject({
3213-artifacts: {
3214-blockEventIds: ["$block-one", "$block-two"],
3215-driverEventId: "$block-stream-trigger",
3177+const result = await runMatrixQaScenario(scenario, {
3178+baseUrl: "http://127.0.0.1:28008/",
3179+canary: undefined,
3180+driverAccessToken: "driver-token",
3181+driverUserId: "@driver:matrix-qa.test",
3182+observedEvents: [],
3183+observerAccessToken: "observer-token",
3184+observerUserId: "@observer:matrix-qa.test",
3185+roomId: "!main:matrix-qa.test",
3186+restartGateway: undefined,
3187+syncState: {},
3188+sutAccessToken: "sut-token",
3189+sutUserId: "@sut:matrix-qa.test",
3190+timeoutMs: 8_000,
3191+topology: {
3192+defaultRoomId: "!main:matrix-qa.test",
3193+defaultRoomKey: "main",
3194+rooms: [
3195+{
3196+key: "block",
3197+kind: "group",
3198+memberRoles: ["driver", "observer", "sut"],
3199+memberUserIds: [
3200+"@driver:matrix-qa.test",
3201+"@observer:matrix-qa.test",
3202+"@sut:matrix-qa.test",
3203+],
3204+name: "Block",
3205+requireMention: true,
3206+roomId: "!block:matrix-qa.test",
3207+},
3208+],
32163209},
32173210});
3211+const artifacts = result.artifacts as {
3212+blockEventIds?: unknown;
3213+driverEventId?: unknown;
3214+};
3215+expect(artifacts.blockEventIds).toEqual(["$block-one", "$block-two"]);
3216+expect(artifacts.driverEventId).toBe("$block-stream-trigger");
3218321732193218expect(sendTextMessage).toHaveBeenCalledWith({
32203219body: expect.stringContaining("Block streaming QA check"),
@@ -3225,12 +3224,7 @@ describe("matrix live qa scenarios", () => {
32253224expect(body).toMatch(
32263225/reply with exactly this two-line body and no extra text:\nMATRIX_QA_BLOCK_ONE_[A-F0-9]{8}\nMATRIX_QA_BLOCK_TWO_[A-F0-9]{8}$/,
32273226);
3228-expect(waitForRoomEvent).toHaveBeenNthCalledWith(
3229-2,
3230-expect.objectContaining({
3231-since: "driver-sync-block-one",
3232-}),
3233-);
3227+expect(waitForRoomEvent.mock.calls[1]?.[0]?.since).toBe("driver-sync-block-one");
32343228});
3235322932363230it("sends a real Matrix image attachment for image-understanding prompts", async () => {
@@ -3274,67 +3268,57 @@ describe("matrix live qa scenarios", () => {
3274326832753269const scenario = requireMatrixQaScenario("matrix-room-image-understanding-attachment");
327632703277-await expect(
3278-runMatrixQaScenario(scenario, {
3279-baseUrl: "http://127.0.0.1:28008/",
3280-canary: undefined,
3281-driverAccessToken: "driver-token",
3282-driverUserId: "@driver:matrix-qa.test",
3283-observedEvents: [],
3284-observerAccessToken: "observer-token",
3285-observerUserId: "@observer:matrix-qa.test",
3286-roomId: "!main:matrix-qa.test",
3287-restartGateway: undefined,
3288-syncState: {},
3289-sutAccessToken: "sut-token",
3290-sutUserId: "@sut:matrix-qa.test",
3291-timeoutMs: 8_000,
3292-topology: {
3293-defaultRoomId: "!main:matrix-qa.test",
3294-defaultRoomKey: "main",
3295-rooms: [
3296-{
3297-key: scenarioTesting.MATRIX_QA_MEDIA_ROOM_KEY,
3298-kind: "group",
3299-memberRoles: ["driver", "observer", "sut"],
3300-memberUserIds: [
3301-"@driver:matrix-qa.test",
3302-"@observer:matrix-qa.test",
3303-"@sut:matrix-qa.test",
3304-],
3305-name: "Media",
3306-requireMention: true,
3307-roomId: "!media:matrix-qa.test",
3308-},
3309-],
3310-},
3311-}),
3312-).resolves.toMatchObject({
3313-artifacts: {
3314-attachmentFilename: "red-top-blue-bottom.png",
3315-driverEventId: "$image-understanding-trigger",
3316-reply: {
3317-eventId: "$sut-image-reply",
3318-},
3271+const result = await runMatrixQaScenario(scenario, {
3272+baseUrl: "http://127.0.0.1:28008/",
3273+canary: undefined,
3274+driverAccessToken: "driver-token",
3275+driverUserId: "@driver:matrix-qa.test",
3276+observedEvents: [],
3277+observerAccessToken: "observer-token",
3278+observerUserId: "@observer:matrix-qa.test",
3279+roomId: "!main:matrix-qa.test",
3280+restartGateway: undefined,
3281+syncState: {},
3282+sutAccessToken: "sut-token",
3283+sutUserId: "@sut:matrix-qa.test",
3284+timeoutMs: 8_000,
3285+topology: {
3286+defaultRoomId: "!main:matrix-qa.test",
3287+defaultRoomKey: "main",
3288+rooms: [
3289+{
3290+key: scenarioTesting.MATRIX_QA_MEDIA_ROOM_KEY,
3291+kind: "group",
3292+memberRoles: ["driver", "observer", "sut"],
3293+memberUserIds: [
3294+"@driver:matrix-qa.test",
3295+"@observer:matrix-qa.test",
3296+"@sut:matrix-qa.test",
3297+],
3298+name: "Media",
3299+requireMention: true,
3300+roomId: "!media:matrix-qa.test",
3301+},
3302+],
33193303},
33203304});
3321-3322-expect(sendMediaMessage).toHaveBeenCalledWith(
3323-expect.objectContaining({
3324- body: expect.stringContaining("Image understanding check"),
3325- contentType: "image/png",
3326- fileName: "red-top-blue-bottom.png",
3327- kind: "image",
3328- mentionUserIds: ["@sut:matrix-qa.test"],
3329- roomId: "!media:matrix-qa.test",
3330- }),
3331-);
3332-expect(waitForRoomEvent).toHaveBeenNthCalledWith(
3333- 2,
3334- expect.objectContaining({
3335- since: "driver-sync-attachment",
3336- }),
3337-);
3305+ const artifacts = result.artifacts as {
3306+ attachmentFilename?: unknown;
3307+driverEventId?: unknown;
3308+reply?: { eventId?: unknown };
3309+};
3310+expect(artifacts.attachmentFilename).toBe("red-top-blue-bottom.png");
3311+expect(artifacts.driverEventId).toBe("$image-understanding-trigger");
3312+expect(artifacts.reply?.eventId).toBe("$sut-image-reply");
3313+3314+const mediaMessage = sendMediaMessage.mock.calls[0]?.[0];
3315+expect(String(mediaMessage?.body)).toContain("Image understanding check");
3316+expect(mediaMessage?.contentType).toBe("image/png");
3317+expect(mediaMessage?.fileName).toBe("red-top-blue-bottom.png");
3318+expect(mediaMessage?.kind).toBe("image");
3319+expect(mediaMessage?.mentionUserIds).toEqual(["@sut:matrix-qa.test"]);
3320+expect(mediaMessage?.roomId).toBe("!media:matrix-qa.test");
3321+expect(waitForRoomEvent.mock.calls[1]?.[0]?.since).toBe("driver-sync-attachment");
33383322});
3339332333403324it("waits for a real Matrix image attachment after image generation", async () => {
@@ -3372,50 +3356,52 @@ describe("matrix live qa scenarios", () => {
3372335633733357const scenario = requireMatrixQaScenario("matrix-room-generated-image-delivery");
337433583375-await expect(
3376-runMatrixQaScenario(scenario, {
3377-baseUrl: "http://127.0.0.1:28008/",
3378-canary: undefined,
3379-driverAccessToken: "driver-token",
3380-driverUserId: "@driver:matrix-qa.test",
3381-observedEvents: [],
3382-observerAccessToken: "observer-token",
3383-observerUserId: "@observer:matrix-qa.test",
3384-roomId: "!main:matrix-qa.test",
3385-restartGateway: undefined,
3386-syncState: {},
3387-sutAccessToken: "sut-token",
3388-sutUserId: "@sut:matrix-qa.test",
3389-timeoutMs: 8_000,
3390-topology: {
3391-defaultRoomId: "!main:matrix-qa.test",
3392-defaultRoomKey: "main",
3393-rooms: [
3394-{
3395-key: scenarioTesting.MATRIX_QA_MEDIA_ROOM_KEY,
3396-kind: "group",
3397-memberRoles: ["driver", "observer", "sut"],
3398-memberUserIds: [
3399-"@driver:matrix-qa.test",
3400-"@observer:matrix-qa.test",
3401-"@sut:matrix-qa.test",
3402-],
3403-name: "Media",
3404-requireMention: true,
3405-roomId: "!media:matrix-qa.test",
3406-},
3407-],
3408-},
3409-}),
3410-).resolves.toMatchObject({
3411-artifacts: {
3412-attachmentEventId: "$sut-image",
3413-attachmentFilename: "qa-lighthouse.png",
3414-attachmentKind: "image",
3415-attachmentMsgtype: "m.image",
3416-driverEventId: "$image-generate-trigger",
3359+const result = await runMatrixQaScenario(scenario, {
3360+baseUrl: "http://127.0.0.1:28008/",
3361+canary: undefined,
3362+driverAccessToken: "driver-token",
3363+driverUserId: "@driver:matrix-qa.test",
3364+observedEvents: [],
3365+observerAccessToken: "observer-token",
3366+observerUserId: "@observer:matrix-qa.test",
3367+roomId: "!main:matrix-qa.test",
3368+restartGateway: undefined,
3369+syncState: {},
3370+sutAccessToken: "sut-token",
3371+sutUserId: "@sut:matrix-qa.test",
3372+timeoutMs: 8_000,
3373+topology: {
3374+defaultRoomId: "!main:matrix-qa.test",
3375+defaultRoomKey: "main",
3376+rooms: [
3377+{
3378+key: scenarioTesting.MATRIX_QA_MEDIA_ROOM_KEY,
3379+kind: "group",
3380+memberRoles: ["driver", "observer", "sut"],
3381+memberUserIds: [
3382+"@driver:matrix-qa.test",
3383+"@observer:matrix-qa.test",
3384+"@sut:matrix-qa.test",
3385+],
3386+name: "Media",
3387+requireMention: true,
3388+roomId: "!media:matrix-qa.test",
3389+},
3390+],
34173391},
34183392});
3393+const artifacts = result.artifacts as {
3394+attachmentEventId?: unknown;
3395+attachmentFilename?: unknown;
3396+attachmentKind?: unknown;
3397+attachmentMsgtype?: unknown;
3398+driverEventId?: unknown;
3399+};
3400+expect(artifacts.attachmentEventId).toBe("$sut-image");
3401+expect(artifacts.attachmentFilename).toBe("qa-lighthouse.png");
3402+expect(artifacts.attachmentKind).toBe("image");
3403+expect(artifacts.attachmentMsgtype).toBe("m.image");
3404+expect(artifacts.driverEventId).toBe("$image-generate-trigger");
3419340534203406expect(sendTextMessage).toHaveBeenCalledWith({
34213407body: expect.stringContaining("/tool image_generate action=generate"),
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。