Skip to content

Commit

Permalink
chore(ui): add test for assistant with no files (#997)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewrisse authored Sep 6, 2024
1 parent cb0650d commit d9b9361
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/leapfrogai_ui/tests/chat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ test('it formats code in a code block and can copy the code', async ({ page }) =
});

// The skeleton only shows for assistant messages
// TODO -this test can be flaky if the backend is really fast and the loading-msg skeleton barely has time to be shown
test('it shows a loading skeleton when a response is pending', async ({ page, openAIClient }) => {
const assistant = await createAssistantWithApi({ openAIClient });

Expand All @@ -187,3 +188,25 @@ test('it shows a loading skeleton when a response is pending', async ({ page, op
await deleteActiveThread(page, openAIClient);
await deleteAssistantWithApi(assistant.id, openAIClient);
});

test('it can chat with an assistant that doesnt have files', async ({ page, openAIClient }) => {
const assistant = await createAssistantWithApi({ openAIClient });
expect(assistant.tool_resources?.file_search).not.toBeDefined(); // ensure the assistant has no files

await loadChatPage(page);

// Select assistant
await expect(page.getByTestId('assistants-select-btn')).not.toBeDisabled();
const assistantDropdown = page.getByTestId('assistants-select-btn');
await assistantDropdown.click();
await page.getByText(assistant!.name!).click();

const messages = page.getByTestId('message');
await sendMessage(page, newMessage1);
await waitForResponseToComplete(page);
await expect(messages).toHaveCount(2);

// Cleanup
await deleteActiveThread(page, openAIClient);
await deleteAssistantWithApi(assistant.id, openAIClient);
});

0 comments on commit d9b9361

Please sign in to comment.