chore: organize tests and tweak stream delays (#942)

This commit is contained in:
Jeremy 2025-04-20 22:27:20 -07:00 committed by GitHub
parent 020494f63b
commit 6e16f3b30a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 21 additions and 21 deletions

View file

@ -1,62 +0,0 @@
import { ChatPage } from './pages/chat';
import { test, expect } from '@playwright/test';
test.describe('chat activity with reasoning', () => {
let chatPage: ChatPage;
test.beforeEach(async ({ page }) => {
chatPage = new ChatPage(page);
await chatPage.createNewChat();
});
test('send user message and generate response with reasoning', async () => {
await chatPage.sendUserMessage('Why is the sky blue?');
await chatPage.isGenerationComplete();
const assistantMessage = await chatPage.getRecentAssistantMessage();
expect(assistantMessage.content).toBe("It's just blue duh!");
expect(assistantMessage.reasoning).toBe(
'The sky is blue because of rayleigh scattering!',
);
});
test('toggle reasoning visibility', async () => {
await chatPage.sendUserMessage('Why is the sky blue?');
await chatPage.isGenerationComplete();
const assistantMessage = await chatPage.getRecentAssistantMessage();
const reasoningElement =
assistantMessage.element.getByTestId('message-reasoning');
expect(reasoningElement).toBeVisible();
await assistantMessage.toggleReasoningVisibility();
await expect(reasoningElement).not.toBeVisible();
await assistantMessage.toggleReasoningVisibility();
await expect(reasoningElement).toBeVisible();
});
test('edit message and resubmit', async () => {
await chatPage.sendUserMessage('Why is the sky blue?');
await chatPage.isGenerationComplete();
const assistantMessage = await chatPage.getRecentAssistantMessage();
const reasoningElement =
assistantMessage.element.getByTestId('message-reasoning');
expect(reasoningElement).toBeVisible();
const userMessage = await chatPage.getRecentUserMessage();
await userMessage.edit('Why is grass green?');
await chatPage.isGenerationComplete();
const updatedAssistantMessage = await chatPage.getRecentAssistantMessage();
expect(updatedAssistantMessage.content).toBe("It's just green duh!");
expect(updatedAssistantMessage.reasoning).toBe(
'Grass is green because of chlorophyll absorption!',
);
});
});