Skip to content

Commit 514b499

Browse files
authored
fix(site): fix workspace unhealthy dialog stories (#24637)
#24536 changed the behavior of the ⚠️ from a tooltip (hover) to a popover (click). this is better for a11y, particularly keyboard navigation. this PR updates the storybook interaction tests to match https://github.com/user-attachments/assets/94677b77-4925-4652-ae88-322ed087983b
1 parent 075face commit 514b499

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

site/src/pages/WorkspacePage/WorkspaceNotifications/WorkspaceNotifications.stories.tsx

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ export const Outdated: Story = {
5555
},
5656

5757
play: async ({ step }) => {
58-
await step("activate hover trigger", async () => {
59-
await userEvent.hover(screen.getByTestId("info-notifications"));
58+
await step("activate click trigger", async () => {
59+
await userEvent.click(screen.getByTestId("info-notifications"));
6060
await waitFor(() =>
61-
expect(screen.getByRole("tooltip")).toHaveTextContent(
61+
expect(screen.getByRole("dialog")).toHaveTextContent(
6262
MockTemplateVersion.message,
6363
),
6464
);
@@ -73,10 +73,10 @@ export const OutdatedWithMarkdownMessage: Story = {
7373
},
7474

7575
play: async ({ step }) => {
76-
await step("activate hover trigger", async () => {
77-
await userEvent.hover(screen.getByTestId("info-notifications"));
76+
await step("activate click trigger", async () => {
77+
await userEvent.click(screen.getByTestId("info-notifications"));
7878
await waitFor(() =>
79-
expect(screen.getByRole("tooltip")).toHaveTextContent(
79+
expect(screen.getByRole("dialog")).toHaveTextContent(
8080
/an update is available/i,
8181
),
8282
);
@@ -104,10 +104,10 @@ export const RequiresManualUpdate: Story = {
104104
},
105105

106106
play: async ({ step }) => {
107-
await step("activate hover trigger", async () => {
108-
await userEvent.hover(screen.getByTestId("warning-notifications"));
107+
await step("activate click trigger", async () => {
108+
await userEvent.click(screen.getByTestId("warning-notifications"));
109109
await waitFor(() =>
110-
expect(screen.getByRole("tooltip")).toHaveTextContent(
110+
expect(screen.getByRole("dialog")).toHaveTextContent(
111111
/unable to automatically update/i,
112112
),
113113
);
@@ -153,9 +153,9 @@ export const StartupScriptFailed: Story = {
153153

154154
play: async ({ step }) => {
155155
await step("shows startup script failure message", async () => {
156-
await userEvent.hover(screen.getByTestId("warning-notifications"));
156+
await userEvent.click(screen.getByTestId("warning-notifications"));
157157
await waitFor(() =>
158-
expect(screen.getByRole("tooltip")).toHaveTextContent(
158+
expect(screen.getByRole("dialog")).toHaveTextContent(
159159
/a startup script has failed/i,
160160
),
161161
);
@@ -178,10 +178,10 @@ export const AgentDisconnected: Story = {
178178
},
179179

180180
play: async ({ step }) => {
181-
await step("activate hover trigger", async () => {
182-
await userEvent.hover(screen.getByTestId("warning-notifications"));
181+
await step("activate click trigger", async () => {
182+
await userEvent.click(screen.getByTestId("warning-notifications"));
183183
await waitFor(() =>
184-
expect(screen.getByRole("tooltip")).toHaveTextContent(
184+
expect(screen.getByRole("dialog")).toHaveTextContent(
185185
/one or more workspace agents need attention/i,
186186
),
187187
);
@@ -199,10 +199,10 @@ export const AgentTimeout: Story = {
199199
},
200200

201201
play: async ({ step }) => {
202-
await step("activate hover trigger", async () => {
203-
await userEvent.hover(screen.getByTestId("warning-notifications"));
202+
await step("activate click trigger", async () => {
203+
await userEvent.click(screen.getByTestId("warning-notifications"));
204204
await waitFor(() =>
205-
expect(screen.getByRole("tooltip")).toHaveTextContent(
205+
expect(screen.getByRole("dialog")).toHaveTextContent(
206206
/one or more workspace agents need attention/i,
207207
),
208208
);
@@ -233,10 +233,10 @@ export const Dormant: Story = {
233233
},
234234

235235
play: async ({ step }) => {
236-
await step("activate hover trigger", async () => {
237-
await userEvent.hover(screen.getByTestId("warning-notifications"));
236+
await step("activate click trigger", async () => {
237+
await userEvent.click(screen.getByTestId("warning-notifications"));
238238
await waitFor(() =>
239-
expect(screen.getByRole("tooltip")).toHaveTextContent(
239+
expect(screen.getByRole("dialog")).toHaveTextContent(
240240
/workspace is dormant/i,
241241
),
242242
);
@@ -273,10 +273,10 @@ export const PendingInQueue: Story = {
273273
},
274274

275275
play: async ({ step }) => {
276-
await step("activate hover trigger", async () => {
277-
await userEvent.hover(await screen.findByTestId("info-notifications"));
276+
await step("activate click trigger", async () => {
277+
await userEvent.click(await screen.findByTestId("info-notifications"));
278278
await waitFor(() =>
279-
expect(screen.getByRole("tooltip")).toHaveTextContent(
279+
expect(screen.getByRole("dialog")).toHaveTextContent(
280280
/build is pending/i,
281281
),
282282
);
@@ -295,10 +295,10 @@ export const TemplateDeprecated: Story = {
295295
},
296296

297297
play: async ({ step }) => {
298-
await step("activate hover trigger", async () => {
299-
await userEvent.hover(screen.getByTestId("warning-notifications"));
298+
await step("activate click trigger", async () => {
299+
await userEvent.click(screen.getByTestId("warning-notifications"));
300300
await waitFor(() =>
301-
expect(screen.getByRole("tooltip")).toHaveTextContent(
301+
expect(screen.getByRole("dialog")).toHaveTextContent(
302302
/deprecated template/i,
303303
),
304304
);

0 commit comments

Comments
 (0)