Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 41 additions & 7 deletions e2e/transfer-performance.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -550,13 +550,23 @@ test('pairs two devices and establishes a real transfer performance baseline', a

expect(senderTransfers).toHaveLength(files.length);
expect(receiverTransfers).toHaveLength(files.length);
await expect.poll(
() => devices.receiver.downloadCount,
{
message: 'Receiver completion did not produce exactly one download per file.',
timeout: 15_000
}
).toBe(receiverDownloadsInitial + files.length);
await devices.receiver.page.waitForTimeout(250);
expect(devices.receiver.downloadCount).toBe(receiverDownloadsInitial);

const readyDownloads = devices.receiver.page.locator(
'#received-files-list .received-file-item.is-ready'
);
await expect(readyDownloads).toHaveCount(files.length);
await expect(readyDownloads.locator('.received-file-status'))
.toHaveText(Array(files.length).fill('Ready to download'));

let secondPendingHref = null;
if (files.length === 2) {
const pendingHrefs = await readyDownloads.locator('.received-file-download')
.evaluateAll((links) => links.map((link) => link.href));
expect(new Set(pendingHrefs).size).toBe(2);
secondPendingHref = pendingHrefs[1];
}

for (let index = 0; index < files.length; index += 1) {
const expectedSize = files[index].buffer.length;
Expand Down Expand Up @@ -605,6 +615,30 @@ test('pairs two devices and establishes a real transfer performance baseline', a
expect(receiverSnapshot.sequence).toBeGreaterThan(receiverTransfers[index - 1].sequence);
}

const receivedRow = devices.receiver.page.locator(
'#received-files-list .received-file-item.is-ready',
{ hasText: files[index].name }
);
await expect(receivedRow).toHaveCount(1);
const downloadPromise = devices.receiver.page.waitForEvent('download');
await receivedRow.locator('.received-file-download').click();
const download = await downloadPromise;
expect(download.suggestedFilename()).toBe(files[index].name);
await expect(devices.receiver.page.locator(
'#received-files-list .received-file-item.is-downloaded',
{ hasText: files[index].name }
)).toContainText('Downloaded');
expect(devices.receiver.downloadCount).toBe(receiverDownloadsInitial + index + 1);

if (files.length === 2 && index === 0) {
const secondPendingDownload = devices.receiver.page.locator(
'#received-files-list .received-file-item.is-ready',
{ hasText: files[1].name }
).locator('.received-file-download');
await expect(secondPendingDownload).toBeVisible();
await expect(secondPendingDownload).toHaveAttribute('href', secondPendingHref);
}

reportIndex += 1;
await savePerformanceReport(
testInfo,
Expand Down
30 changes: 25 additions & 5 deletions public/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -330,15 +330,27 @@ <h3 data-i18n="transfer_completed">Transfer Completed!</h3>
<span id="completed-file-size">0 MB</span>
</div>
<div class="action-buttons">
<a id="btn-download" class="btn btn-primary" download>
<span data-i18n="btn_download">Download File</span>
</a>
<button id="btn-reset-transfer" class="btn btn-secondary">
<span data-i18n="btn_transfer_another">Transfer Another File</span>
</button>
</div>
</div>

<section id="received-files-card" class="received-files-card hidden"
aria-labelledby="received-files-title">
<div class="received-files-header">
<div>
<h3 id="received-files-title" data-i18n="received_files_title">Received files</h3>
<p id="received-files-summary" data-i18n="download_pending_files">Download pending files</p>
</div>
</div>
<div id="received-files-list" class="received-files-list" role="list"
aria-live="polite" aria-relevant="additions text"></div>
<button id="btn-receive-another" class="btn btn-secondary" type="button">
<span data-i18n="btn_transfer_another">Transfer another file</span>
</button>
</section>

</div>
</div>

Expand Down Expand Up @@ -447,7 +459,11 @@ <h3 data-i18n="transfer_completed">Transfer Completed!</h3>
btn_send_text: "Send Text",
history_title: "Session History",
transfer_completed: "Transfer Completed!",
btn_download: "Download File",
received_files_title: "Received files",
ready_to_download: "Ready to download",
btn_download: "Download",
downloaded: "Downloaded",
download_pending_files: "Download pending files",
btn_transfer_another: "Transfer Another File",
queue_title: "Review files",
queue_waiting: "files ready",
Expand Down Expand Up @@ -595,7 +611,11 @@ <h3 data-i18n="transfer_completed">Transfer Completed!</h3>
btn_send_text: "Enviar Texto",
history_title: "Historial de la Sesión",
transfer_completed: "¡Transferencia completada!",
btn_download: "Descargar archivo",
received_files_title: "Archivos recibidos",
ready_to_download: "Listo para descargar",
btn_download: "Descargar",
downloaded: "Descargado",
download_pending_files: "Descargar archivos pendientes",
btn_transfer_another: "Transferir otro archivo",
queue_title: "Revisa los archivos",
queue_waiting: "archivos listos",
Expand Down
Loading