feat(web): collect multiple downloads from one trigger

Merged
RU
18d ago
+344-67
  • Adds browser.waitForDownloads(trigger, { count, timeout? }): runs the trigger once and saves the first count downloads in start order, each attached as a download artifact.
  • waitForDownload and waitForDownloads share one collectDownloads() (packages/web/src/browser.ts). One budget bounds start, completion and save, so a stalled single download now fails at its timeout instead of hanging.
  • On timeout or cancel it removes the listener, aborts saving, cancels started downloads, and attaches nothing late. Trigger errors keep their own classification.
const files = await browser.waitForDownloads(() => screen.getByRole('button', { name: 'Export all' }).click(), { count: 2 });

Verified

Ran it locally: yes

  • routes.test.ts (local Chromium) and provider-downloads.test.ts (remote provider disk): 1 and 2 files from one trigger, stalled HTTP body and stalled provider read fail with did not finish at the timeout, pending trigger cancels started downloads and attaches nothing, listener removed on every failure. On main the single-download stall cases hang past the timeout.
  • Full packages/web suite: 609 passed.