Open History to see the last commit
1import { test, expect } from './fixtures'
2import {
3 devtoolsUrl,
4 generationCard,
5 openDevtools,
6 selectHook,
7 waitForDevtoolsHarness,
8} from './devtools-helpers'
9
10test.beforeEach(async ({ page }) => {
11 await page.addInitScript(() => localStorage.clear())
12})
13
14test('narrow viewport keeps generation tabs, run cards, output pane, and modal usable', async ({
15 page,
16 testId,
17 aimockPort,
18}) => {
19 await page.setViewportSize({ width: 390, height: 820 })
20 await page.goto(devtoolsUrl('/devtools-generation-hooks', testId, aimockPort))
21 await waitForDevtoolsHarness(page)
22 await page.getByTestId('run-useGenerateImage').click()
23 await expect(
24 generationCard(page, 'useGenerateImage').getByTestId(
25 'generation-hook-status',
26 ),
27 ).toHaveText('success')
28
29 await openDevtools(page)
30 await selectHook(page, 'Image Studio')
31 await expect(page.getByTestId('ai-devtools-hook-tab')).toHaveText([
32 'Generation',
33 'State',
34 ])
35 await expect(page.getByTestId('ai-devtools-generation-run')).toBeVisible()
36 await expect(page.getByTestId('ai-devtools-preview-pane')).toBeVisible()
37 await expect(page.getByTestId('ai-devtools-generation-output')).toHaveCount(2)
38
39 await page.getByTestId('ai-devtools-generation-output').first().click()
40 await expect(page.getByTestId('ai-devtools-output-modal')).toBeVisible()
41 const modalBox = await page
42 .getByTestId('ai-devtools-output-modal')
43 .boundingBox()
44 expect(modalBox?.width).toBeLessThanOrEqual(390)
45 expect(modalBox?.height).toBeLessThanOrEqual(820)
46 await page.keyboard.press('Escape')
47 await expect(page.getByTestId('ai-devtools-output-modal')).toHaveCount(0)
48})