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

interactions-video.spec.ts

76 lines2.4 KB

1import { test, expect } from './fixtures'
2import {
3 fillPrompt,
4 clickGenerate,
5 waitForGenerationComplete,
6 featureUrl,
7} from './helpers'
8import { providersFor } from './test-matrix'
9​
10// Gemini Omni Flash (gemini-omni-1.1-flash) video generation over the
11// Interactions API: create a background interaction → poll it by id →
12// receive the finished clip as inline base64 the adapter surfaces as a
13// data:video/mp4 URL. Backed by the geminiOmniVideoMount in global-setup.ts.
14for (const provider of providersFor('interactions-video')) {
15 test.describe(`${provider} -- interactions-video`, () => {
16 test('sse -- generates video via SSE connection', async ({
17 page,
18 testId,
19 aimockPort,
20 }) => {
21 await page.goto(
22 featureUrl(provider, 'interactions-video', testId, aimockPort, 'sse'),
23 )
24 await fillPrompt(page, 'a guitar being played in a store')
25 await clickGenerate(page)
26 await waitForGenerationComplete(page, 60_000)
27 const video = page.getByTestId('generated-video')
28 await expect(video).toBeVisible()
29 await expect(video).toHaveAttribute('src', /^data:video\/mp4;base64,/)
30 })
31​
32 test('http-stream -- generates video via HTTP stream', async ({
33 page,
34 testId,
35 aimockPort,
36 }) => {
37 await page.goto(
38 featureUrl(
39 provider,
40 'interactions-video',
41 testId,
42 aimockPort,
43 'http-stream',
44 ),
45 )
46 await fillPrompt(page, 'a guitar being played in a store')
47 await clickGenerate(page)
48 await waitForGenerationComplete(page, 60_000)
49 const video = page.getByTestId('generated-video')
50 await expect(video).toBeVisible()
51 await expect(video).toHaveAttribute('src', /^data:video\/mp4;base64,/)
52 })
53​
54 test('fetcher -- generates video via server function', async ({
55 page,
56 testId,
57 aimockPort,
58 }) => {
59 await page.goto(
60 featureUrl(
61 provider,
62 'interactions-video',
63 testId,
64 aimockPort,
65 'fetcher',
66 ),
67 )
68 await fillPrompt(page, 'a guitar being played in a store')
69 await clickGenerate(page)
70 await waitForGenerationComplete(page, 60_000)
71 const video = page.getByTestId('generated-video')
72 await expect(video).toBeVisible()
73 await expect(video).toHaveAttribute('src', /^data:video\/mp4;base64,/)
74 })
75 })