Skip to content

Commit

Permalink
addressing comments
Browse files Browse the repository at this point in the history
test fix

test fix

test fix

test fix

test fix

test fix
  • Loading branch information
prklm10 committed Nov 26, 2024
1 parent c8fa600 commit 2ab8fdc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export async function* withPage(percy, url, callback, retry, args) {
while (attempt < retries) {
try {
if (attempt > 0) {
log.warn(`Retrying Story: ${args?.snapshotName}`);
log.warn(`Retrying Story: ${args?.snapshotName}, attempt: ${attempt}`);
}
// provide discovery options that may impact how the page loads
let page = yield percy.browser.page({
Expand Down
20 changes: 14 additions & 6 deletions test/storybook.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,15 @@ describe('percy storybook', () => {

await expectAsync(storybook(['http://localhost:8000']))
// message contains the client stack trace
.toBeRejectedWithError(/^Story Error\n.*\/iframe\.html.*$/s);
.toBeRejectedWithError(/^Snapshot Name:/s);

expect(logger.stderr).toEqual([
'[percy] Build not created',
// message contains the client stack trace
jasmine.stringMatching(/^\[percy\] Error: Story Error\n.*\/iframe\.html.*$/s)
jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
)

]);
});

Expand Down Expand Up @@ -223,7 +226,9 @@ describe('percy storybook', () => {
expect(logger.stderr).toEqual([
'[percy] Failed to capture story: foo: bar',
// error logs contain the client stack trace
jasmine.stringMatching(/^\[percy\] Error: Story Error\n.*\/iframe\.html.*$/s),
jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
),
// does not create a build if all stories failed [ 1 in this case ]
'[percy] Build not created'
]);
Expand Down Expand Up @@ -269,11 +274,14 @@ describe('percy storybook', () => {

// contains logs of story error
expect(logger.stderr).toEqual([
'[percy] Retrying Story: foo: bar',
'[percy] Retrying Story: foo: bar',
'[percy] Retrying Story: foo: bar, attempt: 1',
'[percy] Retrying Story: foo: bar, attempt: 2',
'[percy] Failed to capture story: foo: bar',
// error logs contain the client stack trace
jasmine.stringMatching(/^\[percy\] Error: Story Error\n.*\/iframe\.html.*$/s),
jasmine.stringMatching(
/^\[percy\] Error: Snapshot Name:/s
),

// does not create a build if all stories failed [ 1 in this case ]
'[percy] Build not created'
]);
Expand Down

0 comments on commit 2ab8fdc

Please sign in to comment.