Commit a46f967
fix(tests): flaky Chat Client E2E tests and failing CreateServer unit test (#8887)
* Initial plan
* Fix flaky and failing Chat Client E2E tests
- Fix 5 flaky tests (strict mode violations) in username-display.spec.ts and
message-variations.spec.ts by adding .first() to getByText() locators.
The SSE mock echo response 'I received your message: ...' contains the
sent text, causing Playwright to find 2 elements and fail strict mode.
- Fix consistently failing test 'should disable input while waiting for
response' in input-validation.spec.ts by adding a test-specific route
handler for message/stream that delays the response by 3 seconds,
ensuring the agent request stays in-flight long enough to observe the
disabled input state (previously route.continue() failed immediately
with no real backend, causing the input to re-enable too quickly).
- Extract delay as named constant MESSAGE_STREAM_MOCK_DELAY_MS for clarity.
Co-authored-by: ccastrotrejo <102700317+ccastrotrejo@users.noreply.github.com>
* Fix unit test: CreateServer closes panel after successful submission
Two related fixes:
1. libs/designer/src/lib/ui/mcp/panel/server/create.tsx:
Move dispatch(closePanel()) inside the try block (after await onUpdate())
instead of after the finally block. This is semantically correct (panel
should only close on success, not when onUpdate throws) and avoids subtle
Promise chain timing issues in async tests with React 18 + jsdom.
2. libs/designer/src/lib/ui/mcp/panel/server/__test__/create.spec.tsx:
Rewrite "closes panel after successful submission" test to use
fireEvent.change instead of userEvent.type. Fluent UI's tabster
focus-trapping library intercepts keyboard events fired by userEvent.type,
causing only partial text to be typed (CI evidence: value="T" in HTML
snapshot instead of value="TestServer"). Use waitFor to wait for the
submit button to become enabled before clicking, matching the established
pattern in the file (test "calls onUpdate with correct data" at line 472).
Co-authored-by: ccastrotrejo <102700317+ccastrotrejo@users.noreply.github.com>
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ccastrotrejo <102700317+ccastrotrejo@users.noreply.github.com>1 parent 1771731 commit a46f967
File tree
5 files changed
+65
-14
lines changed- e2e/chatClient/tests/features
- authentication
- messaging
- libs/designer/src/lib/ui/mcp/panel/server
- __test__
5 files changed
+65
-14
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
208 | | - | |
| 208 | + | |
| 209 | + | |
209 | 210 | | |
210 | 211 | | |
211 | 212 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
236 | | - | |
| 237 | + | |
| 238 | + | |
237 | 239 | | |
238 | 240 | | |
239 | 241 | | |
| |||
260 | 262 | | |
261 | 263 | | |
262 | 264 | | |
263 | | - | |
| 265 | + | |
| 266 | + | |
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
Lines changed: 46 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
276 | 280 | | |
277 | 281 | | |
278 | 282 | | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
279 | 325 | | |
280 | 326 | | |
281 | 327 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
289 | 289 | | |
290 | 290 | | |
291 | 291 | | |
292 | | - | |
| 292 | + | |
| 293 | + | |
293 | 294 | | |
294 | 295 | | |
295 | 296 | | |
| |||
Lines changed: 9 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
528 | 528 | | |
529 | 529 | | |
530 | 530 | | |
531 | | - | |
532 | | - | |
533 | 531 | | |
534 | 532 | | |
535 | 533 | | |
536 | 534 | | |
537 | 535 | | |
538 | | - | |
539 | 536 | | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
544 | 542 | | |
545 | 543 | | |
546 | | - | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| 277 | + | |
277 | 278 | | |
278 | 279 | | |
279 | 280 | | |
280 | 281 | | |
281 | 282 | | |
282 | | - | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
0 commit comments