fix(settings): preserve safe job import compatibility and progress

This commit is contained in:
cesnimda
2026-10-20 09:30:05 +02:00
parent 5addcde1e2
commit 3028d8172c
16 changed files with 1348 additions and 39 deletions
+27 -1
View File
@@ -1,7 +1,33 @@
import { expect, test } from "@playwright/test";
import { expect, test, type BrowserContext } from "@playwright/test";
import { readFile } from "node:fs/promises";
const apiUrl = "http://localhost:5302/api";
const networkBoundaries = new WeakMap<BrowserContext, { abortedFontStylesheets: string[]; unexpectedExternalRequests: string[] }>();
test.beforeEach(async ({ context }) => {
const boundary = { abortedFontStylesheets: [] as string[], unexpectedExternalRequests: [] as string[] };
networkBoundaries.set(context, boundary);
await context.route("**/*", route => {
const request = route.request();
const url = new URL(request.url());
if (url.protocol === "https:" && url.hostname === "fonts.googleapis.com" && url.port === "" && url.pathname === "/css2" && request.method() === "GET" && request.resourceType() === "stylesheet") {
boundary.abortedFontStylesheets.push(url.href);
return route.abort();
}
if (["http:", "https:"].includes(url.protocol) && (!["localhost", "127.0.0.1", "[::1]"].includes(url.hostname) || !["3300", "5302"].includes(url.port))) {
boundary.unexpectedExternalRequests.push(`${request.method()} ${url.origin}${url.pathname}`);
return route.abort();
}
return route.continue();
});
});
test.afterEach(async ({ context }, info) => {
const boundary = networkBoundaries.get(context);
await info.attach("csv-export-network-boundary", { body: JSON.stringify(boundary), contentType: "application/json" });
expect(boundary?.unexpectedExternalRequests).toEqual([]);
networkBoundaries.delete(context);
});
test("CSV export has safe cells and headers, and browser download preserves its UTF-8 bytes", async ({ page }) => {
await page.addInitScript(() => window.localStorage.setItem("uiLanguage", "en"));