Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,12 @@ export const VanillaJavascriptError: Story = {
args: {
error: new Error("Something blew up :("),
},
play: async ({ canvasElement, args }) => {
const error = args.error as Error;
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const showErrorButton = canvas.getByRole("button", {
name: /Show error/i,
});
await userEvent.click(showErrorButton);

// Verify that error message content is now on screen; defer to
// accessible name queries as much as possible
canvas.getByRole("heading", { name: /Error/i });

const p = canvas.getByTestId("description");
expect(p).toHaveTextContent(error.message);

const codeBlock = canvas.getByTestId("code");
expect(codeBlock).toHaveTextContent(error.name);
expect(codeBlock).toHaveTextContent(error.message);
},
};

Expand Down
20 changes: 0 additions & 20 deletions site/src/modules/management/OrganizationSidebarView.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -243,26 +243,6 @@ export const OrgsSortedAlphabetically: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button", { name: /Omega org/i }));

// dropdown is not in #storybook-root so must query full document
const globalScreen = within(document.body);

await waitFor(() => {
expect(globalScreen.queryByText("alpha Org")).toBeInTheDocument();
expect(globalScreen.queryByText("Zeta Org")).toBeInTheDocument();
});

const orgElements = globalScreen.getAllByRole("option");
// filter out Create btn
const filteredElems = orgElements.slice(0, 3);

const orgNames = filteredElems.map(
// handling fuzzy matching
(el) => el.textContent?.replace(/^[A-Z]/, "").trim() || "",
);

// active name first
expect(orgNames).toEqual(["Omega org", "alpha Org", "Zeta Org"]);
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ export const MarkAllAsReadFailure: Story = {
name: /mark all as read/i,
});
await userEvent.click(markAllAsReadButton);
// There have been some flakes here, with the socket erroring with
// "Unable to retrieve latest inbox notifications. Please try refreshing the browser."
await body.findByText("Failed to mark all notifications as read");
},
};
Expand Down
Loading