mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +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 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";
|
import { IconField } from "./IconField";
|
||||||
|
|
||||||
const meta: Meta<typeof IconField> = {
|
const meta: Meta<typeof IconField> = {
|
||||||
@@ -50,6 +50,9 @@ export const OpenPicker: Story = {
|
|||||||
});
|
});
|
||||||
await userEvent.click(button);
|
await userEvent.click(button);
|
||||||
await expect(button).toHaveAttribute("aria-expanded", "true");
|
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);
|
const canvas = within(canvasElement);
|
||||||
await userEvent.click(canvas.getByRole("tab", { name: "Settings" }));
|
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);
|
const canvas = within(canvasElement);
|
||||||
await userEvent.click(canvas.getByRole("tab", { name: "Settings" }));
|
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(
|
await expect(
|
||||||
canvas.getByText(/permission to edit deployment configuration/),
|
canvas.getByText(/permission to edit deployment configuration/),
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user