mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 05:21:23 +00:00
perf(test): speed up screenshot normalization e2e fixture
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user