Skip to content

Commit 8bd2cd0

Browse files
committed
test: add play functions to TemplateInsightsControls.stories
1 parent 07fd1e2 commit 8bd2cd0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

site/src/pages/TemplatePage/TemplateInsightsPage/TemplateInsightsControls.stories.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { Meta, StoryObj } from "@storybook/react-vite";
2+
import { within } from "@testing-library/react";
23
import type { ComponentProps } from "react";
4+
import { userEvent } from "storybook/test";
35
import { TemplateInsightsControls } from "./TemplateInsightsPage";
46

57
const meta: Meta<typeof TemplateInsightsControls> = {
@@ -25,11 +27,21 @@ export const Day: Story = {
2527
...defaultArgs,
2628
interval: "day",
2729
},
30+
play: async ({ canvasElement }) => {
31+
const canvas = within(canvasElement);
32+
const datePicker = canvas.getAllByRole("button")[1];
33+
await userEvent.click(datePicker);
34+
},
2835
};
2936

3037
export const Week: Story = {
3138
args: {
3239
...defaultArgs,
3340
interval: "week",
3441
},
42+
play: async ({ canvasElement }) => {
43+
const canvas = within(canvasElement);
44+
const dropdown = canvas.getAllByRole("button")[1];
45+
await userEvent.click(dropdown);
46+
},
3547
};

0 commit comments

Comments
 (0)