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

multimodal-document.spec.ts

38 lines1.0 KB

1import { test, expect } from './fixtures'
2import {
3 sendMessageWithDocument,
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 testDocumentPath = path.resolve(__dirname, '../test-assets/tiny.pdf')
15​
16for (const provider of providersFor('multimodal-document')) {
17 test.describe(`${provider} — multimodal-document`, () => {
18 test('answers a question about an uploaded PDF', async ({
19 page,
20 testId,
21 aimockPort,
22 }) => {
23 await page.goto(
24 featureUrl(provider, 'multimodal-document', testId, aimockPort),
25 )
26​
27 await sendMessageWithDocument(
28 page,
29 '[mmdocument] summarize this pdf',
30 testDocumentPath,
31 )
32 await waitForResponse(page)
33​
34 const response = await getLastAssistantMessage(page)
35 expect(response).toContain('blank page')
36 })
37 })