2
0

Add attachments option to text input (#1608)

Closes #854
This commit is contained in:
Baptiste Arnaud
2024-06-26 10:13:38 +02:00
committed by GitHub
parent 80da7af4f1
commit 6db0464fd7
88 changed files with 2959 additions and 735 deletions

View File

@ -13,7 +13,7 @@ import { StartChatInput, StartPreviewChatInput } from '@typebot.io/schemas'
test.afterEach(async () => {
await deleteWebhooks(['chat-webhook-id'])
await deleteTypebots(['chat-sub-bot'])
await deleteTypebots(['chat-sub-bot', 'starting-with-input'])
})
test('API chat execution should work on preview bot', async ({ request }) => {
@ -108,6 +108,13 @@ test('API chat execution should work on published bot', async ({ request }) => {
id: 'chat-sub-bot',
publicId: 'chat-sub-bot-public',
})
await importTypebotInDatabase(
getTestAsset('typebots/chat/startingWithInput.json'),
{
id: 'starting-with-input',
publicId: 'starting-with-input-public',
}
)
await createWebhook(typebotId, {
id: 'chat-webhook-id',
method: HttpMethod.GET,
@ -296,11 +303,12 @@ test('API chat execution should work on published bot', async ({ request }) => {
expect(messages[2].content.richText.length).toBeGreaterThan(0)
})
await test.step('Starting with a message when typebot starts with input should proceed', async () => {
const { messages } = await (
const response = await (
await request.post(
`/api/v1/typebots/starting-with-input-public/startChat`,
{
data: {
//@ts-expect-error We want to test if message is correctly preprocessed by zod
message: 'Hey',
isStreamEnabled: false,
isOnlyRegistering: false,
@ -309,7 +317,7 @@ test('API chat execution should work on published bot', async ({ request }) => {
}
)
).json()
expect(messages[0].content.richText).toStrictEqual([
expect(response.messages[0].content.richText).toStrictEqual([
{
children: [
{