mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-04 13:07:11 +00:00
fix(cli): say a font or image URL is a download, not a page, when capture is given one (#6952)
* fix(cli): say a font or image URL is a download, not a page, when capture is given one * fix(cli): word the capture download hint as a likely cause, not a fact
This commit is contained in:
@@ -545,6 +545,17 @@ describe("a proxy that was in the way", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("tells a file URL apart from a page when the browser turns it into a download", async () => {
|
||||
const goto = vi
|
||||
.fn()
|
||||
.mockRejectedValue(new Error("net::ERR_ABORTED at https://cdn.example/arabic.woff2"));
|
||||
await expect(
|
||||
navigateForCapture({ goto }, "https://cdn.example/arabic.woff2", 120_000),
|
||||
).rejects.toThrow(
|
||||
/cdn\.example stopped loading as a page.*file download such as a font.*assets\/fonts.*net::ERR_ABORTED/,
|
||||
);
|
||||
});
|
||||
|
||||
it("leaves every other failure as it was", async () => {
|
||||
const name = new Error("net::ERR_NAME_NOT_RESOLVED at https://nope.example/");
|
||||
expect(explainProxyRefusal(name, "https://nope.example/")).toBe(name);
|
||||
|
||||
@@ -16,6 +16,8 @@ const PROXY_FAILURES = {
|
||||
`Your network's proxy refused the connection to ${host}. Ask whoever runs it to allow ${host}.`,
|
||||
"net::ERR_PROXY_CONNECTION_FAILED": () =>
|
||||
"Could not reach your network's proxy. Check the proxy address and that the proxy is running, or ask whoever runs it.",
|
||||
"net::ERR_ABORTED": (host: string) =>
|
||||
`${host} stopped loading as a page. This usually means the URL is a file download such as a font, not a web page. Capture a page that uses the file; its fonts are saved to assets/fonts.`,
|
||||
} as const;
|
||||
const PROXY_FAILURE = new RegExp(Object.keys(PROXY_FAILURES).join("|"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user