Skip to content

Write HTML. Render video. Built for agents.

test(studio): the edit accuracy bench stops waiting on background lint and thumbnail images (#5899)

Miguel Ángel4c798f398dc3
diff --git a/packages/studio/tests/e2e/edit-accuracy/case.mjs b/packages/studio/tests/e2e/edit-accuracy/case.mjs
index 9e66cf8edb..dbe5139956 100644
--- a/packages/studio/tests/e2e/edit-accuracy/case.mjs
+++ b/packages/studio/tests/e2e/edit-accuracy/case.mjs
@@ -242,11 +242,13 @@ const STILL_MS = process.env.EDIT_ACCURACY_STILL_MS
: null;
export const STILL_FRAMES = 3;
-// The server's event stream stays open for the page's life; timeline thumbnails are rendered by the server
-// for the timeline strip, can take seconds, and never change the preview.
-const backgroundRequest = (request) =>
+// The server's event stream stays open for the page's life; timeline thumbnails and the background lint
+// behind the lint badge run on the server, can take seconds (lint over 15 s on a busy runner), and never
+// change the preview. A blob: load is page memory (a thumbnail's image) and can end with no event at all.
+export const backgroundRequest = (request) =>
request.resourceType() === "eventsource" ||
- /\/api\/projects\/[^/]+\/thumbnail\//.test(request.url());
+ request.url().startsWith("blob:") ||
+ /\/api\/projects\/[^/]+\/(thumbnail\/|lint(\?|$))/.test(request.url());
/**
* The Studio page's network, for the stillness check: requests in flight, a counter bumped by any request or
diff --git a/packages/studio/tests/e2e/edit-accuracy/settle.test.mjs b/packages/studio/tests/e2e/edit-accuracy/settle.test.mjs
index ba2b65fe68..c13b7f4ca4 100644
--- a/packages/studio/tests/e2e/edit-accuracy/settle.test.mjs
+++ b/packages/studio/tests/e2e/edit-accuracy/settle.test.mjs
@@ -4,6 +4,7 @@ import { join } from "node:path";
import { describe, expect, it } from "vitest";
import {
STILL_FRAMES,
+ backgroundRequest,
heldStill,
networkBusy,
seekBound,
@@ -98,6 +99,18 @@ describe("settling on the page's network", () => {
expect(unsettledBy(start, now)).toBe(true);
});
+ it("never waits on thumbnails, their blob images or background lint, which do not change the preview", () => {
+ const request = (url, type = "fetch") => ({ url: () => url, resourceType: () => type });
+ const api = "http://127.0.0.1:5910/api/projects/case";
+ expect(backgroundRequest(request(`${api}/lint`))).toBe(true);
+ expect(backgroundRequest(request(`${api}/thumbnail/index.html?t=3.00`))).toBe(true);
+ expect(backgroundRequest(request(`${api}/events`, "eventsource"))).toBe(true);
+ expect(backgroundRequest(request("blob:http://127.0.0.1:5910/7baf001f", "image"))).toBe(true);
+ expect(backgroundRequest(request(`${api}/preview`, "document"))).toBe(false);
+ expect(backgroundRequest(request(`${api}/files/index.html`))).toBe(false);
+ expect(backgroundRequest(request(`${api}/lint-rules`))).toBe(false);
+ });
+
it("waits for requests in live frames and for the server to announce each written file", () => {
const dir = mkdtempSync(join(tmpdir(), "edit-bench-net-"));
try {