|
6 | 6 | MockEntitlementsWithMultiOrg,
|
7 | 7 | MockOrganization,
|
8 | 8 | MockOrganizationAuditorRole,
|
| 9 | + MockOrganizationMember, |
| 10 | + MockOrganizationMember2, |
9 | 11 | MockOrganizationPermissions,
|
10 | 12 | MockUser,
|
11 | 13 | } from "testHelpers/entities";
|
@@ -46,20 +48,19 @@ const renderPage = async () => {
|
46 | 48 |
|
47 | 49 | const removeMember = async () => {
|
48 | 50 | const user = userEvent.setup();
|
49 |
| - // Click on the "Open menu" button to display the "Remove" option |
50 |
| - const menuButtons = await screen.findAllByRole("button", { name: "Open menu" }); |
51 |
| - // get MockUser2 |
52 |
| - const selectedMenuButton = menuButtons[0]; |
53 |
| - |
54 |
| - await user.click(selectedMenuButton); |
55 |
| - |
56 |
| - // Wait for the dropdown menu to be visible and find the remove button |
57 |
| - const menuItems = await screen.findAllByRole("menuitem"); |
58 |
| - const removeButton = menuItems.find(item => item.textContent === "Remove"); |
59 |
| - if (!removeButton) { |
60 |
| - throw new Error("Remove button not found"); |
| 51 | + |
| 52 | + const users = await screen.findAllByText(/.*@coder.com/); |
| 53 | + const userRow = users[1].closest("tr"); |
| 54 | + if (!userRow) { |
| 55 | + throw new Error("Error on get the first user row"); |
61 | 56 | }
|
62 |
| - await user.click(removeButton); |
| 57 | + const menuButton = await within(userRow).findByRole("button", { |
| 58 | + name: "Open menu", |
| 59 | + }); |
| 60 | + await user.click(menuButton); |
| 61 | + |
| 62 | + const removeOption = await screen.findByRole("menuitem", { name: "Remove" }); |
| 63 | + await user.click(removeOption); |
63 | 64 |
|
64 | 65 | const dialog = await within(document.body).findByRole("dialog");
|
65 | 66 | await user.click(within(dialog).getByRole("button", { name: "Remove" }));
|
|
0 commit comments