The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 07:15 UTC
test(web): /side attachments test waits for each side chat to start (#38822)
Julius Marminge committed
Nov 18, 2026 at 17:37 UTC
685c2ebd457ac199dcab8e0d715c423bd07e8c1a
1 file changed
+24
-12
apps/web/src/components/ChatView.browser.test.tsx
+24
-12
@@ -821,30 +821,42 @@ it("/side sends the draft's attachments and context, and keeps them when it does
821
await userEvent.keyboard("/side what is this?{Enter}");
822
await expect.element(image).not.toBeInTheDocument();
823
};
824
- const sentMessage = (fields: Record<string, unknown>) =>
825
- vi.waitFor(() =>
824
+ // The tab opens once the start finished; until then `/side` refuses another side chat.
825
+ const sideChatTabs = page.getByRole("button", { name: "Side chat", exact: true });
826
+ const sentMessage = async (fields: Record<string, unknown>, openTabs: number) => {
827
+ await vi.waitFor(() =>
828
expect(dispatchedCommands()).toContainEqual(
829
expect.objectContaining({ type: "message.dispatch", ...fields }),
830
),
831
);
832
+ await expect.element(sideChatTabs).toHaveLength(openTabs);
833
+ };
834
835
await sendImageToSideChat();
832
- await sentMessage({
833
- text: "what is this?",
834
- attachments: [expect.objectContaining({ type: "image", id: "upload-1" })],
835
- context: {
836
- version: 1,
837
- records: [expect.objectContaining({ kind: "image", attachmentId: "upload-1" })],
836
+ await sentMessage(
837
+ {
838
+ text: "what is this?",
839
+ attachments: [expect.objectContaining({ type: "image", id: "upload-1" })],
840
+ context: {
841
+ version: 1,
842
+ records: [expect.objectContaining({ kind: "image", attachmentId: "upload-1" })],
843
+ },
844
},
839
- });
845
+ 1,
846
+ );
847
848
// A reply alone is enough to send.
849
await page.getByRole("button", { name: "Reply to this response" }).first().click();
850
await userEvent.click(editor);
851
await userEvent.keyboard("/side {Enter}");
845
- await sentMessage({
846
- context: expect.objectContaining({ records: [expect.objectContaining({ kind: "response" })] }),
847
- });
852
+ await sentMessage(
853
+ {
854
+ context: expect.objectContaining({
855
+ records: [expect.objectContaining({ kind: "response" })],
856
+ }),
857
+ },
858
+ 2,
859
+ );
860
861
// A failed start puts the message back after the draft typed meanwhile.
862
holdFork = true;