Skip to content

Commit 2a910fb

Browse files
committed
feat: multiparty conference tests updated
1 parent 8b7aec5 commit 2a910fb

23 files changed

Lines changed: 1419 additions & 250 deletions

AGENTS.md

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,32 @@ If the developer's message contains multiple distinct task types (for example, "
3232
### Task Types
3333

3434
**A. Create New Widget**
35+
3536
- Developer wants to build a completely new widget from scratch
3637
- **Route to:** [templates/new-widget/00-master.md](./ai-docs/templates/new-widget/00-master.md)
3738
- **Follow:** All 7 modules (pre-questions → validation)
3839
- **⚠️ MANDATORY FIRST STEP:** Collect design input (see below)
3940

4041
**B. Fix Bug in Existing Widget**
42+
4143
- Developer reports a bug or issue in existing code
4244
- **Route to:** [templates/existing-widget/bug-fix.md](./ai-docs/templates/existing-widget/bug-fix.md)
4345
- **Follow:** Bug fix workflow with root cause analysis
4446

4547
**C. Add Feature to Existing Widget**
48+
4649
- Developer wants to enhance existing widget with new functionality
4750
- **Route to:** [templates/existing-widget/feature-enhancement.md](./ai-docs/templates/existing-widget/feature-enhancement.md)
4851
- **Follow:** Feature addition workflow with backward compatibility
4952

5053
**D. Generate/Update Documentation Only**
54+
5155
- Developer needs documentation for existing code
5256
- **Route to:** [templates/documentation/create-agent-md.md](./ai-docs/templates/documentation/create-agent-md.md) and [templates/documentation/create-architecture-md.md](./ai-docs/templates/documentation/create-architecture-md.md)
5357
- **Follow:** Documentation templates (reusable for all packages)
5458

5559
**E. Understanding Architecture**
60+
5661
- Developer needs to understand how something works
5762
- **Read:** That scope's `ai-docs/AGENTS.md` (usage) and `ai-docs/ARCHITECTURE.md` (technical details); use [Package and widget ai-docs reference](#package-and-widget-ai-docs-reference) to find the path.
5863
- **Available for:** station-login, user-state, store, cc-components, cc-widgets, ui-logging, test-fixtures; for task package use per-widget ai-docs (CallControl, IncomingTask, OutdialCall, TaskList).
@@ -67,21 +72,21 @@ If the developer's message contains multiple distinct task types (for example, "
6772

6873
```typescript
6974
// ❌ WRONG - Circular dependencies
70-
import { Widget } from '@webex/cc-widgets'; // In widget package code
71-
import { Widget } from '@webex/cc-widget-name'; // In cc-components code
75+
import {Widget} from '@webex/cc-widgets'; // In widget package code
76+
import {Widget} from '@webex/cc-widget-name'; // In cc-components code
7277
```
7378

7479
**ALWAYS use this pattern:**
7580

7681
```typescript
7782
// ✅ CORRECT - Proper dependency flow
7883
// In widget code:
79-
import { Component } from '@webex/cc-components';
84+
import {Component} from '@webex/cc-components';
8085
import store from '@webex/cc-store';
81-
import { withMetrics } from '@webex/cc-ui-logging';
86+
import {withMetrics} from '@webex/cc-ui-logging';
8287

8388
// In cc-widgets aggregator (ONLY):
84-
import { Widget } from '@webex/cc-widget-name';
89+
import {Widget} from '@webex/cc-widget-name';
8590
```
8691

8792
**Dependency Flow (One Direction Only):**
@@ -106,10 +111,12 @@ cc-widgets → widget packages → cc-components → store → SDK
106111
#### Required Input (ONE of these):
107112

108113
1. **Figma Link/File**
114+
109115
- Share Figma link or file
110116
- LLM will extract design tokens, components, interactions
111117

112118
2. **Screenshot/Mockup**
119+
113120
- Upload image of desired widget UI
114121
- LLM will analyze colors, layout, components, spacing
115122

@@ -124,6 +131,7 @@ cc-widgets → widget packages → cc-components → store → SDK
124131
#### If Design Input Provided:
125132

