From a9316a032a6ea6d4f9e76398e96f2be049d7ef7b Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Sat, 19 Sep 2026 00:51:59 +0200 Subject: [PATCH] test : pin the server mode in the add menu a11y story The story asserts the add menu's first enabled item is the reasoning submenu, which is mounted only outside router mode. The vitest dev server proxies /props to whichever server is running, so the assertion depended on the machine's server mode and failed whenever a router was up. Pin the mode in the story, including props.role so a re-detection cannot flip it back. Assisted-by: pi:deepseek-ai/DeepSeek-V4.1-Flash --- .../a11y/ChatScreenForm.a11y.stories.svelte | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tools/ui/tests/stories/a11y/ChatScreenForm.a11y.stories.svelte b/tools/ui/tests/stories/a11y/ChatScreenForm.a11y.stories.svelte index 6fa5924e08..826e0d4aa1 100644 --- a/tools/ui/tests/stories/a11y/ChatScreenForm.a11y.stories.svelte +++ b/tools/ui/tests/stories/a11y/ChatScreenForm.a11y.stories.svelte @@ -2,8 +2,25 @@ import { defineMeta } from '@storybook/addon-svelte-csf'; import ChatScreenForm from '$lib/components/app/chat/ChatScreen/ChatScreenForm.svelte'; import { ATTACHMENT_TOOLTIP_TEXT } from '$lib/constants'; + import { ServerRole } from '$lib/enums'; + import { serverStore } from '$lib/stores'; + import type { ApiLlamaCppServerProps } from '$lib/types'; import { expect, screen, waitFor } from 'storybook/test'; + /** + * The add menu mounts the reasoning submenu only outside router mode, and the + * dev server proxies /props to whichever server happens to be running, so pin + * the mode this story asserts instead of inheriting it from the environment. + */ + function pinSingleModelMode(): void { + serverStore.props = { + ...(serverStore.props ?? {}), + role: ServerRole.MODEL + } as ApiLlamaCppServerProps; + + serverStore.role = ServerRole.MODEL; + } + const { Story } = defineMeta({ component: ChatScreenForm, parameters: { @@ -38,6 +55,8 @@ args={{ class: 'max-w-[56rem] w-[calc(100vw-2rem)]' }} name="AddDropdownFocusesFirstEnabled" play={async ({ canvas, userEvent }) => { + pinSingleModelMode(); + const trigger = await canvas.findByRole('button', { name: ATTACHMENT_TOOLTIP_TEXT }); trigger.focus();