FN-5864: stabilize ChatView skill-menu keyboard assertions
Make the ChatView skill-menu keyboard navigation test wait for async UI updates. - wrap the highlighted-option assertion after ArrowUp in waitFor to avoid synchronous timing races - wait for the textarea value update after Enter selection before asserting the chosen skill command Files changed: packages/dashboard/app/components/__tests__/ChatView.test.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) Fusion-Task-Id: FN-5864 Fusion-Task-Lineage: 9f1b3988-7022-415f-8d4b-83b0b3b25dfb
This commit is contained in:
@@ -1779,12 +1779,14 @@ describe("ChatView", () => {
|
||||
|
||||
// Wrap to bottom from the first item.
|
||||
fireEvent.keyDown(textarea, { key: "ArrowUp" });
|
||||
expect(screen.getByRole("option", { name: /gamma/i })).toHaveClass(
|
||||
"chat-skill-menu-item--highlighted",
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole("option", { name: /gamma/i })).toHaveClass(
|
||||
"chat-skill-menu-item--highlighted",
|
||||
),
|
||||
);
|
||||
|
||||
fireEvent.keyDown(textarea, { key: "Enter" });
|
||||
expect(textarea).toHaveValue("/skill:gamma ");
|
||||
await waitFor(() => expect(textarea).toHaveValue("/skill:gamma "));
|
||||
});
|
||||
|
||||
it("supports selecting highlighted skill with Tab", async () => {
|
||||
|
||||
Reference in New Issue
Block a user