@ -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: [
|
||||
{
|
||||
|
Reference in New Issue
Block a user