fix: update test content order (#961)

This commit is contained in:
Jeremy 2025-04-29 00:20:10 -07:00 committed by GitHub
parent 451a866c73
commit 845b40f7fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View file

@ -141,11 +141,12 @@ test.describe('Chat activity', () => {
test('Create message from url query', async ({ page }) => {
await page.goto('/?query=Why is the sky blue?');
const userMessage = await chatPage.getRecentUserMessage();
expect(userMessage.content).toBe('Why is the sky blue?');
await chatPage.isGenerationComplete();
const userMessage = await chatPage.getRecentUserMessage();
expect(userMessage.content).toBe('Why is the sky blue?');
const assistantMessage = await chatPage.getRecentAssistantMessage();
expect(assistantMessage.content).toContain("It's just blue duh!");
});

View file

@ -150,7 +150,11 @@ export class ChatPage {
async getRecentUserMessage() {
const messageElements = await this.page.getByTestId('message-user').all();
const lastMessageElement = messageElements[messageElements.length - 1];
const lastMessageElement = messageElements.at(-1);
if (!lastMessageElement) {
throw new Error('No user message found');
}
const content = await lastMessageElement
.getByTestId('message-content')