mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 18:26:05 +08:00
fix(storybook): storybook flaky (#5430)
should add additional wait timeout for every story.play I think this is a storybook issue. It seems that it starts to run the plays as soon as the following shows up: 
This commit is contained in:
@@ -37,13 +37,18 @@ export const SettingPage: StoryFn = () => {
|
|||||||
};
|
};
|
||||||
SettingPage.play = async ({ canvasElement, step }) => {
|
SettingPage.play = async ({ canvasElement, step }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
await waitFor(async () => {
|
await waitFor(
|
||||||
assertExists(
|
async () => {
|
||||||
document.body.querySelector(
|
assertExists(
|
||||||
'[data-testid="slider-bar-workspace-setting-button"]'
|
document.body.querySelector(
|
||||||
)
|
'[data-testid="slider-bar-workspace-setting-button"]'
|
||||||
);
|
)
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timeout: 10000,
|
||||||
|
}
|
||||||
|
);
|
||||||
await step('click setting modal button', async () => {
|
await step('click setting modal button', async () => {
|
||||||
await userEvent.click(
|
await userEvent.click(
|
||||||
canvas.getByTestId('slider-bar-workspace-setting-button')
|
canvas.getByTestId('slider-bar-workspace-setting-button')
|
||||||
@@ -121,13 +126,18 @@ export const SearchPage: StoryFn = () => {
|
|||||||
};
|
};
|
||||||
SearchPage.play = async ({ canvasElement }) => {
|
SearchPage.play = async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
await waitFor(async () => {
|
await waitFor(
|
||||||
assertExists(
|
async () => {
|
||||||
document.body.querySelector(
|
assertExists(
|
||||||
'[data-testid="slider-bar-quick-search-button"]'
|
document.body.querySelector(
|
||||||
)
|
'[data-testid="slider-bar-quick-search-button"]'
|
||||||
);
|
)
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
{
|
||||||
|
timeout: 3000,
|
||||||
|
}
|
||||||
|
);
|
||||||
await userEvent.click(canvas.getByTestId('slider-bar-quick-search-button'));
|
await userEvent.click(canvas.getByTestId('slider-bar-quick-search-button'));
|
||||||
await waitFor(
|
await waitFor(
|
||||||
() => {
|
() => {
|
||||||
@@ -153,20 +163,20 @@ export const ImportPage: StoryFn = () => {
|
|||||||
};
|
};
|
||||||
ImportPage.play = async ({ canvasElement }) => {
|
ImportPage.play = async ({ canvasElement }) => {
|
||||||
const canvas = within(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(
|
await waitFor(
|
||||||
() => {
|
async () => {
|
||||||
assertExists(canvasElement.querySelector('v-line'));
|
assertExists(
|
||||||
|
document.body.querySelector('[data-testid="sidebar-new-page-button"]')
|
||||||
|
);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
await userEvent.click(canvas.getByTestId('sidebar-new-page-button'));
|
||||||
|
await waitFor(() => {
|
||||||
|
assertExists(canvasElement.querySelector('v-line'));
|
||||||
|
});
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
assertExists(
|
assertExists(
|
||||||
canvasElement.querySelector('[data-testid="header-dropDownButton"]')
|
canvasElement.querySelector('[data-testid="header-dropDownButton"]')
|
||||||
|
|||||||
Reference in New Issue
Block a user