Skip to content

Commit 3bb190c

Browse files
authored
🤖 fix: make StreamError storybook story deterministic (#903)
Disable auto-retry in the StreamError story to show the deterministic 'Retry' button instead of a live countdown timer. The countdown was flaky in visual tests because it used `Date.now()` to calculate remaining time. _Generated with `mux`_
1 parent 5349cc6 commit 3bb190c

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/browser/stories/App.errors.stories.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
createFileEditTool,
1515
createStaticChatHandler,
1616
} from "./mockFactory";
17+
import { getAutoRetryKey } from "@/common/constants/storage";
1718
import { selectWorkspace, setupSimpleChatStory, setupCustomChatStory } from "./storyHelpers";
1819
import { createMockORPCClient } from "../../../.storybook/mocks/orpc";
1920

@@ -99,9 +100,13 @@ const LARGE_DIFF = [
99100
export const StreamError: AppStory = {
100101
render: () => (
101102
<AppWithMocks
102-
setup={() =>
103-
setupCustomChatStory({
104-
workspaceId: "ws-error",
103+
setup={() => {
104+
const workspaceId = "ws-error";
105+
// Disable auto-retry to show deterministic "Retry" button instead of countdown timer
106+
localStorage.setItem(getAutoRetryKey(workspaceId), JSON.stringify(false));
107+
108+
return setupCustomChatStory({
109+
workspaceId,
105110
chatHandler: (callback: (event: WorkspaceChatMessage) => void) => {
106111
setTimeout(() => {
107112
callback(
@@ -123,8 +128,8 @@ export const StreamError: AppStory = {
123128
// eslint-disable-next-line @typescript-eslint/no-empty-function
124129
return () => {};
125130
},
126-
})
127-
}
131+
});
132+
}}
128133
/>
129134
),
130135
};

0 commit comments

Comments
 (0)