File size: 2,280 Bytes
867b17d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
import { expect, test } from '../fixtures';
import { ChatPage } from '../pages/chat';
import { ArtifactPage } from '../pages/artifact';
test.describe('Artifacts activity', () => {
let chatPage: ChatPage;
let artifactPage: ArtifactPage;
test.beforeEach(async ({ page }) => {
chatPage = new ChatPage(page);
artifactPage = new ArtifactPage(page);
await chatPage.createNewChat();
});
test('Create a text artifact', async () => {
test.fixme();
await chatPage.createNewChat();
await chatPage.sendUserMessage(
'Help me write an essay about Silicon Valley',
);
await artifactPage.isGenerationComplete();
expect(artifactPage.artifact).toBeVisible();
const assistantMessage = await chatPage.getRecentAssistantMessage();
expect(assistantMessage.content).toBe(
'A document was created and is now visible to the user.',
);
await chatPage.hasChatIdInUrl();
});
test('Toggle artifact visibility', async () => {
test.fixme();
await chatPage.createNewChat();
await chatPage.sendUserMessage(
'Help me write an essay about Silicon Valley',
);
await artifactPage.isGenerationComplete();
expect(artifactPage.artifact).toBeVisible();
const assistantMessage = await chatPage.getRecentAssistantMessage();
expect(assistantMessage.content).toBe(
'A document was created and is now visible to the user.',
);
await artifactPage.closeArtifact();
await chatPage.isElementNotVisible('artifact');
});
test('Send follow up message after generation', async () => {
test.fixme();
await chatPage.createNewChat();
await chatPage.sendUserMessage(
'Help me write an essay about Silicon Valley',
);
await artifactPage.isGenerationComplete();
expect(artifactPage.artifact).toBeVisible();
const assistantMessage = await artifactPage.getRecentAssistantMessage();
expect(assistantMessage.content).toBe(
'A document was created and is now visible to the user.',
);
await artifactPage.sendUserMessage('Thanks!');
await artifactPage.isGenerationComplete();
const secondAssistantMessage = await chatPage.getRecentAssistantMessage();
expect(secondAssistantMessage.content).toBe("You're welcome!");
});
});
|