fix(engine): retry capture screenshot timeouts (#3641)

This commit is contained in:
Miguel Ángel
2026-09-04 23:15:14 +00:00
committed by GitHub
parent c8ddbe0a4b
commit f334b0e735
3 changed files with 12 additions and 0 deletions
@@ -6,6 +6,10 @@ describe("classifyCaptureFailure", () => {
["Target closed", "transient_browser"],
["Runtime.callFunctionOn timed out after 30000ms", "protocol_timeout"],
["Runtime.evaluate timed out", "protocol_timeout"],
[
"Page.captureScreenshot timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.",
"protocol_timeout",
],
["drawElement worker encode timed out (frame 42)", "protocol_timeout"],
["Waiting failed: 30000ms exceeded", "protocol_timeout"],
["JavaScript heap out of memory", "memory_exhaustion"],
@@ -57,6 +57,7 @@ const TRANSIENT_BROWSER_ERROR_PATTERNS = [
const PROTOCOL_TIMEOUT_PATTERNS = [
/Runtime\.callFunctionOn timed out/i,
/Runtime\.evaluate timed out/i,
/Page\.captureScreenshot timed out/i,
/HeadlessExperimental\.beginFrame timed out/i,
/drawElement worker encode timed out \(frame \d+\)/i,
/Protocol error[\s\S]*tim(?:ed|e) out/i,
@@ -1523,6 +1523,13 @@ describe("adaptive missing-frame retry helpers", () => {
new Error("[Parallel] Capture failed: Worker 1: HeadlessExperimental.beginFrame timed out"),
),
).toBe(true);
expect(
isRecoverableParallelCaptureError(
new Error(
"[Parallel] Capture failed: Worker 2: Page.captureScreenshot timed out. Increase the 'protocolTimeout' setting in launch/connect calls for a higher timeout if needed.",
),
),
).toBe(true);
expect(
isRecoverableParallelCaptureError(
new Error(