Skip to content

Commit 5030f18

Browse files
committed
test(desktop): ring the doorbell until heard, and time claim and completion separately in the E2E
1 parent 383bce7 commit 5030f18

2 files changed

Lines changed: 19 additions & 6 deletions

File tree

‎apps/sim/lib/desktop/application/executor.integration.ts‎

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,11 +718,19 @@ describe.runIf(Boolean(redisUrl))('desktop background executor protocol', () =>
718718
const close = stream.subscribe((event, data) => heard.push({ event, data }))
719719
try {
720720
await expect.poll(() => isDesktopPresent(desktop.deviceId)).toBe(true)
721-
ringDesktopInbox(generateId(), 'call')
722-
ringDesktopInbox(desktop.deviceId, 'cancel')
721+
/**
722+
* A Redis subscription is acknowledged asynchronously, so each poll rings both devices
723+
* until this one hears it; the other device's doorbell must never reach this stream.
724+
*/
723725
await expect
724-
.poll(() => heard)
725-
.toEqual([{ event: 'inbox_changed', data: { reason: 'cancel' } }])
726+
.poll(() => {
727+
ringDesktopInbox(generateId(), 'call')
728+
ringDesktopInbox(desktop.deviceId, 'cancel')
729+
return heard.length
730+
})
731+
.toBeGreaterThan(0)
732+
expect(heard.every(({ data }) => data.reason === 'cancel')).toBe(true)
733+
expect(heard[0]).toEqual({ event: 'inbox_changed', data: { reason: 'cancel' } })
726734
} finally {
727735
close()
728736
}

‎apps/sim/scripts/test-desktop-inbox-e2e.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,16 @@ async function run() {
472472
{ silent: true }
473473
)
474474
await waitFor(
475-
() => executor.completed.has(toolCallId),
475+
() => executor.ran.has(toolCallId),
476476
PICKUP_GRACE_SECONDS * 1000,
477-
'the reconcile pull'
477+
'the reconcile pull to claim the call'
478478
)
479479
assert(Date.now() - issuedAt < PICKUP_GRACE_SECONDS * 1000)
480+
await waitFor(
481+
() => executor.completed.has(toolCallId),
482+
10_000,
483+
'the claimed call to complete'
484+
)
480485
const [row] = await callRows([toolCallId])
481486
assert.equal(row.status, 'completed')
482487
})

0 commit comments

Comments
 (0)