Test Plan: WordPress AI Question Plugin
Based on the Plugin Flowchart.
1. Authentication & Access Control
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-01 | Guest Access | User is NOT logged in | 1. Visit a Research Paper post. | 1. Partial content is shown. 2. Login prompt is displayed. 3. "Ask AI" feature is disabled/hidden. |
| TC-02 | User Access | User IS logged in | 1. Visit a Research Paper post. | 1. Full content is visible. 2. AI Script initializes. |
2. UI Interaction: Selection & Activation
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-03 | Select Text | Logged in | 1. Select a text fragment on the page. | 1. "Ask AI" button appears near the selection. |
| TC-04 | Deselect Text | "Ask AI" button visible | 1. Click anywhere else on the page. | 1. "Ask AI" button disappears. |
| TC-05 | Activate Chat | "Ask AI" button visible | 1. Click "Ask AI" button. | 1. Selected text is highlighted (CSS class applied). 2. Sidebar Chat Block opens. 3. Chat Block is linked to the specific DOM ID of the highlight. |
3. Chat Functionality & Credits
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-06 | Ask Question (No Credits) | User has 0 credits | 1. Open Chat. 2. Type question. 3. Click Send. | 1. System checks credits. 2. "Insufficient Funds" message/modal appears. 3. Top-up option is shown. |
| TC-07 | Ask Question (Success) | User has >0 credits | 1. Open Chat. 2. Type question. 3. Click Send. | 1. Message sent to remote server. 2. Loading state displayed. 3. AI Answer received and displayed. 4. Credits deducted. |
4. Data Persistence & Remote Server
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-08 | Data Saving | Successful Q&A flow | 1. Complete TC-07. | 1. Selection saved to DB (Table 1). 2. Q&A Log saved to DB (Table 2). |
5. Chat Management (Close/Archive)
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-09 | Close Empty Chat | Chat open, No questions asked | 1. Click "Close" (X) button on sidebar. | 1. Chat block is removed. 2. Text highlight is removed (unwrapped). |
| TC-10 | Archive Active Chat | Chat open, Questions asked | 1. Click "Close" (X) button on sidebar. | 1. Chat block is hidden/archived. 2. Data is preserved. 3. (Optional) Highlight remains or state is saved for reload. |
6. Edge Cases
| ID | Test Case | Pre-conditions | Steps | Expected Result |
|---|---|---|---|---|
| TC-11 | Multiple Selections | One chat already open | 1. Select a different text fragment. 2. Click "Ask AI". | 1. New unique ID generated. 2. New highlight applied. 3. New Chat Block opens (or replaces current view). |