fix: fix flaky PlanningModeModal test — use findByText for async rendering
The test clicked 'Medium' and 'Continue' synchronously without waiting for the scope question options to fully render. Use findByText/findByRole to wait for elements to appear before interacting, and add a timeout to the final waitFor for the second question.
This commit is contained in:
@@ -1167,8 +1167,11 @@ describe("PlanningModeModal", () => {
|
||||
expect(screen.getByText("What is the scope?")).toBeDefined();
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText("Medium"));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Continue" }));
|
||||
const mediumOption = await screen.findByText("Medium");
|
||||
fireEvent.click(mediumOption);
|
||||
|
||||
const continueBtn = await screen.findByRole("button", { name: "Continue" });
|
||||
fireEvent.click(continueBtn);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.getByText("What are the key requirements?")).toBeDefined();
|
||||
|
||||
Reference in New Issue
Block a user