test: add download mime, quality verification

This commit is contained in:
2026-09-26 03:33:09 +05:00
parent 746d6a6c8f
commit 712fd3cb2e
10 changed files with 181 additions and 33 deletions
+13
View File
@@ -1,3 +1,4 @@
import { readFile } from "node:fs/promises";
import {
expect,
type Download,
@@ -88,6 +89,18 @@ export async function downloadResultFile(page: Page): Promise<Download> {
return download;
}
export async function downloadResultBytes(
page: Page,
): Promise<{ name: string; bytes: Uint8Array }> {
const download = await downloadResultFile(page);
const path = await download.path();
if (!path) throw new Error("download path is unavailable");
return {
name: download.suggestedFilename(),
bytes: new Uint8Array(await readFile(path)),
};
}
export async function downloadResult(page: Page): Promise<string> {
return (await downloadResultFile(page)).suggestedFilename();
}