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

video-understanding.spec.ts

37 lines1.3 KB

1import { test, expect } from './fixtures'
2import {
3 sendMessage,
4 waitForResponse,
5 getLastAssistantMessage,
6 featureUrl,
7} from './helpers'
8import { providersFor } from './test-matrix'
9​
10// Agentic video understanding (geminiText). The route attaches a video content
11// part flagged `processing: 'agentic'`, so the adapter routes the turn through
12// Gemini's Interactions API instead of generateContent. aimock serves the
13// synchronous interaction natively: it extracts the text prompt, ignores the
14// video block, matches the fixture, and returns `output_text`.
15//
16// This is the integration assertion (the whole stack wires up and renders). The
17// routing itself (interactions.create vs generateContentStream) is pinned by
18// unit tests in `packages/ai-gemini/tests/agentic-video.test.ts`.
19for (const provider of providersFor('video-understanding')) {
20 test.describe(`${provider} -- video-understanding`, () => {
21 test('answers a question about an attached video', async ({
22 page,
23 testId,
24 aimockPort,
25 }) => {
26 await page.goto(
27 featureUrl(provider, 'video-understanding', testId, aimockPort),
28 )
29​
30 await sendMessage(page, '[video-understanding] describe this video')
31 await waitForResponse(page)
32​
33 const response = await getLastAssistantMessage(page)
34 expect(response).toContain('guitar')
35 })
36 })