fix(storybook): fix test (#5325)

<img width="440" alt="image" src="https://github.com/toeverything/AFFiNE/assets/102217452/329f9c12-cc0b-4aae-9352-3811ab0a27a6">
This commit is contained in:
JimmFly
2023-12-18 13:36:56 +00:00
parent a1c9ac80d8
commit cef9e0539d
9 changed files with 41 additions and 30 deletions
+23 -17
View File
@@ -37,16 +37,17 @@ export const SettingPage: StoryFn = () => {
};
SettingPage.play = async ({ canvasElement, step }) => {
const canvas = within(canvasElement);
await waitFor(
() => {
assertExists(canvasElement.querySelector('v-line'));
},
{
timeout: 10000,
}
);
await waitFor(async () => {
assertExists(
document.body.querySelector(
'[data-testid="slider-bar-workspace-setting-button"]'
)
);
});
await step('click setting modal button', async () => {
await userEvent.click(canvas.getByTestId('settings-modal-trigger'));
await userEvent.click(
canvas.getByTestId('slider-bar-workspace-setting-button')
);
});
await waitFor(async () => {
assertExists(
@@ -120,14 +121,13 @@ export const SearchPage: StoryFn = () => {
};
SearchPage.play = async ({ canvasElement }) => {
const canvas = within(canvasElement);
await waitFor(
() => {
assertExists(canvasElement.querySelector('v-line'));
},
{
timeout: 10000,
}
);
await waitFor(async () => {
assertExists(
document.body.querySelector(
'[data-testid="slider-bar-quick-search-button"]'
)
);
});
await userEvent.click(canvas.getByTestId('slider-bar-quick-search-button'));
await waitFor(
() => {
@@ -153,6 +153,12 @@ export const ImportPage: StoryFn = () => {
};
ImportPage.play = async ({ canvasElement }) => {
const canvas = within(canvasElement);
await waitFor(async () => {
assertExists(
document.body.querySelector('[data-testid="sidebar-new-page-button"]')
);
});
await userEvent.click(canvas.getByTestId('sidebar-new-page-button'));
await waitFor(
() => {
assertExists(canvasElement.querySelector('v-line'));