Description
The E2E test `tests/e2e/chat.spec.ts:110:3 › Chat Core E2E (Phase 9) › 3. Infinite scroll loads older messages` currently passes but does not test what it claims.
The loop intended to populate 60+ messages (to trigger pagination) sends empty POST requests to `/api/v1/ws` (a WebSocket-only GET endpoint), which silently returns 405 and does nothing:
```ts
for (let i = 0; i < 60; i++) {
await pageB.request.post(/api/v1/ws, { /* empty body */ });
// always returns 405 — response never checked
}
```
The test then navigates to the conversation and checks that `div.rounded-2xl` is visible. Since messages from tests 1 and 2 (Alice ↔ Bob exchange) are already in the conversation, the assertion passes. But the infinite scroll trigger (loading a second page via cursor) is never exercised.
What needs to be done
Pick one of these approaches:
Option A — Test-only REST seed endpoint (recommended)
Add `POST /api/v1/test/seed-messages?conversation_id={id}&count=60` to the test handler (pattern already used by `/api/v1/test/verification-token`). The endpoint bypasses WS and inserts rows directly via `SendMessageService` or the repo. The test calls this endpoint, then navigates and scrolls up to trigger `InfiniteScrollTrigger`.
Option B — WebSocket client in Playwright
Use `page.evaluate()` to open a native `WebSocket` in the browser and send 60 `chat.send` frames sequentially. Requires rate-limit awareness (60 msg/min → need 2 connections or a 1-minute window, which is too slow for E2E).
Option C — Direct DB seed in Go test helper
Extend the Go `TestHandler` to bulk-insert messages, similar to `/api/v1/test/join-association`.
Impact
- The infinite scroll UI feature (`InfiniteScrollTrigger`, cursor-based pagination) has zero E2E coverage today.
- The test gives a false green and masks any regression in the scroll/pagination path.
Related
Description
The E2E test `tests/e2e/chat.spec.ts:110:3 › Chat Core E2E (Phase 9) › 3. Infinite scroll loads older messages` currently passes but does not test what it claims.
The loop intended to populate 60+ messages (to trigger pagination) sends empty POST requests to `/api/v1/ws` (a WebSocket-only GET endpoint), which silently returns 405 and does nothing:
```ts
for (let i = 0; i < 60; i++) {
await pageB.request.post(
/api/v1/ws, { /* empty body */ });// always returns 405 — response never checked
}
```
The test then navigates to the conversation and checks that `div.rounded-2xl` is visible. Since messages from tests 1 and 2 (Alice ↔ Bob exchange) are already in the conversation, the assertion passes. But the infinite scroll trigger (loading a second page via cursor) is never exercised.
What needs to be done
Pick one of these approaches:
Option A — Test-only REST seed endpoint (recommended)
Add `POST /api/v1/test/seed-messages?conversation_id={id}&count=60` to the test handler (pattern already used by `/api/v1/test/verification-token`). The endpoint bypasses WS and inserts rows directly via `SendMessageService` or the repo. The test calls this endpoint, then navigates and scrolls up to trigger `InfiniteScrollTrigger`.
Option B — WebSocket client in Playwright
Use `page.evaluate()` to open a native `WebSocket` in the browser and send 60 `chat.send` frames sequentially. Requires rate-limit awareness (60 msg/min → need 2 connections or a 1-minute window, which is too slow for E2E).
Option C — Direct DB seed in Go test helper
Extend the Go `TestHandler` to bulk-insert messages, similar to `/api/v1/test/join-association`.
Impact
Related