feat: add artifact tests (#859)

This commit is contained in:
Jeremy 2025-03-11 14:39:36 -07:00 committed by GitHub
parent 9628c54755
commit 8e561dced4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 669 additions and 255 deletions

View file

@ -27,18 +27,25 @@ export class ChatPage {
}
async sendUserMessage(message: string) {
await this.page.getByTestId('multimodal-input').click();
await this.page.getByTestId('multimodal-input').fill(message);
await this.page.getByTestId('send-button').click();
await this.page.getByTestId('message-user').isVisible();
expect(await this.page.getByTestId('message-user').innerText()).toContain(
message,
);
await this.multimodalInput.click();
await this.multimodalInput.fill(message);
await this.sendButton.click();
}
async isGenerationComplete() {
await expect(this.page.getByTestId('send-button')).toBeVisible();
await this.page.waitForTimeout(2000);
const response = await this.page.waitForResponse((response) =>
response.url().includes('/api/chat'),
);
await response.finished();
}
async isVoteComplete() {
const response = await this.page.waitForResponse((response) =>
response.url().includes('/api/vote'),
);
await response.finished();
}
async hasChatIdInUrl() {
@ -123,21 +130,21 @@ export class ChatPage {
)
.catch(() => null);
const page = this.page;
return {
element: lastMessageElement,
content,
reasoning: reasoningElement,
async waitForGenerationComplete() {
await expect(page.getByTestId('send-button')).toBeVisible();
await page.waitForTimeout(2000);
},
async toggleReasoningVisibility() {
await lastMessageElement
.getByTestId('message-reasoning-toggle')
.click();
},
async upvote() {
await lastMessageElement.getByTestId('message-upvote').click();
},
async downvote() {
await lastMessageElement.getByTestId('message-downvote').click();
},
};
}