Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix: storybook previews (#4504)

Peng Xiao29fa237dfbe5
diff --git a/apps/storybook/src/stories/core.stories.tsx b/apps/storybook/src/stories/core.stories.tsx
index b00b8bb247..9d55e461e2 100644
--- a/apps/storybook/src/stories/core.stories.tsx
+++ b/apps/storybook/src/stories/core.stories.tsx
@@ -89,21 +89,21 @@ export const WorkspaceList: StoryFn = () => {
return <FakeApp />;
};
WorkspaceList.play = async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
// click current-workspace
- await waitFor(
+ const currentWorkspace = await waitFor(
() => {
- assertExists(
- canvasElement.querySelector('[data-testid="current-workspace"]')
- );
+ assertExists(canvas.getByTestId('current-workspace'));
+ return canvas.getByTestId('current-workspace');
},
{
timeout: 5000,
}
);
- const currentWorkspace = canvasElement.querySelector(
- '[data-testid="current-workspace"]'
- ) as Element;
- await userEvent.click(currentWorkspace);
+
+ // todo: figure out why userEvent cannot click this element?
+ // await userEvent.click(currentWorkspace);
+ currentWorkspace.click();
};
WorkspaceList.decorators = [withRouter];
WorkspaceList.parameters = {
@@ -129,6 +129,14 @@ SearchPage.play = async ({ canvasElement }) => {
}
);
await userEvent.click(canvas.getByTestId('slider-bar-quick-search-button'));
+ await waitFor(
+ () => {
+ assertExists(screen.getByTestId('cmdk-quick-search'));
+ },
+ {
+ timeout: 3000,
+ }
+ );
};
SearchPage.decorators = [withRouter];
SearchPage.parameters = {