/** * E2E: Message composer is available and interactive. */ import { expect, test } from "@playwright/test"; import { captureScreenshot, completeOnboarding, createNamedBot, signup } from "./helpers"; test.describe.configure({ mode: "serial" }); test("message composer is available and interactive", async ({ page }) => { const testInfo = test.info(); const stamp = Date.now(); await signup(page, `msgsend-${stamp}@rakazo.test`, "password12", "MsgSend"); await completeOnboarding(page); await expect(page.getByText("Chief").first()).toBeVisible(); // Create a fresh bot via RPC await createNamedBot(page, `TestBot-${stamp}`); await expect(page.getByRole("combobox", { name: "Message" })).toBeVisible({ timeout: 10_000, }); const composer = page.getByRole("combobox", { name: "Message" }); await composer.click(); // Use fill which works on combobox inputs await composer.fill("Hello test"); // Verify the value was set (check input value, not text content) const inputValue = await composer.inputValue(); expect(inputValue).toContain("Hello test"); // Send via Enter await page.keyboard.press("Enter"); await page.waitForTimeout(2000); // Either the message appears in chat OR we see a model error const messageInChat = page.getByText("Hello test").first(); const modelError = page.getByText(/Connect a model/i); const [inChat, hasError] = await Promise.all([ messageInChat.isVisible({ timeout: 5000 }).catch(() => false), modelError.isVisible({ timeout: 3000 }).catch(() => false), ]); // At least one must be true expect(inChat || hasError).toBe(true); await captureScreenshot(page, testInfo, "msgsend-after-submit"); });