Skip to content

chore: replace MoreMenu with DropdownMenu #17615

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
May 1, 2025
Prev Previous commit
Next Next commit
fix: fix tests
  • Loading branch information
jaaydenh committed May 1, 2025
commit d56d98812f96c84e41cecb2a029d2ee81cd54d3b
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
MockEntitlementsWithMultiOrg,
MockOrganization,
MockOrganizationAuditorRole,
MockOrganizationMember,
MockOrganizationMember2,
MockOrganizationPermissions,
MockUser,
} from "testHelpers/entities";
Expand Down Expand Up @@ -46,20 +48,19 @@ const renderPage = async () => {

const removeMember = async () => {
const user = userEvent.setup();
// Click on the "Open menu" button to display the "Remove" option
const menuButtons = await screen.findAllByRole("button", { name: "Open menu" });
// get MockUser2
const selectedMenuButton = menuButtons[0];

await user.click(selectedMenuButton);

// Wait for the dropdown menu to be visible and find the remove button
const menuItems = await screen.findAllByRole("menuitem");
const removeButton = menuItems.find(item => item.textContent === "Remove");
if (!removeButton) {
throw new Error("Remove button not found");

const users = await screen.findAllByText(/.*@coder.com/);
const userRow = users[1].closest("tr");
if (!userRow) {
throw new Error("Error on get the first user row");
}
await user.click(removeButton);
const menuButton = await within(userRow).findByRole("button", {
name: "Open menu",
});
await user.click(menuButton);

const removeOption = await screen.findByRole("menuitem", { name: "Remove" });
await user.click(removeOption);

const dialog = await within(document.body).findByRole("dialog");
await user.click(within(dialog).getByRole("button", { name: "Remove" }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ export const OpenDownloadLogs: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button", { name: "Workspace actions" }));
await userEvent.click(
canvas.getByRole("button", { name: "Workspace actions" }),
);
const screen = within(document.body);
await userEvent.click(screen.getByText("Download logs…"));
await expect(screen.getByTestId("dialog")).toBeInTheDocument();
Expand All @@ -215,7 +217,9 @@ export const CanDeleteDormantWorkspace: Story = {
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
await userEvent.click(canvas.getByRole("button", { name: "Workspace actions" }));
await userEvent.click(
canvas.getByRole("button", { name: "Workspace actions" }),
);
const screen = within(document.body);
const deleteButton = screen.getByText("Delete…");
await expect(deleteButton).toBeEnabled();
Expand Down