From 212da860a9af050c5baae10325cb0d92b67c2fd4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 14 Feb 2026 00:16:38 +0000 Subject: [PATCH] perf(test): speed up screenshot normalization e2e fixture --- src/browser/screenshot.e2e.test.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/browser/screenshot.e2e.test.ts b/src/browser/screenshot.e2e.test.ts index f317376bf15..114243896c6 100644 --- a/src/browser/screenshot.e2e.test.ts +++ b/src/browser/screenshot.e2e.test.ts @@ -1,14 +1,17 @@ -import crypto from "node:crypto"; import sharp from "sharp"; import { describe, expect, it } from "vitest"; import { normalizeBrowserScreenshot } from "./screenshot.js"; describe("browser screenshot normalization", () => { it("shrinks oversized images to <=2000x2000 and <=5MB", async () => { - const width = 2300; - const height = 2300; - const raw = crypto.randomBytes(width * height * 3); - const bigPng = await sharp(raw, { raw: { width, height, channels: 3 } }) + const bigPng = await sharp({ + create: { + width: 2100, + height: 2100, + channels: 3, + background: { r: 12, g: 34, b: 56 }, + }, + }) .png({ compressionLevel: 0 }) .toBuffer();