feat: add immutable level template lifecycle

This commit is contained in:
2026-08-14 14:17:54 +02:00
parent 5599d330d8
commit c8a870549d
10 changed files with 386 additions and 26 deletions
+16
View File
@@ -86,4 +86,20 @@ test('move, folder expansion, hand pan, pinch zoom, and reload persistence', asy
await page.keyboard.up('Control')
await expect.poll(() => board.getAttribute('style')).not.toEqual(transformBeforePinch)
expect(await page.evaluate(() => ({ width: window.innerWidth, height: window.innerHeight, devicePixelRatio: window.devicePixelRatio }))).toEqual(browserMetricsBeforePinch)
page.once('dialog', dialog => dialog.accept('Browser Template'))
const templateSaved = page.waitForResponse(candidate => candidate.request().method() === 'POST' && candidate.url().includes('/templates?edit=1') && candidate.ok())
await page.getByRole('button', { name: 'SAVE TEMPLATE', exact: true }).click()
await templateSaved
await expect(page.locator('.terminal-status')).toContainText('VERSION 1')
let promptIndex = 0
const prompts = ['browser-template', 'Browser Template Clone']
const promptHandler = (dialog: { accept(promptText?: string): Promise<void> }) => dialog.accept(prompts[promptIndex++])
page.on('dialog', promptHandler)
await page.getByRole('button', { name: 'NEW FROM TEMPLATE', exact: true }).click()
await page.waitForURL(url => url.searchParams.get('level')?.startsWith('browser-template-') === true)
page.off('dialog', promptHandler)
await expect(page.getByRole('heading', { name: 'Browser Template Clone' })).toBeVisible()
await expect(page.getByRole('button', { name: 'Reset' })).toBeEnabled()
})