Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✅ Fix flaky job title select test racing the Base UI popup (#3071)

Luke Vella085d2d841a35
diff --git a/apps/web/src/features/user/components/job-title-select.test.tsx b/apps/web/src/features/user/components/job-title-select.test.tsx
index 12dc067b0..7b7d6e2c2 100644
--- a/apps/web/src/features/user/components/job-title-select.test.tsx
+++ b/apps/web/src/features/user/components/job-title-select.test.tsx
@@ -21,7 +21,7 @@ function Harness({ initial = null }: { initial?: string | null }) {
async function chooseOther(user: ReturnType<typeof userEvent.setup>) {
await user.click(screen.getByRole("combobox"));
- await user.click(screen.getByRole("option", { name: "Other" }));
+ await user.click(await screen.findByRole("option", { name: "Other" }));
}
describe("JobTitleSelect", () => {
@@ -30,7 +30,7 @@ describe("JobTitleSelect", () => {
render(<Harness />);
await user.click(screen.getByRole("combobox"));
- await user.click(screen.getByRole("option", { name: "Recruiter" }));
+ await user.click(await screen.findByRole("option", { name: "Recruiter" }));
await waitFor(() =>
expect(screen.getByTestId("value")).toHaveTextContent("recruiter"),
@@ -88,7 +88,9 @@ describe("JobTitleSelect", () => {
render(<Harness initial="recruiter" />);
await user.click(screen.getByRole("combobox"));
- await user.click(screen.getByRole("option", { name: "Prefer not to say" }));
+ await user.click(
+ await screen.findByRole("option", { name: "Prefer not to say" }),
+ );
await waitFor(() =>
expect(screen.getByTestId("value")).toHaveTextContent("null"),