test: fix failing storybook stories (#27674)

This commit is contained in:
McKayla はな
2026-08-10 17:03:28 -06:00
committed by GitHub
parent b781be0fa2
commit efd5ce3668
2 changed files with 11 additions and 4 deletions
@@ -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(),
);
},
};
@@ -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();