Skip to content

Commit

Permalink
Update storybook integration to support v8
Browse files Browse the repository at this point in the history
  • Loading branch information
ahuth committed Mar 5, 2024
1 parent d063a34 commit 4453f88
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- [fix] Support Storybook v8

# 7.2.0 (2024-02-12)

- [new] Add `config` parameter, which is passed to `axe.configure` [#88](https://github.com/chanzuckerberg/axe-storybook-testing/pull/88)
Expand Down
8 changes: 4 additions & 4 deletions src/browser/StorybookPage.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type {PreviewWeb} from '@storybook/preview-api';
import type {PreviewWeb, StoryStore} from '@storybook/preview-api';
import type {Renderer, StoryIdentifier, Parameters} from '@storybook/types';
import pTimeout from 'p-timeout';
import type {Page} from 'playwright';
Expand Down Expand Up @@ -72,9 +72,7 @@ function fetchStoriesFromWindow(): Promise<StorybookStory[]> {
);
}

const storyStore = storybookPreview.storyStore;

return storyStore.cacheAllCSFFiles().then(() => {
return storybookPreview.extract().then(() => {
// Pick only the properties we need from Storybook's representation of a story.
//
// This is necessary because Playwright's `page.evaluate` requires return values to be JSON
Expand All @@ -96,6 +94,8 @@ function fetchStoriesFromWindow(): Promise<StorybookStory[]> {
};
}

const storyStore = storybookPreview.storyStore as StoryStore<Renderer>;

return storyStore
.raw()
.map(pickOnlyNecessaryAndSerializableStoryProperties);
Expand Down

0 comments on commit 4453f88

Please sign in to comment.