Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
  • Loading branch information
prklm10 committed Nov 26, 2024
1 parent a6816ce commit c8fa600
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export async function* withPage(percy, url, callback, retry, args) {
let retries = 3;
while (attempt < retries) {
try {
if (attempt > 0) {
log.warn(`Retrying Story: ${args?.snapshotName}`);
}
// provide discovery options that may impact how the page loads
let page = yield percy.browser.page({
networkIdleTimeout: percy.config.discovery.networkIdleTimeout,
Expand All @@ -170,7 +173,6 @@ export async function* withPage(percy, url, callback, retry, args) {
'}'
].join('\n')
), ...args);

try {
yield page.goto(url);
return yield* yieldTo(callback(page));
Expand Down Expand Up @@ -198,12 +200,10 @@ export async function* withPage(percy, url, callback, retry, args) {
// Add snapshotName to the error message
const snapshotName = args?.snapshotName;
if (snapshotName) {
error.message = `${error.message} - Snapshot Name: ${snapshotName}`;
error.message = `Snapshot Name: ${snapshotName}: \n${error.message}`;
}
throw error;
}
const message = `Retrying Story: ${args?.snapshotName}`;
log.warn(message);
}
}
}
Expand Down

0 comments on commit c8fa600

Please sign in to comment.