// @ts-check // Lightweight constrained-device regression: the browser's 4 GB profile must // reduce shared batch concurrency before multiple audio/image operations run. const { test, expect } = require('@playwright/test'); test('4 GB browser profile caps shared batch concurrency at two', async ({ page }) => { await page.goto('/', { waitUntil: 'domcontentloaded' }); await page.waitForFunction(() => typeof window.runPool === 'function', null, { timeout: 15_000 }); const maxActive = await page.evaluate(async () => { Object.defineProperty(navigator, 'deviceMemory', { configurable: true, value: 4 }); let active = 0; let max = 0; await window.runPool(Array.from({ length: 8 }, (_, i) => i), async () => { active += 1; max = Math.max(max, active); await new Promise(resolve => setTimeout(resolve, 15)); active -= 1; }, 4); return max; }); expect(maxActive).toBeLessThanOrEqual(2); });