# Manual Test Cases — `loadLastAgentConversation`

## Prerequisites
- An `@agentic` user configured in your CometChat dashboard
- The example app running with `loadLastAgentConversation={true}` on `CometChatMessageList`
- At least one previous conversation with the agent (send a message, get a response)

---

## TC-1: Auto-loads last conversation on open

**Steps:**
1. Have at least one previous conversation with the agent (send "Hello", wait for reply)
2. Navigate away from the agent chat (go back to conversation list)
3. Open the agent chat again

**Expected:**
- A loading indicator appears briefly
- The previous conversation messages load automatically
- You see your last messages and the agent's responses

---

## TC-2: Shows greeting/empty state when no previous conversation exists

**Steps:**
1. Use a fresh `@agentic` user with no message history (or use a new logged-in user who hasn't chatted with the agent)
2. Open the agent chat

**Expected:**
- The agent greeting view appears (avatar, greeting message, suggested messages)
- No loading spinner hangs indefinitely

---

## TC-3: "New Chat" button from header shows empty state

**Steps:**
1. Open the agent chat (previous conversation auto-loads)
2. Tap the "New Chat" button (pencil/compose icon) in the header

**Expected:**
- The screen resets to the greeting/empty state
- The previous conversation is NOT re-loaded
- You can type a fresh message to start a new conversation

---

## TC-4: "New Chat" button from Chat History drawer works

**Steps:**
1. Open the agent chat
2. Tap the "Chat History" button in the header to open the history drawer
3. Tap the "New Chat" button inside the history drawer

**Expected:**
- The history drawer closes
- The message list resets to greeting/empty state
- The previous conversation is NOT re-loaded

---

## TC-5: Loading a specific conversation from Chat History still works

**Steps:**
1. Open the agent chat (previous conversation auto-loads)
2. Tap the "Chat History" button in the header
3. Tap on a specific past conversation from the list

**Expected:**
- The selected conversation loads with all its messages
- Streaming/responses still work if you send a new message in that thread

---

## TC-6: Sending a new message after "New Chat" starts a new thread

**Steps:**
1. Open the agent chat (previous conversation auto-loads)
2. Tap "New Chat" (message list resets to empty)
3. Type and send a message (e.g., "What's the weather?")

**Expected:**
- Your message appears in the list
- A streaming indicator shows while the agent responds
- The agent's reply appears correctly
- This is now a NEW conversation thread (not appended to the old one)

---

## TC-7: Re-opening after new chat shows the NEW conversation

**Steps:**
1. Complete TC-6 (start a new chat, send message, get reply)
2. Navigate away from the agent chat
3. Open the agent chat again

**Expected:**
- The most recent conversation (from step 1-2) auto-loads
- You see the "What's the weather?" message and the agent's response
- NOT the older conversation from before

---

## TC-8: `loadLastAgentConversation={false}` preserves existing behavior

**Steps:**
1. Change the prop to `loadLastAgentConversation={false}` (or remove it) in Messages.tsx
2. Open the agent chat (even with previous conversations)

**Expected:**
- The greeting/empty state shows immediately
- No automatic loading of previous conversation
- Behaves exactly as before this feature was added

---

## TC-9: Non-agentic users are unaffected

**Steps:**
1. With `loadLastAgentConversation={true}` still set
2. Open a regular (non-agentic) user chat that has message history

**Expected:**
- Messages load normally (standard behavior)
- No change in behavior — the prop only applies to `@agentic` users

---

## TC-10: Scroll up to load older messages in auto-loaded conversation

**Steps:**
1. Have a long conversation history with the agent (30+ messages)
2. Open the agent chat (auto-loads last conversation)
3. Scroll up to the top of the loaded messages

**Expected:**
- Older messages load (pagination works)
- No crash or infinite spinner
- The loading indicator appears at the top while fetching

---

## TC-11: Delete all history from Chat History panel

**Steps:**
1. Open the agent chat
2. Open Chat History drawer
3. Long-press and delete all conversations one by one until none remain

**Expected:**
- When the last conversation is deleted, the list shows empty state
- The message list resets to greeting/empty view
- Re-opening the chat shows greeting (no conversation to auto-load)
