fix: storybook previews (#4504)

This commit is contained in:
Peng Xiao
2023-09-26 13:51:39 +08:00
committed by GitHub
parent 61044d91a8
commit 29fa237dfb

View File

@@ -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 = {