mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
test: fix failing storybook stories (#27674)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
import { expect, fn, screen, userEvent, within } from "storybook/test";
|
||||
import { expect, fn, screen, userEvent, waitFor, within } from "storybook/test";
|
||||
import { IconField } from "./IconField";
|
||||
|
||||
const meta: Meta<typeof IconField> = {
|
||||
@@ -50,6 +50,9 @@ export const OpenPicker: Story = {
|
||||
});
|
||||
await userEvent.click(button);
|
||||
await expect(button).toHaveAttribute("aria-expanded", "true");
|
||||
await expect(await screen.findByText("Smileys & People")).toBeVisible();
|
||||
const popover = await screen.findByRole("dialog");
|
||||
await waitFor(() =>
|
||||
expect(popover.querySelector("em-emoji-picker")).toBeInTheDocument(),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
+6
-2
@@ -47,7 +47,9 @@ export const CanEditSettings: Story = {
|
||||
const canvas = within(canvasElement);
|
||||
await userEvent.click(canvas.getByRole("tab", { name: "Settings" }));
|
||||
|
||||
await expect(canvas.getByRole("button", { name: "Enable" })).toBeEnabled();
|
||||
await expect(
|
||||
await canvas.findByRole("button", { name: "Enable" }),
|
||||
).toBeEnabled();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -68,7 +70,9 @@ export const ViewOnlyCannotEditSettings: Story = {
|
||||
const canvas = within(canvasElement);
|
||||
await userEvent.click(canvas.getByRole("tab", { name: "Settings" }));
|
||||
|
||||
await expect(canvas.getByRole("button", { name: "Enable" })).toBeDisabled();
|
||||
await expect(
|
||||
await canvas.findByRole("button", { name: "Enable" }),
|
||||
).toBeDisabled();
|
||||
await expect(
|
||||
canvas.getByText(/permission to edit deployment configuration/),
|
||||
).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user