Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions apps/desktop/stories/app-shell.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,9 @@ export const PlanAndSwarmModeOn: Story = {
),
};

/** Settles the Skill refresh the Plan toggle below started. */
let releaseSkillRefresh: (() => void) | undefined;

function PlusMenuRefreshHarness() {
const [planModeActive, setPlanModeActive] = useState(false);
const [skillsLoading, setSkillsLoading] = useState(false);
Expand All @@ -1506,7 +1509,7 @@ function PlusMenuRefreshHarness() {
onPlanModeChange(active) {
setPlanModeActive(active);
setSkillsLoading(true);
window.setTimeout(() => setSkillsLoading(false), 150);
releaseSkillRefresh = () => setSkillsLoading(false);
},
}}
/>
Expand Down Expand Up @@ -1535,14 +1538,15 @@ export const PlusMenuDuringSkillRefresh: Story = {
expect(Math.abs(menu.getBoundingClientRect().height - height)).toBeLessThanOrEqual(0.5);

await userEvent.click(skillsRow);
await expect(menu).toBeVisible();
await waitFor(() => expect(menu).toBeVisible(), { timeout: 5_000 });
const editor = canvasElement.querySelector<HTMLElement>(
'.maka-composer-editor [contenteditable="true"]',
);
if (!editor) throw new Error('composer editor is missing');
await expect(editor).toHaveTextContent('');
await expect(page.queryByRole('listbox', { name: /技能/ })).not.toBeInTheDocument();

releaseSkillRefresh?.();
await waitFor(() => {
const settledRow = within(
page.getByRole('menu', { name: '添加上下文' }),
Expand All @@ -1553,9 +1557,10 @@ export const PlusMenuDuringSkillRefresh: Story = {
page.getByRole('menu', { name: '添加上下文' }),
).getByRole('menuitem', { name: /选择技能/ });
await userEvent.click(settledRow);
await expect(await page.findByRole('listbox', { name: /技能/ }, {
timeout: 5_000,
})).toBeVisible();
await waitFor(
() => expect(page.getByRole('listbox', { name: /技能/ })).toBeVisible(),
{ timeout: 5_000 },
);
},
};

Expand Down
7 changes: 4 additions & 3 deletions apps/desktop/stories/composer-slash-menu.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,9 @@ export const ContextSwitchStartsWithALoadingCatalog: Story = {
page.getByRole('menu', { name: '添加上下文' }),
).getByRole('menuitem', { name: /选择技能/ });
await userEvent.click(settledRow);
await expect(await page.findByRole('listbox', { name: /技能/ }, {
timeout: 5_000,
})).toBeVisible();
await waitFor(
() => expect(page.getByRole('listbox', { name: /技能/ })).toBeVisible(),
{ timeout: 5_000 },
);
},
};