mirror of
https://github.com/documenso/documenso.git
synced 2026-07-25 09:25:08 +10:00
fix: bulk download partial failure, abort, and race-safe e2e
- onSuccess now reports successful envelope ids so the parent clears
only those rows from selection instead of wiping all pages.
- Partial failures no longer auto-close the dialog; failed/unprocessed
ids stay selected for retry.
- Cancel button turns into Stop while downloading and aborts the batch
at the next envelope boundary.
- Replace dual waitForEvent('download') with a page.on collector +
expect.poll so both downloads are captured reliably.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { Download } from '@playwright/test';
|
||||
import { expect, test } from '@playwright/test';
|
||||
|
||||
import { seedDraftDocument } from '@documenso/prisma/seed/documents';
|
||||
@@ -133,17 +134,14 @@ test('[BULK_ACTIONS]: can bulk download multiple documents', async ({ page }) =>
|
||||
await expect(dialog.getByText('Bulk Test Doc 2')).toBeVisible();
|
||||
await expect(dialog.getByText('Draft').first()).toBeVisible();
|
||||
|
||||
const firstDownloadPromise = page.waitForEvent('download');
|
||||
const secondDownloadPromise = page.waitForEvent('download');
|
||||
const downloads: Download[] = [];
|
||||
page.on('download', (d) => downloads.push(d));
|
||||
|
||||
await dialog.getByRole('button', { name: 'Download' }).click();
|
||||
|
||||
const [firstDownload, secondDownload] = await Promise.all([
|
||||
firstDownloadPromise,
|
||||
secondDownloadPromise,
|
||||
]);
|
||||
await expect.poll(() => downloads.length, { timeout: 10_000 }).toBe(2);
|
||||
|
||||
expect([firstDownload.suggestedFilename(), secondDownload.suggestedFilename()]).toEqual(
|
||||
expect(downloads.map((d) => d.suggestedFilename())).toEqual(
|
||||
expect.arrayContaining(['Bulk Test Doc 1.pdf', 'Bulk Test Doc 2.pdf']),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user