Skip to content
Source
Sign inSign up
TanStack/ai
Open History to see the last commit

multimodal-image.spec.ts

38 lines1.0 KB

1import { test, expect } from './fixtures'
2import {
3 sendMessageWithImage,
4 waitForResponse,
5 getLastAssistantMessage,
6 featureUrl,
7} from './helpers'
8import { providersFor } from './test-matrix'
9import { fileURLToPath } from 'url'
10import path from 'path'
11​
12const __filename = fileURLToPath(import.meta.url)
13const __dirname = path.dirname(__filename)
14const testImagePath = path.resolve(__dirname, '../test-assets/guitar-meme.jpg')
15​
16for (const provider of providersFor('multimodal-image')) {
17 test.describe(`${provider} — multimodal-image`, () => {
18 test('describes an uploaded image', async ({
19 page,
20 testId,
21 aimockPort,
22 }) => {
23 await page.goto(
24 featureUrl(provider, 'multimodal-image', testId, aimockPort),
25 )
26​
27 await sendMessageWithImage(
28 page,
29 '[mmimage] describe this image',
30 testImagePath,
31 )
32 await waitForResponse(page)
33​
34 const response = await getLastAssistantMessage(page)
35 expect(response).toContain('guitar')
36 })
37 })