126133
**Analyze and document:**
134+
127135
- **Colors:** Extract hex/RGB values or Momentum tokens
128136
- **Components:** Identify Momentum UI components to use
129137
- **Layout:** Grid, flex, spacing patterns (8px/0.5rem grid)
@@ -177,7 +185,9 @@ Before generating or changing any code, you MUST complete the **pre-step section
177185
**Before generating code, load appropriate context:**
178186

179187
### Always Read (Minimal Context)
188+
180189
1. **Pattern documentation** - [patterns/](./ai-docs/patterns/) folder
190+
181191
- [typescript-patterns.md](./ai-docs/patterns/typescript-patterns.md) - Type safety, naming conventions
182192
- [react-patterns.md](./ai-docs/patterns/react-patterns.md) - Component patterns, hooks
183193
- [mobx-patterns.md](./ai-docs/patterns/mobx-patterns.md) - State management with observer HOC
@@ -208,10 +218,23 @@ Before generating or changing any code, you MUST complete the **pre-step section
208218
### Conditionally Read
209219

210220
**If using SDK APIs:**
221+
211222
- Scan: [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
212223
- Find available methods, events, types
213224
- Check method signatures before using
214225

226+
**If modifying store:**
227+
228+
- Read: `packages/contact-center/store/ai-docs/AGENTS.md`
229+
- Read: `packages/contact-center/store/ai-docs/ARCHITECTURE.md`
230+
231+
**If creating/using components:**
232+
233+
- Read: `packages/contact-center/cc-components/ai-docs/AGENTS.md`
234+
235+
**If working with metrics/logging:**
236+
237+
- Read: `packages/contact-center/ui-logging/ai-docs/AGENTS.md`
215238
---
216239

217240
## Step 3: SDK API Consultation (Before Code Generation)
@@ -223,6 +246,7 @@ Before generating or changing any code, you MUST complete the **pre-step section
223246
#### 1. Identify Required SDK Functionality
224247

225248
Based on widget requirements, list needed operations:
249+
226250
- Making calls? → Search: "call", "dial", "telephony", "outdial"
227251
- Fetching agents? → Search: "agent", "buddy", "team"
228252
- Managing tasks? → Search: "task", "interaction", "contact"
@@ -233,13 +257,15 @@ Based on widget requirements, list needed operations:
233257
**File:** [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
234258

235259
**Search Strategy:**
260+
236261
- Use keyword search in JSON
237262
- Look for method names, descriptions
238263
- Check similar/related methods
239264

240265
#### 3. Verify API Signature
241266

242267
For each method found, confirm:
268+
243269
- ✅ Method name (exact spelling)
244270
- ✅ Parameters (names, types, required vs optional)
245271
- ✅ Return type
@@ -319,6 +345,7 @@ SDK (Contact Center API)
319345
```
320346

321347
**Key Rules:**
348+
322349
- Widget consumes SDK methods via the store (through a hook) — it NEVER calls the SDK directly
323350
- Component NEVER accesses store (receives props)
324351
- Always use `observer` HOC for widgets
@@ -335,6 +362,7 @@ SDK (Contact Center API)
335362
You must have already completed that template's pre-step section (Pre-Enhancement Questions, Pre-Fix Questions, or 01-pre-questions as applicable); if not, do that first.
336363

337364
**During code generation:**
365+
338366
1. Follow pattern documentation strictly
339367
2. Reference existing widgets for examples
340368
3. Use proper TypeScript types (no `any`)
@@ -440,6 +468,7 @@ yarn build
440468
```
441469

442470
**Common errors:**
471+
443472
- Missing types → Add type definitions
444473
- Import errors → Check paths and exports
445474
- Circular dependencies → Refactor imports
@@ -458,46 +487,60 @@ yarn build
458487
### Documentation to Consider
459488

460489
**If new widget created:**
490+
461491
- Generated via templates (AGENTS.md + ARCHITECTURE.md)
462492

463493
**If widget modified:**
494+
464495
- Update: `packages/contact-center/{widget-name}/ai-docs/AGENTS.md` (if API changed)
465496
- Update: `packages/contact-center/{widget-name}/ai-docs/ARCHITECTURE.md` (if architecture changed)
466497
- Add: New examples to AGENTS.md (if new use cases)
467498
- Update: Troubleshooting in ARCHITECTURE.md (if new issues discovered)
468499

469500
**If store modified:**
501+
470502
- Update: `packages/contact-center/store/ai-docs/AGENTS.md`
471503
- Update: `packages/contact-center/store/ai-docs/ARCHITECTURE.md`
472504

473505
**If component library modified:**
506+
474507
- Update: `packages/contact-center/cc-components/ai-docs/AGENTS.md`
475508

476509
**If new pattern established:**
510+
477511
- Update: Relevant pattern file in [patterns/](./ai-docs/patterns/)
478512

479513
**If architecture changed:**
514+
480515
- Update: Relevant architecture documentation as needed
481516

517+
**If Playwright E2E framework/docs changed:**
518+
519+
- Update: `playwright/ai-docs/AGENTS.md`
520+
- Update: `playwright/ai-docs/ARCHITECTURE.md`
521+
- Update relevant modules in: `ai-docs/templates/playwright/`
482522
---
483523

484524
## Step 7: Validation & Review
485525

486526
**Before marking task complete:**
487527

488528
1. **Run validation checks**
529+
489530
- Tests pass: `yarn test:unit`
490531
- Linting passes: `yarn test:styles`
491532
- Build succeeds: `yarn build`
492533

493534
2. **Code quality checks**
535+
494536
- Follows patterns
495537
- No layer violations
496538
- Error handling present
497539
- Types are correct
498540
- Code is precise and concise (no unnecessary complexity or dead code)
499541

500542
3. **Documentation checks**
543+
501544
- AGENTS.md updated if needed
502545
- ARCHITECTURE.md updated if needed
503546
- Examples work
@@ -540,16 +583,19 @@ ccWidgets/
540583
## Common Questions to Ask
541584

542585
**Before starting any work:**
586+
543587
- "What component/widget are you working on?"
544588
- "Is this a new widget, bug fix, or enhancement?"
545589
- "Do you have design specifications (Figma, screenshots)?"
546590

547591
**During code generation:**
592+
548593
- "Should I add/update tests?"
549594
- "Do you want examples in documentation?"
550595
- "Should I update the sample apps?"
551596

552597
**After code generation:**
598+
553599
- "The code is complete. Should I update documentation?"
554600
- "Would you like to review before I mark this complete?"
555601
- "Should I check for any other impacted components?"
@@ -561,12 +607,14 @@ ccWidgets/
561607
**Location:** [contact-centre-sdk-apis/contact-center.json](./contact-centre-sdk-apis/contact-center.json)
562608

563609
**Contents:**
610+
564611
- All exposed SDK APIs (methods, events, types)
565612
- Method signatures and parameters
566613
- Event names and data structures
567614
- Links to SDK source code (next branch)
568615

569616
**Usage:**
617+
570618
- Scan JSON when using SDK methods
571619
- Search for API by name or functionality
572620
- Check parameter types and return values
@@ -579,6 +627,7 @@ ccWidgets/
579627
## Success Criteria
580628

581629
**Code generation/fix is successful when:**
630+
582631
- ✅ Follows architecture pattern (Widget → Hook → Component → Store → SDK)
583632
- ✅ Uses patterns correctly (TypeScript, React, MobX, WC)
584633
- ✅ Includes proper error handling

ai-docs/patterns/testing-patterns.md

Lines changed: 93 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,22 @@ packages/contact-center/{package}/
3030
└── index.test.tsx
3131
3232
playwright/
33-
├── tests/
33+
├── suites/ # Test suite orchestration
34+
│ ├── digital-incoming-task-tests.spec.ts
35+
│ ├── station-login-user-state-tests.spec.ts
36+
│ ├── conference-tests1.spec.ts
37+
│ └── ... (other suites)
38+
├── tests/ # Individual test implementations
3439
│ ├── station-login-test.spec.ts
3540
│ ├── user-state-test.spec.ts
36-
│ └── tasklist-test.spec.ts
41+
│ ├── tasklist-test.spec.ts
42+
│ ├── conference-set7-tests.spec.ts
43+
│ └── ... (other test factories)
3744
└── Utils/
3845
├── stationLoginUtils.ts
39-
└── userStateUtils.ts
46+
├── userStateUtils.ts
47+
├── conferenceUtils.ts # Multi-agent coordination
48+
└── ... (other utilities)
4049
```
4150

4251
---
@@ -245,6 +254,83 @@ test.describe('Station Login Tests - Dial Number Mode', () => {
245254
});
246255
```
247256

257+
### Multi-Agent Testing Pattern
258+
259+
```typescript
260+
// playwright/tests/multi-agent-feature-test.spec.ts
261+
import {test, expect} from '@playwright/test';
262+
import {TestManager} from '../test-manager';
263+
import {performMultiAgentOperation} from '../Utils/featureUtils';
264+
import {verifyCurrentState} from '../Utils/userStateUtils';
265+
import {USER_STATES} from '../constants';
266+
267+
export default function createMultiAgentTests() {
268+
return () => {
269+
let testManager: TestManager;
270+
271+
test.beforeAll(async ({browser}, testInfo) => {
272+
testManager = new TestManager(testInfo.project.name);
273+
// Configure based on test requirements (2-4 agents)
274+
await testManager.setup(browser, {
275+
needsAgent1: true,
276+
needsAgent2: true,
277+
needsAgent3: true, // Optional: for 3+ agent scenarios
278+
needsAgent4: true, // Optional: for 4 agent scenarios
279+
needsCaller: true,
280+
enableConsoleLogging: true,
281+
});
282+
});
283+
284+
test.afterAll(async () => {
285+
await testManager.cleanup();
286+
});
287+
288+
test('should perform multi-agent operation and verify all participants', async () => {
289+
// Perform multi-agent operation
290+
await performMultiAgentOperation(
291+
testManager.agent1Page,
292+
testManager.agent2Page,
293+
testManager.agent3Page,
294+
testManager.agent4Page,
295+
testManager.callerPage,
296+
testManager.projectName
297+
);
298+
299+
// Verify states
300+
await verifyCurrentState(testManager.agent1Page, USER_STATES.ENGAGED);
301+
await verifyCurrentState(testManager.agent2Page, USER_STATES.ENGAGED);
302+
await verifyCurrentState(testManager.agent3Page, USER_STATES.ENGAGED);
303+
});
304+
305+
test('should handle participant state transitions', async () => {
306+
// Setup multi-agent scenario
307+
await performMultiAgentOperation(
308+
testManager.agent1Page,
309+
testManager.agent2Page,
310+
testManager.agent3Page,
311+
testManager.agent4Page,
312+
testManager.callerPage,
313+
testManager.projectName
314+
);
315+
316+
// Perform state transition
317+
await someStateTransitionOperation(testManager.agent3Page);
318+
319+
// Verify other agents remain in expected state
320+
await verifyCurrentState(testManager.agent1Page, USER_STATES.ENGAGED);
321+
await verifyCurrentState(testManager.agent2Page, USER_STATES.ENGAGED);
322+
});
323+
};
324+
}
325+
```
326+
327+
**Key Points for Multi-Agent Tests:**
328+
- Use `needsAgent3` and `needsAgent4` configuration flags for 3-4 agent scenarios
329+
- Configure agent count based on test requirements (not all tests need 4 agents)
330+
- Create feature-specific utility modules for reusable multi-agent operations
331+
- Each agent has independent browser context and page
332+
- Adjust timeouts only when justified by actual operation requirements
333+
248334
---
249335

250336
## Playwright Utils Pattern
@@ -361,6 +447,10 @@ yarn run test:unit --coverage
361447

362448
# Run specific E2E test
363449
npx playwright test tests/station-login-test.spec.ts
450+
451+
# Run specific test set (project)
452+
yarn test:e2e --project=SET_1 # Digital incoming tasks
453+
yarn test:e2e --project=SET_7 # Multi-agent scenarios (4-agent)
364454
```
365455

366456
---

0 commit comments

Comments
 (0)