fix(settings): preserve safe job import compatibility and progress
This commit is contained in:
@@ -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"));
|
||||
|
||||
Reference in New Issue
Block a user