Skip to content

Commit 5a16e50

Browse files
committed
🤖 fix: make stats tab story tests robust
Change-Id: Ia5c3059029d8ccf30a437978b436f010e283b302 Signed-off-by: Thomas Kosiewski <[email protected]>
1 parent c328040 commit 5a16e50

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/browser/contexts/FeatureFlagsContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function isStorybook(): boolean {
1414

1515
const params = new URLSearchParams(window.location.search);
1616
const path = params.get("path");
17-
if (path && path.startsWith("/story/")) {
17+
if (path?.startsWith("/story/")) {
1818
return true;
1919
}
2020

src/browser/stories/App.rightsidebar.stories.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export const StatsTabIdle: AppStory = {
227227
const canvas = within(canvasElement);
228228

229229
// Feature flags are async, so allow more time.
230-
const statsTab = await canvas.findByRole("tab", { name: /^stats$/i }, { timeout: 3000 });
230+
const statsTab = await canvas.findByRole("tab", { name: /^stats/i }, { timeout: 3000 });
231231
await userEvent.click(statsTab);
232232

233233
await waitFor(() => {
@@ -264,12 +264,12 @@ export const StatsTabStreaming: AppStory = {
264264
const canvas = within(canvasElement);
265265

266266
// Feature flags are async; wait for Stats tab to appear, then select it.
267-
const statsTab = await canvas.findByRole("tab", { name: /^stats$/i }, { timeout: 5000 });
267+
const statsTab = await canvas.findByRole("tab", { name: /^stats/i }, { timeout: 5000 });
268268
await userEvent.click(statsTab);
269269

270270
await waitFor(
271271
() => {
272-
canvas.getByRole("tab", { name: /^stats$/i, selected: true });
272+
canvas.getByRole("tab", { name: /^stats/i, selected: true });
273273
},
274274
{ timeout: 5000 }
275275
);

0 commit comments

Comments
 (0)