From c033c2c41b716ce0840c3b60f5ab171d266bdf89 Mon Sep 17 00:00:00 2001 From: Lee Teague Date: Mon, 16 Nov 2020 16:00:34 -0500 Subject: [PATCH] Bugfix: Navigation timeout of one URL should not kill the entire run --- src/main/comparisonJob.js | 61 ++++++++++++++---------- src/renderer/components/ComparisonJob.js | 12 +++-- 2 files changed, 43 insertions(+), 30 deletions(-) diff --git a/src/main/comparisonJob.js b/src/main/comparisonJob.js index e9a3d5e..f3ba072 100644 --- a/src/main/comparisonJob.js +++ b/src/main/comparisonJob.js @@ -613,31 +613,42 @@ const comparisonJob = async (job, callback) => { for (let urlSet of urlSets) { for (let i = 0; i < urlSet.urls.length; i++) { const startTime = new Date().getTime() - await takeShot( - browser, - (msg) => - callback({ - job: job, - status: 'running', - progressDetail: msg, - progressIndex: progressIndex, - progressTotal: progressTotal - }), - job.breakpoints, - projectId, - jobId, - i, - urlSet.side, - urlSet.urls[i], - urlSet.auth, - urlSet.spoofUrl, - job, - () => callback({ progressIndex: ++progressIndex, progressTotal: progressTotal }) - ) - const duration = new Date().getTime() - startTime - saveJobUrlDuration(projectId, jobId, urlSet.side, i, duration) - saveJobUrlComplete(projectId, jobId, urlSet.side, i, true) - callback({ job: job, status: 'running', progressDetail: `Captured ${urlSet.side} #${i} in ${duration}ms` }) + try { + await takeShot( + browser, + (msg) => + callback({ + job: job, + status: 'running', + progressDetail: msg, + progressIndex: progressIndex, + progressTotal: progressTotal + }), + job.breakpoints, + projectId, + jobId, + i, + urlSet.side, + urlSet.urls[i], + urlSet.auth, + urlSet.spoofUrl, + job, + () => callback({ progressIndex: ++progressIndex, progressTotal: progressTotal }) + ) + const duration = new Date().getTime() - startTime + saveJobUrlDuration(projectId, jobId, urlSet.side, i, duration) + saveJobUrlComplete(projectId, jobId, urlSet.side, i, true) + callback({ job: job, status: 'running', progressDetail: `Captured ${urlSet.side} #${i} in ${duration}ms` }) + } catch (error) { + const duration = new Date().getTime() - startTime + saveJobUrlDuration(projectId, jobId, urlSet.side, i, duration) + saveJobUrlComplete(projectId, jobId, urlSet.side, i, true) + callback({ + job: job, + status: 'running', + progressDetail: `Error ${urlSet.side} #${i} in ${duration}ms: ${error.message}` + }) + } } } } catch (error) { diff --git a/src/renderer/components/ComparisonJob.js b/src/renderer/components/ComparisonJob.js index a92254a..6092ff4 100644 --- a/src/renderer/components/ComparisonJob.js +++ b/src/renderer/components/ComparisonJob.js @@ -221,27 +221,29 @@ const ScreenshotTable = ({ activeBreakpoint, job, index, matches, leftUrl, right src={`file://${left.path}`} /> )) || - left.path} + 'Image Not Found'} - {diff.exists && ( + {(diff.exists && ( open(diff.path)} width={imageWidth} src={`file://${diff.path}`} /> - )} + )) || + 'Image Not Found'} - {right.exists && ( + {(right.exists && ( open(right.path)} width={imageWidth} src={`file://${right.path}`} /> - )} + )) || + 'Image Not Found'}