Open History to see the last commit
1import { test, expect } from './fixtures'
2import {
3 fillPrompt,
4 clickGenerate,
5 waitForGenerationComplete,
6 featureUrl,
7} from './helpers'
8import { providersFor } from './test-matrix'
9
10for (const provider of providersFor('image-gen')) {
11 test.describe(`${provider} -- image-gen`, () => {
12 test('sse -- generates images via SSE connection', async ({
13 page,
14 testId,
15 aimockPort,
16 }) => {
17 await page.goto(
18 featureUrl(provider, 'image-gen', testId, aimockPort, 'sse'),
19 )
20 await fillPrompt(page, 'a guitar in a music store')
21 await clickGenerate(page)
22 await waitForGenerationComplete(page)
23 const images = page.getByTestId('generated-image')
24 await expect(images).toHaveCount(1)
25 })
26
27 test('http-stream -- generates images via HTTP stream', async ({
28 page,
29 testId,
30 aimockPort,
31 }) => {
32 await page.goto(
33 featureUrl(provider, 'image-gen', testId, aimockPort, 'http-stream'),
34 )
35 await fillPrompt(page, 'a guitar in a music store')
36 await clickGenerate(page)
37 await waitForGenerationComplete(page)
38 const images = page.getByTestId('generated-image')
39 await expect(images).toHaveCount(1)
40 })
41
42 test('fetcher -- generates images via server function', async ({
43 page,
44 testId,
45 aimockPort,
46 }) => {
47 await page.goto(
48 featureUrl(provider, 'image-gen', testId, aimockPort, 'fetcher'),
49 )
50 await fillPrompt(page, 'a guitar in a music store')
51 await clickGenerate(page)
52 await waitForGenerationComplete(page)
53 const images = page.getByTestId('generated-image')
54 await expect(images).toHaveCount(1)
55 })
56 })
57}