Files
kandev/apps/web/e2e/tests/chat/mobile-quick-chat-entry.spec.ts
T
João Salavisa 14d65a2abd feat(web): add quick chat entry points on mobile (#1751)
* feat(web): add quick chat entry points on mobile

Quick chat was unreachable on touch devices: every trigger was
desktop-only (keyboard shortcut, command palette, app sidebar) and the
full-screen dialog had no touch dismissal.

- add quick chat button to the mobile kanban/tasks header
- add quick chat button to the tablet header (640-767px has no sidebar)
- add chat button to the mobile session task-switcher sheet
- add a mobile-only close control to the quick chat tab bar
- cover the touch entry points with a mobile Playwright spec

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(web): address review feedback on mobile quick chat spec

- reuse the shared assertNoDocumentHorizontalOverflow layout helper in
  both quick chat mobile specs instead of local duplicates
- assert the task switcher sheet is dismissed after opening quick chat

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 13:05:43 +01:00

59 lines
2.4 KiB
TypeScript

/**
* Mobile entry points for Quick Chat.
*
* Desktop opens Quick Chat via keyboard shortcut, command palette, or the app
* sidebar — none of which exist on a touch viewport. These tests cover the
* touch affordances: the kanban header button on Home, the task-switcher sheet
* button on a session page, and the explicit close control (touch devices have
* no Escape key and the full-screen dialog leaves no overlay to tap).
*
* Lives in `mobile-*.spec.ts` so the `mobile-chrome` Playwright project applies
* the mobile device automatically.
*/
import { test, expect } from "../../fixtures/test-base";
import { SessionPage } from "../../pages/session-page";
import { assertNoDocumentHorizontalOverflow } from "../../helpers/layout-assertions";
test.describe("Quick Chat entry points on mobile", () => {
test("opens from the home header and closes with the touch control", async ({ testPage }) => {
await testPage.goto("/");
await testPage.waitForLoadState("networkidle");
await assertNoDocumentHorizontalOverflow(testPage);
await testPage.getByTestId("mobile-quick-chat-button").click();
const dialog = testPage.getByRole("dialog", { name: "Quick Chat" });
await expect(dialog.getByTestId("quick-chat-setup")).toBeVisible({ timeout: 10_000 });
await assertNoDocumentHorizontalOverflow(testPage);
await dialog.getByTestId("quick-chat-close").click();
await expect(dialog).not.toBeVisible();
});
test("opens from the task switcher sheet on a session page", async ({
testPage,
apiClient,
seedData,
}) => {
const seeded = await apiClient.seedTask(seedData.workspaceId, "Mobile Quick Chat Task", {
workflow_id: seedData.workflowId,
workflow_step_id: seedData.startStepId,
});
await testPage.goto(`/t/${seeded.task_id}`);
const session = new SessionPage(testPage);
await session.waitForLoad();
await testPage.getByTestId("mobile-session-menu").click();
const sheet = testPage.getByRole("dialog", { name: "Tasks" });
await expect(sheet).toBeVisible();
await testPage.getByTestId("mobile-sheet-quick-chat").click();
const dialog = testPage.getByRole("dialog", { name: "Quick Chat" });
await expect(dialog.getByTestId("quick-chat-setup")).toBeVisible({ timeout: 10_000 });
// Opening quick chat dismisses the task switcher sheet.
await expect(sheet).not.toBeVisible();
await assertNoDocumentHorizontalOverflow(testPage);
});
});