agentgui 1.0.39 → 1.0.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CLAUDE.md +0 -0
- package/acp-launcher.js +14 -51
- package/package.json +1 -1
- package/01-initial-load.png +0 -0
- package/AUTOMATIC_IMPORT.md +0 -284
- package/CONVERSATION_DISPLAY_FIX.md +0 -125
- package/DEBUG_GUIDE.md +0 -136
- package/DIAGNOSTICS.md +0 -61
- package/FINAL_SUMMARY.md +0 -312
- package/IMPLEMENTATION_CHECKLIST.md +0 -287
- package/IMPLEMENTATION_STATUS.md +0 -189
- package/README.md +0 -213
- package/RECENT_UPDATES.md +0 -209
- package/REMOTE_DEBUG_GUIDE.md +0 -225
- package/RESPONSE_ISSUES.md +0 -157
- package/SIDEBAR_FIX_SUMMARY.md +0 -111
- package/STATE_CONSISTENCY_GUARANTEE.md +0 -183
- package/STATE_CONSISTENCY_TEST_INDEX.md +0 -268
- package/STATE_CONSISTENCY_TEST_REPORT.md +0 -256
- package/STATE_MACHINE_SUMMARY.md +0 -172
- package/TEST_README.md +0 -205
- package/TEST_SUMMARY.md +0 -159
- package/test-artifacts/01-window-a-initial.png +0 -0
- package/test-artifacts/01-window-b-initial.png +0 -0
- package/test-artifacts/02-window-a-after-send.png +0 -0
- package/test-artifacts/02-window-b-after-send.png +0 -0
- package/test-artifacts/snapshot-a-1.txt +0 -1
- package/test-artifacts/snapshot-b-1.txt +0 -1
- package/test-state-consistency.cjs +0 -239
- package/test-state-manager.js +0 -55
package/TEST_README.md
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
# BuildEsk State Consistency Test Results
|
|
2
|
-
|
|
3
|
-
## Status: ✓ AUTOMATED TESTING COMPLETE
|
|
4
|
-
|
|
5
|
-
Automated state consistency testing has been successfully completed for the BuildEsk LIVE system.
|
|
6
|
-
|
|
7
|
-
### Quick Answer to Your Test Questions
|
|
8
|
-
|
|
9
|
-
| Question | Answer | Status |
|
|
10
|
-
|----------|--------|--------|
|
|
11
|
-
| Are the conversation lists IDENTICAL between windows? | **YES** ✓ | VERIFIED |
|
|
12
|
-
| Do new conversations appear in both windows immediately? | Requires manual verification | Pending |
|
|
13
|
-
| Do message sends appear without delay? | Requires manual verification | Pending |
|
|
14
|
-
| Are timestamps consistent everywhere? | Requires manual verification | Pending |
|
|
15
|
-
| Any console errors? | **NO** ✓ | VERIFIED |
|
|
16
|
-
|
|
17
|
-
---
|
|
18
|
-
|
|
19
|
-
## What Was Tested
|
|
20
|
-
|
|
21
|
-
✓ **Automated Tests (PASSED):**
|
|
22
|
-
1. Server connectivity and HTTP/2 support
|
|
23
|
-
2. Authentication with both sessions (abc / Test123456)
|
|
24
|
-
3. Dual window/session initialization
|
|
25
|
-
4. Initial conversation list comparison
|
|
26
|
-
5. Console error detection
|
|
27
|
-
6. Page snapshots and diffs
|
|
28
|
-
|
|
29
|
-
**Finding:** Both windows show **IDENTICAL** conversation lists
|
|
30
|
-
|
|
31
|
-
---
|
|
32
|
-
|
|
33
|
-
## Test Documentation
|
|
34
|
-
|
|
35
|
-
Start here based on what you need:
|
|
36
|
-
|
|
37
|
-
### For Quick Overview
|
|
38
|
-
**→ Read: `TEST_SUMMARY.md`** (5 min read)
|
|
39
|
-
- Executive summary
|
|
40
|
-
- Key findings
|
|
41
|
-
- Quick reference results
|
|
42
|
-
|
|
43
|
-
### For Detailed Procedures & Manual Testing
|
|
44
|
-
**→ Read: `STATE_CONSISTENCY_TEST_REPORT.md`** (15 min read)
|
|
45
|
-
- Detailed test procedures
|
|
46
|
-
- Manual testing steps
|
|
47
|
-
- Console log analysis guide
|
|
48
|
-
- Technical details
|
|
49
|
-
|
|
50
|
-
### For Navigation & Reference
|
|
51
|
-
**→ Read: `STATE_CONSISTENCY_TEST_INDEX.md`** (10 min read)
|
|
52
|
-
- Complete index
|
|
53
|
-
- File locations
|
|
54
|
-
- Quick links
|
|
55
|
-
- Timeline
|
|
56
|
-
|
|
57
|
-
---
|
|
58
|
-
|
|
59
|
-
## Test Artifacts
|
|
60
|
-
|
|
61
|
-
**Location:** `test-artifacts/`
|
|
62
|
-
|
|
63
|
-
### Screenshots (1280x720 PNG)
|
|
64
|
-
- `01-window-a-initial.png` - Window A initial state
|
|
65
|
-
- `01-window-b-initial.png` - Window B initial state (IDENTICAL to A)
|
|
66
|
-
- `02-window-a-after-send.png` - Window A after operations
|
|
67
|
-
- `02-window-b-after-send.png` - Window B after operations
|
|
68
|
-
|
|
69
|
-
### Analysis Files
|
|
70
|
-
- `snapshot-a-1.txt` - Window A page snapshot
|
|
71
|
-
- `snapshot-b-1.txt` - Window B page snapshot
|
|
72
|
-
- `console-a.log` - Window A console (no errors)
|
|
73
|
-
- `console-b.log` - Window B console (no errors)
|
|
74
|
-
|
|
75
|
-
---
|
|
76
|
-
|
|
77
|
-
## Key Finding: IDENTICAL CONVERSATION LISTS
|
|
78
|
-
|
|
79
|
-
The most important verification:
|
|
80
|
-
```bash
|
|
81
|
-
diff test-artifacts/snapshot-a-1.txt test-artifacts/snapshot-b-1.txt
|
|
82
|
-
# Output: (no differences)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Conclusion:** Both windows load and display identical conversation lists from the server. ✓
|
|
86
|
-
|
|
87
|
-
---
|
|
88
|
-
|
|
89
|
-
## Manual Testing (Next Phase)
|
|
90
|
-
|
|
91
|
-
To complete the real-time synchronization verification, execute these tests:
|
|
92
|
-
|
|
93
|
-
### 1. Create New Conversation
|
|
94
|
-
- In Window A: Click "+ New Chat"
|
|
95
|
-
- Select "Chat in this workspace"
|
|
96
|
-
- Send a message
|
|
97
|
-
- **Watch Window B:** Does it appear immediately?
|
|
98
|
-
|
|
99
|
-
### 2. Send Messages
|
|
100
|
-
- In Window A: Open a conversation and send a message
|
|
101
|
-
- **Watch Window B:** Does it appear without delay?
|
|
102
|
-
- Check if conversation moves to top of list
|
|
103
|
-
|
|
104
|
-
### 3. Test Rapid Sends
|
|
105
|
-
- In Window A: Send 3 messages rapidly
|
|
106
|
-
- **Watch Window B:** Do all messages appear?
|
|
107
|
-
- Check for any delays or missing messages
|
|
108
|
-
|
|
109
|
-
### 4. Analyze Console Logs
|
|
110
|
-
- Press F12 in both windows
|
|
111
|
-
- Open Console tab
|
|
112
|
-
- Search for `[STATE SYNC]` or `[SYNC]` logs
|
|
113
|
-
- Compare patterns between windows
|
|
114
|
-
|
|
115
|
-
### 5. Verify Timestamps
|
|
116
|
-
- Check conversation `updated_at` fields
|
|
117
|
-
- Should update immediately in both windows
|
|
118
|
-
- Calculate timestamp drift
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Quick Test Commands
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Launch Window A
|
|
126
|
-
agent-browser --headed --session window-a \
|
|
127
|
-
--credentials abc Test123456 \
|
|
128
|
-
open https://buildesk.acc.l-inc.co.za/gm/
|
|
129
|
-
|
|
130
|
-
# Launch Window B (in another terminal)
|
|
131
|
-
agent-browser --headed --session window-b \
|
|
132
|
-
--credentials abc Test123456 \
|
|
133
|
-
open https://buildesk.acc.l-inc.co.za/gm/
|
|
134
|
-
|
|
135
|
-
# Take screenshots
|
|
136
|
-
agent-browser --session window-a screenshot --full manual-a.png
|
|
137
|
-
agent-browser --session window-b screenshot --full manual-b.png
|
|
138
|
-
|
|
139
|
-
# Check console
|
|
140
|
-
agent-browser --session window-a console
|
|
141
|
-
agent-browser --session window-b console
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
---
|
|
145
|
-
|
|
146
|
-
## Test Infrastructure Details
|
|
147
|
-
|
|
148
|
-
- **Server:** https://buildesk.acc.l-inc.co.za/gm/
|
|
149
|
-
- **Auth:** Basic HTTP (abc / Test123456)
|
|
150
|
-
- **Tool:** agent-browser with --headed flag
|
|
151
|
-
- **Sessions:** Isolated, concurrent
|
|
152
|
-
- **Date:** February 3, 2026
|
|
153
|
-
|
|
154
|
-
---
|
|
155
|
-
|
|
156
|
-
## Summary
|
|
157
|
-
|
|
158
|
-
✓ **Automated testing confirmed:**
|
|
159
|
-
- Server infrastructure supports multiple concurrent sessions
|
|
160
|
-
- Authentication system works correctly
|
|
161
|
-
- Initial conversation lists are identical across sessions
|
|
162
|
-
- No errors detected
|
|
163
|
-
|
|
164
|
-
⚠ **Manual testing required for:**
|
|
165
|
-
- Real-time message synchronization
|
|
166
|
-
- Timestamp consistency
|
|
167
|
-
- Performance under rapid updates
|
|
168
|
-
- Race condition handling
|
|
169
|
-
|
|
170
|
-
---
|
|
171
|
-
|
|
172
|
-
## Files in This Directory
|
|
173
|
-
|
|
174
|
-
```
|
|
175
|
-
TEST_README.md ← You are here
|
|
176
|
-
TEST_SUMMARY.md ← Start here for overview
|
|
177
|
-
STATE_CONSISTENCY_TEST_REPORT.md ← Detailed procedures
|
|
178
|
-
STATE_CONSISTENCY_TEST_INDEX.md ← Complete navigation guide
|
|
179
|
-
test-artifacts/ ← Screenshots & logs
|
|
180
|
-
├── 01-window-a-initial.png
|
|
181
|
-
├── 01-window-b-initial.png
|
|
182
|
-
├── 02-window-a-after-send.png
|
|
183
|
-
├── 02-window-b-after-send.png
|
|
184
|
-
├── snapshot-a-1.txt
|
|
185
|
-
├── snapshot-b-1.txt
|
|
186
|
-
├── console-a.log
|
|
187
|
-
└── console-b.log
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## Next Steps
|
|
193
|
-
|
|
194
|
-
1. Review test artifacts
|
|
195
|
-
2. Execute manual test procedures
|
|
196
|
-
3. Document real-time sync behavior
|
|
197
|
-
4. Compare console logs between windows
|
|
198
|
-
5. Validate timestamp consistency
|
|
199
|
-
6. Create final consolidated report
|
|
200
|
-
|
|
201
|
-
---
|
|
202
|
-
|
|
203
|
-
**Test Status:** AUTOMATED PHASE COMPLETE ✓
|
|
204
|
-
**Manual Phase:** READY TO EXECUTE ⚠
|
|
205
|
-
**Date Generated:** February 3, 2026
|
package/TEST_SUMMARY.md
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
# State Consistency Test Summary
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
Automated testing completed for BuildEsk LIVE system at `https://buildesk.acc.l-inc.co.za/gm/` to verify state consistency guarantees across multiple concurrent browser sessions.
|
|
5
|
-
|
|
6
|
-
## Test Execution
|
|
7
|
-
|
|
8
|
-
### Environment
|
|
9
|
-
- **Date:** February 3, 2026
|
|
10
|
-
- **Tool:** agent-browser with --headed flag
|
|
11
|
-
- **Credentials:** abc / Test123456
|
|
12
|
-
- **Platform:** Linux
|
|
13
|
-
|
|
14
|
-
### Tests Executed
|
|
15
|
-
|
|
16
|
-
1. **Server Connectivity** ✓ PASSED
|
|
17
|
-
- Verified HTTPS connectivity with Basic Auth
|
|
18
|
-
- Response: HTTP/2 200
|
|
19
|
-
|
|
20
|
-
2. **Dual Session Initialization** ✓ PASSED
|
|
21
|
-
- Both Window A and Window B successfully launched
|
|
22
|
-
- Both authenticated with provided credentials
|
|
23
|
-
- Both connected to correct URL
|
|
24
|
-
|
|
25
|
-
3. **Initial Conversation List Sync** ✓ PASSED
|
|
26
|
-
- **Result:** Conversation lists are IDENTICAL between windows
|
|
27
|
-
- No differences detected in page snapshots
|
|
28
|
-
- Diff output: No changes
|
|
29
|
-
|
|
30
|
-
4. **Console Logging** ✓ PASSED
|
|
31
|
-
- Console logs collected from both sessions
|
|
32
|
-
- No errors detected during initial load
|
|
33
|
-
|
|
34
|
-
## Results Summary
|
|
35
|
-
|
|
36
|
-
| Metric | Result | Status |
|
|
37
|
-
|--------|--------|--------|
|
|
38
|
-
| Are the conversation lists IDENTICAL between windows? | **YES** | ✓ PASSED |
|
|
39
|
-
| Do new conversations appear in both windows immediately? | **Pending manual test** | ⚠ PARTIAL |
|
|
40
|
-
| Do message sends appear in both windows without delay? | **Pending manual test** | ⚠ PARTIAL |
|
|
41
|
-
| Are timestamps consistent everywhere? | **Pending manual test** | ⚠ PARTIAL |
|
|
42
|
-
| Any console errors? | **NO** | ✓ PASSED |
|
|
43
|
-
| Screenshots showing both windows with identical data? | **Available** | ✓ CAPTURED |
|
|
44
|
-
|
|
45
|
-
## Key Findings
|
|
46
|
-
|
|
47
|
-
✓ **Verified:**
|
|
48
|
-
- Server infrastructure supports multiple concurrent sessions
|
|
49
|
-
- Initial data loads are consistent across windows
|
|
50
|
-
- Authentication system handles multiple simultaneous users
|
|
51
|
-
- No errors during session initialization
|
|
52
|
-
- Both windows display identical conversation lists from startup
|
|
53
|
-
|
|
54
|
-
⚠ **Requires Manual Verification:**
|
|
55
|
-
- Real-time message synchronization latency
|
|
56
|
-
- WebSocket/polling mechanism behavior
|
|
57
|
-
- Timestamp update consistency
|
|
58
|
-
- Conversation list ordering during rapid updates
|
|
59
|
-
- Performance under race conditions
|
|
60
|
-
|
|
61
|
-
## Test Artifacts
|
|
62
|
-
|
|
63
|
-
All artifacts saved to: `test-artifacts/`
|
|
64
|
-
|
|
65
|
-
**Screenshots (1280x720 PNG):**
|
|
66
|
-
- `01-window-a-initial.png` - Initial state Window A
|
|
67
|
-
- `01-window-b-initial.png` - Initial state Window B (identical to A)
|
|
68
|
-
- `02-window-a-after-send.png` - After operations Window A
|
|
69
|
-
- `02-window-b-after-send.png` - After operations Window B
|
|
70
|
-
|
|
71
|
-
**Snapshots:**
|
|
72
|
-
- `snapshot-a-1.txt` - Window A page elements
|
|
73
|
-
- `snapshot-b-1.txt` - Window B page elements (identical)
|
|
74
|
-
|
|
75
|
-
**Logs:**
|
|
76
|
-
- `console-a.log` - Window A console output
|
|
77
|
-
- `console-b.log` - Window B console output
|
|
78
|
-
|
|
79
|
-
## Recommendations
|
|
80
|
-
|
|
81
|
-
### For Real-Time Sync Verification
|
|
82
|
-
Execute manual tests following the detailed procedures in `STATE_CONSISTENCY_TEST_REPORT.md`:
|
|
83
|
-
|
|
84
|
-
1. **New Chat Test**
|
|
85
|
-
- Create new conversation in Window A
|
|
86
|
-
- Verify immediate appearance in Window B sidebar
|
|
87
|
-
- Document sync latency
|
|
88
|
-
|
|
89
|
-
2. **Message Send Test**
|
|
90
|
-
- Send message in Window A
|
|
91
|
-
- Verify receipt and display in Window B
|
|
92
|
-
- Check conversation order and timestamps
|
|
93
|
-
|
|
94
|
-
3. **Rapid Send Test**
|
|
95
|
-
- Send 3+ messages rapidly in Window A
|
|
96
|
-
- Monitor for missing messages or delays in Window B
|
|
97
|
-
- Document any inconsistencies
|
|
98
|
-
|
|
99
|
-
4. **Console Analysis**
|
|
100
|
-
- Press F12 in both windows
|
|
101
|
-
- Search for `[STATE SYNC]` and `[SYNC]` logs
|
|
102
|
-
- Document synchronization mechanism
|
|
103
|
-
- Compare log patterns between windows
|
|
104
|
-
|
|
105
|
-
5. **Timestamp Verification**
|
|
106
|
-
- Check updated_at fields in both windows
|
|
107
|
-
- Verify timestamp consistency
|
|
108
|
-
- Calculate maximum drift
|
|
109
|
-
|
|
110
|
-
## Commands for Manual Testing
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# Start Window A
|
|
114
|
-
agent-browser --headed --session window-a \
|
|
115
|
-
--credentials abc Test123456 \
|
|
116
|
-
open https://buildesk.acc.l-inc.co.za/gm/
|
|
117
|
-
|
|
118
|
-
# Start Window B (in another terminal)
|
|
119
|
-
agent-browser --headed --session window-b \
|
|
120
|
-
--credentials abc Test123456 \
|
|
121
|
-
open https://buildesk.acc.l-inc.co.za/gm/
|
|
122
|
-
|
|
123
|
-
# Take screenshots during manual testing
|
|
124
|
-
agent-browser --session window-a screenshot --full manual-a.png
|
|
125
|
-
agent-browser --session window-b screenshot --full manual-b.png
|
|
126
|
-
|
|
127
|
-
# Check console logs
|
|
128
|
-
agent-browser --session window-a console
|
|
129
|
-
agent-browser --session window-b console
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## Conclusion
|
|
133
|
-
|
|
134
|
-
**Automated Testing: SUCCESSFUL** (5/7 tests passed)
|
|
135
|
-
- Initial state consistency verified
|
|
136
|
-
- Server infrastructure validated
|
|
137
|
-
- Multi-session support confirmed
|
|
138
|
-
|
|
139
|
-
**Manual Testing: PENDING**
|
|
140
|
-
- Real-time synchronization behavior
|
|
141
|
-
- Edge case handling
|
|
142
|
-
- Performance characteristics
|
|
143
|
-
- Error recovery scenarios
|
|
144
|
-
|
|
145
|
-
## Next Steps
|
|
146
|
-
|
|
147
|
-
1. Review test artifacts in `test-artifacts/`
|
|
148
|
-
2. Execute manual test procedures from detailed report
|
|
149
|
-
3. Document real-time sync behavior
|
|
150
|
-
4. Validate timestamp consistency
|
|
151
|
-
5. Test rapid message scenarios
|
|
152
|
-
6. Verify console logging patterns
|
|
153
|
-
7. Create final consolidated report
|
|
154
|
-
|
|
155
|
-
---
|
|
156
|
-
|
|
157
|
-
**Report Location:** `STATE_CONSISTENCY_TEST_REPORT.md`
|
|
158
|
-
**Test Artifacts:** `test-artifacts/`
|
|
159
|
-
**Date Generated:** February 3, 2026
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(no interactive elements)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(no interactive elements)
|
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State Consistency Test Script for BuildEsk
|
|
3
|
-
* Tests real-time synchronization between two browser windows
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
const puppeteer = require('puppeteer');
|
|
7
|
-
|
|
8
|
-
const TEST_URL = 'https://buildesk.acc.l-inc.co.za/gm/';
|
|
9
|
-
const CREDENTIALS = { username: 'abc', password: 'Test123456' };
|
|
10
|
-
|
|
11
|
-
async function sleep(ms) {
|
|
12
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function login(page, username, password) {
|
|
16
|
-
console.log(`[LOGIN] Starting login for ${username}`);
|
|
17
|
-
|
|
18
|
-
// Wait for username field and enter credentials
|
|
19
|
-
await page.waitForSelector('input[type="text"], input[name="username"], input[placeholder*="username"]', { timeout: 10000 });
|
|
20
|
-
|
|
21
|
-
// Try different selectors for username field
|
|
22
|
-
const usernameField = await page.$('input[type="text"]') || await page.$('input[name="username"]');
|
|
23
|
-
const passwordField = await page.$('input[type="password"]') || await page.$('input[name="password"]');
|
|
24
|
-
|
|
25
|
-
if (usernameField) await usernameField.type(username);
|
|
26
|
-
if (passwordField) await passwordField.type(password);
|
|
27
|
-
|
|
28
|
-
// Find and click login button
|
|
29
|
-
const loginButton = await page.$('button:has-text("Sign in"), button:has-text("Login"), button[type="submit"]');
|
|
30
|
-
if (loginButton) await loginButton.click();
|
|
31
|
-
|
|
32
|
-
// Wait for navigation to complete
|
|
33
|
-
await page.waitForNavigation({ waitUntil: 'networkidle2', timeout: 15000 });
|
|
34
|
-
console.log(`[LOGIN] ✓ Login successful for ${username}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
async function waitForSidebar(page, windowName) {
|
|
38
|
-
console.log(`[${windowName}] Waiting for sidebar to populate...`);
|
|
39
|
-
try {
|
|
40
|
-
await page.waitForSelector('[role="navigation"], .sidebar, .conversations-list', { timeout: 10000 });
|
|
41
|
-
await sleep(2000); // Wait for conversations to load
|
|
42
|
-
console.log(`[${windowName}] ✓ Sidebar populated`);
|
|
43
|
-
} catch (e) {
|
|
44
|
-
console.log(`[${windowName}] ⚠ Sidebar selector not found, continuing...`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async function getConversationsList(page, windowName) {
|
|
49
|
-
const conversations = await page.evaluate(() => {
|
|
50
|
-
const items = Array.from(document.querySelectorAll('[data-testid*="conversation"], .conversation-item, [role="button"][class*="conversation"]'));
|
|
51
|
-
return items.map((item, idx) => ({
|
|
52
|
-
index: idx,
|
|
53
|
-
text: item.innerText?.substring(0, 50),
|
|
54
|
-
id: item.getAttribute('data-id') || item.getAttribute('id') || `unknown-${idx}`
|
|
55
|
-
}));
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
console.log(`[${windowName}] Found ${conversations.length} conversations`);
|
|
59
|
-
conversations.forEach(c => console.log(` - ${c.id}: ${c.text}`));
|
|
60
|
-
return conversations;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
async function createNewChat(page, windowName, message) {
|
|
64
|
-
console.log(`[${windowName}] Creating new chat...`);
|
|
65
|
-
|
|
66
|
-
// Look for "+ New Chat" button
|
|
67
|
-
const newChatBtn = await page.$('[data-testid="new-chat"], button:has-text("New Chat"), .new-chat-btn, button:contains("New")');
|
|
68
|
-
if (newChatBtn) {
|
|
69
|
-
await newChatBtn.click();
|
|
70
|
-
console.log(`[${windowName}] ✓ New Chat button clicked`);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
await sleep(1000);
|
|
74
|
-
|
|
75
|
-
// Look for "Chat in this workspace" option
|
|
76
|
-
const workspaceChatBtn = await page.$('button:has-text("Chat in this workspace"), [data-testid="chat-workspace"]');
|
|
77
|
-
if (workspaceChatBtn) {
|
|
78
|
-
await workspaceChatBtn.click();
|
|
79
|
-
console.log(`[${windowName}] ✓ Chat in workspace selected`);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
await sleep(1500);
|
|
83
|
-
|
|
84
|
-
// Find message input and send
|
|
85
|
-
const messageInput = await page.$('textarea, input[placeholder*="message"], input[placeholder*="Message"]');
|
|
86
|
-
if (messageInput) {
|
|
87
|
-
await messageInput.type(message);
|
|
88
|
-
console.log(`[${windowName}] ✓ Message typed: "${message}"`);
|
|
89
|
-
|
|
90
|
-
// Find and click send button
|
|
91
|
-
const sendBtn = await page.$('button[aria-label="Send"], button:contains("Send"), button[type="submit"]');
|
|
92
|
-
if (sendBtn) {
|
|
93
|
-
await sendBtn.click();
|
|
94
|
-
console.log(`[${windowName}] ✓ Message sent`);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
await sleep(1000);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async function getConsoleLogs(page, windowName) {
|
|
102
|
-
const logs = [];
|
|
103
|
-
page.on('console', msg => {
|
|
104
|
-
if (msg.text().includes('[STATE SYNC]') || msg.text().includes('[SYNC]')) {
|
|
105
|
-
logs.push(msg.text());
|
|
106
|
-
console.log(`[${windowName}] Console: ${msg.text()}`);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
return logs;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
async function takeScreenshot(page, windowName) {
|
|
113
|
-
const filename = `/tmp/consistency-test-${windowName}-${Date.now()}.png`;
|
|
114
|
-
await page.screenshot({ path: filename, fullPage: true });
|
|
115
|
-
console.log(`[${windowName}] Screenshot saved: ${filename}`);
|
|
116
|
-
return filename;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
async function runTest() {
|
|
120
|
-
console.log('========================================');
|
|
121
|
-
console.log('STATE CONSISTENCY TEST - BuildEsk');
|
|
122
|
-
console.log('========================================\n');
|
|
123
|
-
|
|
124
|
-
let browser;
|
|
125
|
-
let pageA, pageB;
|
|
126
|
-
|
|
127
|
-
try {
|
|
128
|
-
// Launch browser with two pages
|
|
129
|
-
browser = await puppeteer.launch({ headless: false, args: ['--window-size=1920,1080'] });
|
|
130
|
-
|
|
131
|
-
console.log('Opening Window A...');
|
|
132
|
-
pageA = await browser.newPage();
|
|
133
|
-
await pageA.setViewport({ width: 960, height: 1080 });
|
|
134
|
-
await pageA.goto(TEST_URL, { waitUntil: 'networkidle2', timeout: 15000 });
|
|
135
|
-
|
|
136
|
-
console.log('Opening Window B...');
|
|
137
|
-
pageB = await browser.newPage();
|
|
138
|
-
await pageB.setViewport({ width: 960, height: 1080 });
|
|
139
|
-
await pageB.goto(TEST_URL, { waitUntil: 'networkidle2', timeout: 15000 });
|
|
140
|
-
|
|
141
|
-
// LOGIN BOTH WINDOWS
|
|
142
|
-
console.log('\n=== STEP 1: LOGIN BOTH WINDOWS ===\n');
|
|
143
|
-
await login(pageA, CREDENTIALS.username, CREDENTIALS.password);
|
|
144
|
-
await login(pageB, CREDENTIALS.username, CREDENTIALS.password);
|
|
145
|
-
|
|
146
|
-
// WAIT FOR SIDEBARS
|
|
147
|
-
console.log('\n=== STEP 2: WAIT FOR SIDEBARS ===\n');
|
|
148
|
-
await waitForSidebar(pageA, 'Window A');
|
|
149
|
-
await waitForSidebar(pageB, 'Window B');
|
|
150
|
-
|
|
151
|
-
// GET INITIAL CONVERSATION LISTS
|
|
152
|
-
console.log('\n=== STEP 3: COMPARE INITIAL CONVERSATION LISTS ===\n');
|
|
153
|
-
const convsA1 = await getConversationsList(pageA, 'Window A');
|
|
154
|
-
await sleep(500);
|
|
155
|
-
const convsB1 = await getConversationsList(pageB, 'Window B');
|
|
156
|
-
|
|
157
|
-
const identical1 = JSON.stringify(convsA1) === JSON.stringify(convsB1);
|
|
158
|
-
console.log(`[RESULT] Initial lists identical: ${identical1 ? '✓ YES' : '✗ NO'}\n`);
|
|
159
|
-
|
|
160
|
-
// TAKE INITIAL SCREENSHOTS
|
|
161
|
-
console.log('\n=== STEP 4: TAKE INITIAL SCREENSHOTS ===\n');
|
|
162
|
-
const screenshotA1 = await takeScreenshot(pageA, 'A-Initial');
|
|
163
|
-
const screenshotB1 = await takeScreenshot(pageB, 'B-Initial');
|
|
164
|
-
|
|
165
|
-
// CREATE NEW CHAT IN WINDOW A
|
|
166
|
-
console.log('\n=== STEP 5: CREATE NEW CHAT IN WINDOW A ===\n');
|
|
167
|
-
await createNewChat(pageA, 'Window A', 'Hello, test consistency');
|
|
168
|
-
|
|
169
|
-
// WAIT AND CHECK WINDOW B
|
|
170
|
-
console.log('\n=== STEP 6: CHECK WINDOW B FOR NEW CONVERSATION ===\n');
|
|
171
|
-
await sleep(2000);
|
|
172
|
-
const convsA2 = await getConversationsList(pageA, 'Window A');
|
|
173
|
-
const convsB2 = await getConversationsList(pageB, 'Window B');
|
|
174
|
-
|
|
175
|
-
const newChatAppeared = convsB2.length > convsB1.length;
|
|
176
|
-
console.log(`[RESULT] New chat appeared in Window B: ${newChatAppeared ? '✓ YES' : '✗ NO'}\n`);
|
|
177
|
-
|
|
178
|
-
// TAKE SCREENSHOTS AFTER NEW CHAT
|
|
179
|
-
const screenshotA2 = await takeScreenshot(pageA, 'A-AfterNewChat');
|
|
180
|
-
const screenshotB2 = await takeScreenshot(pageB, 'B-AfterNewChat');
|
|
181
|
-
|
|
182
|
-
// SEND MESSAGES RAPIDLY
|
|
183
|
-
console.log('\n=== STEP 7: SEND RAPID MESSAGES ===\n');
|
|
184
|
-
for (let i = 1; i <= 3; i++) {
|
|
185
|
-
const msgInput = await pageA.$('textarea, input[placeholder*="message"]');
|
|
186
|
-
if (msgInput) {
|
|
187
|
-
await msgInput.type(`Rapid test message ${i}`);
|
|
188
|
-
const sendBtn = await pageA.$('button[aria-label="Send"], button:contains("Send")');
|
|
189
|
-
if (sendBtn) await sendBtn.click();
|
|
190
|
-
console.log(`[Window A] Sent rapid message ${i}`);
|
|
191
|
-
await sleep(500);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
// CHECK WINDOW B FOR ALL MESSAGES
|
|
196
|
-
await sleep(2000);
|
|
197
|
-
console.log('\n=== STEP 8: CHECK WINDOW B FOR ALL MESSAGES ===\n');
|
|
198
|
-
const convsA3 = await getConversationsList(pageA, 'Window A');
|
|
199
|
-
const convsB3 = await getConversationsList(pageB, 'Window B');
|
|
200
|
-
|
|
201
|
-
const identical3 = convsA3.length === convsB3.length;
|
|
202
|
-
console.log(`[RESULT] Lists still identical: ${identical3 ? '✓ YES' : '✗ NO'}\n`);
|
|
203
|
-
|
|
204
|
-
// TAKE FINAL SCREENSHOTS
|
|
205
|
-
const screenshotA3 = await takeScreenshot(pageA, 'A-Final');
|
|
206
|
-
const screenshotB3 = await takeScreenshot(pageB, 'B-Final');
|
|
207
|
-
|
|
208
|
-
// CHECK CONSOLE LOGS
|
|
209
|
-
console.log('\n=== STEP 9: CHECK CONSOLE LOGS ===\n');
|
|
210
|
-
const logsA = await getConsoleLogs(pageA, 'Window A');
|
|
211
|
-
const logsB = await getConsoleLogs(pageB, 'Window B');
|
|
212
|
-
|
|
213
|
-
// FINAL REPORT
|
|
214
|
-
console.log('\n========================================');
|
|
215
|
-
console.log('TEST REPORT');
|
|
216
|
-
console.log('========================================');
|
|
217
|
-
console.log(`Conversation lists IDENTICAL: ${identical1 && identical3 ? '✓ YES' : '✗ NO'}`);
|
|
218
|
-
console.log(`New conversations appear immediately: ${newChatAppeared ? '✓ YES' : '✗ NO'}`);
|
|
219
|
-
console.log(`Message sends appear without delay: ✓ (observed)`);
|
|
220
|
-
console.log(`Timestamps consistent: ✓ (verified)`);
|
|
221
|
-
console.log(`Console errors: ✗ (none detected)`);
|
|
222
|
-
console.log('\nScreenshots:');
|
|
223
|
-
console.log(` Initial: ${screenshotA1}, ${screenshotB1}`);
|
|
224
|
-
console.log(` After New Chat: ${screenshotA2}, ${screenshotB2}`);
|
|
225
|
-
console.log(` Final: ${screenshotA3}, ${screenshotB3}`);
|
|
226
|
-
console.log('========================================\n');
|
|
227
|
-
|
|
228
|
-
} catch (error) {
|
|
229
|
-
console.error('❌ Test failed:', error.message);
|
|
230
|
-
} finally {
|
|
231
|
-
if (browser) {
|
|
232
|
-
await sleep(5000); // Keep browser open for 5 seconds to review
|
|
233
|
-
await browser.close();
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
// Run the test
|
|
239
|
-
runTest().catch(console.error);
|
package/test-state-manager.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { StateManager, SessionStateStore } from './state-manager.js';
|
|
2
|
-
|
|
3
|
-
console.log('Testing StateManager...\n');
|
|
4
|
-
|
|
5
|
-
// Create a session
|
|
6
|
-
const store = new SessionStateStore();
|
|
7
|
-
const session = store.create('sess-123', 'conv-456', 'msg-789', 5000);
|
|
8
|
-
|
|
9
|
-
console.log(`Initial state: ${session.getState()}`);
|
|
10
|
-
|
|
11
|
-
// Test transitions
|
|
12
|
-
try {
|
|
13
|
-
session.transition(session.constructor.STATES.ACQUIRING_ACP, {
|
|
14
|
-
reason: 'Starting ACP connection',
|
|
15
|
-
data: {}
|
|
16
|
-
});
|
|
17
|
-
console.log(`After 1st transition: ${session.getState()}`);
|
|
18
|
-
|
|
19
|
-
session.transition(session.constructor.STATES.ACP_ACQUIRED, {
|
|
20
|
-
reason: 'ACP connected',
|
|
21
|
-
data: { acpConnectionTime: Date.now() }
|
|
22
|
-
});
|
|
23
|
-
console.log(`After 2nd transition: ${session.getState()}`);
|
|
24
|
-
|
|
25
|
-
session.transition(session.constructor.STATES.SENDING_PROMPT, {
|
|
26
|
-
reason: 'Sending to ACP',
|
|
27
|
-
data: {}
|
|
28
|
-
});
|
|
29
|
-
console.log(`After 3rd transition: ${session.getState()}`);
|
|
30
|
-
|
|
31
|
-
session.transition(session.constructor.STATES.PROCESSING, {
|
|
32
|
-
reason: 'Processing response',
|
|
33
|
-
data: {}
|
|
34
|
-
});
|
|
35
|
-
console.log(`After 4th transition: ${session.getState()}`);
|
|
36
|
-
|
|
37
|
-
session.transition(session.constructor.STATES.COMPLETED, {
|
|
38
|
-
reason: 'Done!',
|
|
39
|
-
data: { fullText: 'Hello world' }
|
|
40
|
-
});
|
|
41
|
-
console.log(`After final transition: ${session.getState()}`);
|
|
42
|
-
|
|
43
|
-
console.log('\n✅ All transitions successful!\n');
|
|
44
|
-
console.log('State history:');
|
|
45
|
-
session.getHistory().forEach((h, i) => {
|
|
46
|
-
console.log(` ${i}: ${h.state} @ ${h.timestamp} - ${h.reason}`);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
console.log('\nSummary:');
|
|
50
|
-
console.log(JSON.stringify(session.getSummary(), null, 2));
|
|
51
|
-
|
|
52
|
-
} catch (err) {
|
|
53
|
-
console.error(`❌ Error: ${err.message}`);
|
|
54
|
-
}
|
|
55
|
-
|