test(ui): give the Studio hand-off spec a budget for the cold bundle load

The "a result made through a hand-off records which result it came from"
spec opens the Studio add-on straight from an address, twice. Each is a
cold load: the page shows "Loading" until the add-on module has run, and
the next assertion had the default five seconds. The load takes about
two seconds on an idle run and seven to ten under CPU load, so the spec
failed on a loaded machine with the hand-off note not yet drawn.

With the CPU throttled to 6x and eight busy loops running, it failed on
21 of 30 runs. The first assertion after each load now waits up to 20
seconds, and the spec then passed 30 of 30 under the same load. The
assertions are unchanged.

Assisted-by: Claude Code:claude-sonnet-5-5 playwright
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
Ettore Di Giacinto committed 2026-10-21 08:32:16 +00:00
1 parent 9f5c094fa6
commit 01c8aea108
1 file changed
+6 -2
@@ -329,8 +329,12 @@ test.describe('Studio composer: hand-off to the workspaces', () => {
await stubMedia(page)
await seedHistory(page, sampleHistory())
await page.route('**/video', route => route.fulfill({ json: { data: [{ url: '/generated-videos/new.mp4' }] } }))
// Both addresses below are cold loads of the Studio bundle: the page
// shows "Loading" until its module has run. That takes about two seconds
// here and over seven on a loaded machine, so the first assertion after
// each load gets a longer budget than the default five seconds.
await page.goto('/app/studio/video?prompt=Slow%20push-in&from=img-forest&edge=animate&model=wan2.1-t2v-1.3b')
await expect(page.locator('[data-testid="studio-handoff"]')).toHaveAttribute('data-status', 'ready')
await expect(page.locator('[data-testid="studio-handoff"]')).toHaveAttribute('data-status', 'ready', { timeout: 20_000 })
await page.getByRole('button', { name: /generate/i }).click()
await expect(page.locator('[data-testid="media-history-item"]').first()).toBeVisible()
await expect.poll(async () => (await readStore(page, 'localai_video_history'))?.[0]?.parentId).toBe('img-forest')
@@ -339,7 +343,7 @@ test.describe('Studio composer: hand-off to the workspaces', () => {
expect(saved.prompt).toBe('Slow push-in')
// And the front page now stacks the forest picture with its clip.
await page.goto('/app/studio')
await expect(page.locator('[data-testid="work-project"][data-id="img-forest"]')).toHaveAttribute('data-count', '2')
await expect(page.locator('[data-testid="work-project"][data-id="img-forest"]')).toHaveAttribute('data-count', '2', { timeout: 20_000 })
})
test('a result made without a hand-off records no link', async ({ page }) => {