Skip to content

Commit

Permalink
Bugfix: Navigation timeout of one URL should not kill the entire run
Browse files Browse the repository at this point in the history
  • Loading branch information
lteague committed Nov 16, 2020
1 parent b319e5d commit c033c2c
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 30 deletions.
61 changes: 36 additions & 25 deletions src/main/comparisonJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/components/ComparisonJob.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,29 @@ const ScreenshotTable = ({ activeBreakpoint, job, index, matches, leftUrl, right
src={`file://${left.path}`}
/>
)) ||
left.path}
'Image Not Found'}
</TableCell>
<TableCell style={tableCellStyle}>
{diff.exists && (
{(diff.exists && (
<img
style={{ cursor: 'pointer' }}
onClick={() => open(diff.path)}
width={imageWidth}
src={`file://${diff.path}`}
/>
)}
)) ||
'Image Not Found'}
</TableCell>
<TableCell style={tableCellStyle}>
{right.exists && (
{(right.exists && (
<img
style={{ cursor: 'pointer' }}
onClick={() => open(right.path)}
width={imageWidth}
src={`file://${right.path}`}
/>
)}
)) ||
'Image Not Found'}
</TableCell>
</TableRow>
</TableBody>
Expand Down

0 comments on commit c033c2c

Please sign in to comment.