Skip to content

Commit fe752f5

Browse files
committed
test(web): wait for citation comment updates
1 parent efe33fb commit fe752f5

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

‎apps/web/src/components/ComposerPromptEditorTiptap.citationDraft.browser.test.tsx‎

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,19 +152,24 @@ it.each(["save", "send", "question"] as const)(
152152
} else {
153153
await userEvent.keyboard(action === "send" ? "{Control>}{Enter}{/Control}" : "{Enter}");
154154
}
155-
const savedPrompt = screen.container.querySelector("output")?.dataset.prompt;
156-
expect(savedPrompt === prompt, "Rejected comments must leave the saved prompt unchanged").toBe(
157-
true,
158-
);
159-
expect(onSend).not.toHaveBeenCalled();
155+
await vi.waitFor(() => {
156+
const savedPrompt = screen.container.querySelector("output")?.dataset.prompt;
157+
expect(
158+
savedPrompt === prompt,
159+
"Rejected comments must leave the saved prompt unchanged",
160+
).toBe(true);
161+
expect(onSend).not.toHaveBeenCalled();
162+
});
160163
if (action !== "question") {
161164
await expect.element(comment).toHaveValue(oversizedComment);
162165
await comment.fill("ok");
163166
await userEvent.keyboard(action === "send" ? "{Control>}{Enter}{/Control}" : "{Enter}");
164-
expect(screen.container.querySelector("output")?.dataset.prompt).toBe(
165-
`See ${serializeAssistantCitation(withAssistantCitationComment(sourceCitation, "ok"))} `,
166-
);
167-
expect(onSend).toHaveBeenCalledTimes(action === "send" ? 1 : 0);
167+
await vi.waitFor(() => {
168+
expect(screen.container.querySelector("output")?.dataset.prompt).toBe(
169+
`See ${serializeAssistantCitation(withAssistantCitationComment(sourceCitation, "ok"))} `,
170+
);
171+
expect(onSend).toHaveBeenCalledTimes(action === "send" ? 1 : 0);
172+
});
168173
}
169174
},
170175
);

0 commit comments

Comments
 (0)