Skip to content

Commit ffaf52c

Browse files
committed
test(browser-extension): send the refused follow-up to the server directly, since the panel may already show the chat unavailable
1 parent 75e711a commit ffaf52c

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎apps/sim/scripts/test-browser-extension-e2e.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2330,12 +2330,19 @@ try {
23302330
await tx`update member set role = 'member' where organization_id = ${organizationId} and user_id = ${viewer}`
23312331
})
23322332
demoted = true
2333-
const followUp = chatPost()
2334-
await composer.fill('QA scoped follow-up')
2335-
await composer.press('Enter')
2336-
const refusal = (await followUp).status()
2333+
// The panel may already show the chat as unavailable once a refetch notices the lost
2334+
// access, so the follow-up goes to the server directly, in the panel's own request shape.
2335+
const followUp = await browserContext.request.post(`${base.origin}/api/mothership/chat`, {
2336+
headers: { origin: base.origin },
2337+
data: {
2338+
...payload,
2339+
message: 'QA scoped follow-up',
2340+
userMessageId: generateId(),
2341+
createNewChat: false,
2342+
},
2343+
})
23372344
// A workspace the sender cannot reach is not found to them, answered before any run.
2338-
assert.equal(refusal, 404, `The follow-up was answered ${refusal}`)
2345+
assert.equal(followUp.status(), 404, `The follow-up was answered ${followUp.status()}`)
23392346
// Refused, not re-scoped: no run under the organization, and the chat keeps its workspace.
23402347
assert.deepEqual(await runs(), [{ workspaceId: scopedWorkspaceId, organizationId: null }])
23412348
const [chat] = await sql<{ workspaceId: string | null; organizationId: string | null }[]>`

0 commit comments

Comments
 (0)