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:
4
.github/workflows/pr-checks.yml
vendored
4
.github/workflows/pr-checks.yml
vendored
@@ -32,8 +32,8 @@ jobs:
|
||||
- name: Install Bun
|
||||
uses: oven-sh/setup-bun@v2
|
||||
|
||||
- name: Build plugins
|
||||
run: pnpm -r --filter './plugins/**' build
|
||||
- name: Build plugins and core packages
|
||||
run: pnpm build
|
||||
|
||||
- name: Lint
|
||||
run: pnpm lint
|
||||
|
||||
@@ -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