test(calling): add Playwright E2E tests for 2-user call flows#4879
test(calling): add Playwright E2E tests for 2-user call flows#4879eigengravy wants to merge 2 commits intowebex:nextfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 66f8e72c61
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const withTimeout = <T>(promise: Promise<T>, ms: number, label: string): Promise<T> => | ||
| Promise.race([ | ||
| promise, | ||
| new Promise<never>((_, reject) => { | ||
| setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms); |
There was a problem hiding this comment.
Clear timeout handles when racing call setup waits
withTimeout races the target promise against a setTimeout but never cancels the timer when the main promise resolves, so every successful call path leaves a live timeout handle (up to 60s in establishCall) in the worker process. Because this helper is used multiple times per call attempt, the suite can accumulate open timers, adding avoidable tail latency and causing workers to linger after tests complete; store the timeout id and clear it when either branch settles.
Useful? React with 👍 / 👎.
| SET_3USER: { | ||
| name: 'SET_3USER', | ||
| accounts: ['USER_4', 'USER_5', 'USER_6'], | ||
| testSuite: 'set-3user.spec.ts', |
There was a problem hiding this comment.
Remove disabled SET_3USER from active user-set registry
Registering SET_3USER in USER_SETS makes OAuth setup treat USER_6 as an active role via uniqueRoles, even though the SET_3USER Playwright projects are commented out and USER_6 is documented as optional. This breaks the SKIP_AUTH=true fast path (it now requires a USER_6 token to skip), so environments that intentionally omit USER_6 credentials/tokens will unexpectedly run the portal login flow and fail.
Useful? React with 👍 / 👎.
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
COMPLETES https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7739
This pull request addresses
Playwright E2E tests for the Calling SDK covering 2-user call flows — lifecycle, media, controls, hold, keepalive, errors, and edge cases. Builds on the SDK init + registration suite (#4799) and plugs into the same phased-parallel architecture via a new
SET_2USERworker.Architecture
Extends the existing phased parallel execution model with a new project,
SET_2USER, that runs 2-party call tests in parallel with the single-user registration sets (SET_1,SET_2,SET_3).PROD vs INT account mapping
SET_2USERuses dedicatedUSER_4+USER_5accounts, so it runs fully in parallel withSET_1/SET_2/SET_3(which useUSER_1/USER_2/USER_3).USER_4/USER_5are aliases for the same 3 INT accounts used by the registration sets, soSET_2USER - INTdeclaresdependencies: ['SET_1 - INT', 'SET_2 - INT', 'SET_3 - INT']to serialize after them and honor the one-account-per-browser constraint.A
SET_3USERproject scaffold (for transfer flows) is stubbed in the config but commented out — it will be enabled in a follow-up PR (CAI-7741 / transfer tests).Changes
New test infrastructure
playwright/utils/call.ts— Call action helpers:makeCall,answerCall,endCall,rejectCall,holdCall,resumeCall,sendDTMF,establishCall,getMediaStreams,cleanupActiveCalls, plus disconnect/established waiters with Node-side timeout racing (PlaywrightwaitForFunctiontimeouts can be swallowed by WebRTC work on the page)playwright/test-manager.ts— Extended with amedia: truesetup option (clicks "Get Media Streams" after registration) and now deregisters/closes stale contexts before reuse and oncleanup()to prevent leaked backend registrations across serial test groupsplaywright/test-data.ts— AddedUSER_4–USER_6roles,getPhoneNumber()helper, and enabledSET_2USER/SET_3USERentries inUSER_SETSplaywright.config.ts— NewSET_2USER - PROD/SET_2USER - INTprojects with env-specific dependencies;SET_3USERstubs left commentedTest groups (shared logic, not spec files)
call-lifecycle.ts— Basic 2-party lifecycle + media/disconnect group (fresh contexts per group)call-controls.ts— Mute/unmute, DTMF, network flap, and hold/resume (including hold+disconnect races and hold/resume API failures via route interception)call-errors.ts— Connect timeout, ROAP failure, invalid destination, plus edge cases (resume/disconnect race, deregister mid-call, calling unregistered endpoint)call-keepalive.ts— Call-level keepalive (postStatus) success, 401 teardown, 500 transient recovery, and max-retry exhaustionSuite entry point
suites/set-2user.spec.ts— Thin spec file wiring all test groups for theSET_2USERworkerOAuth / fixtures (follow-up fix commit)
test-data.ts— NewREQUIRED_OAUTH_ROLESlist (USER_1–USER_5) that the OAuth setup validates againstutils/oauth.setup.ts— Fail fast when any required role is missing_EMAIL/_PASSWORD, instead of only failing on the first account.USER_6remains optional untilSET_3USERships.Techniques used
401on keepalive,500on hold/resume, timeout on call setup, ROAP error responses)page.evaluate()to inspectcallingClient.getActiveCalls()state (connected, muted, hold, call counts)context.setOffline(true/false)to simulate brief network disruption mid-call (CALL-016)TestManager.beforeAll;afterEachcleans up any lingering active calls and waits a short settle time before the next testwithTimeoutrace to guard against PlaywrightwaitForFunctiontimeouts being blocked by WebRTCTest Cases
Call Lifecycle (3 tests)
Call Lifecycle — Media & Disconnect (5 tests)
srcObjectpopulated on both sidesrtp-rxstat/rtp-txstatVQ metrics present during callCall Controls (3 tests)
isMuted()toggles correctlyCall Hold (3 tests)
Call Hold Errors (2 tests)
hold_errorevent emitted (route-injected 500)resume_errorevent emitted (route-injected 500)Call Keepalive (4 tests)
postStatus200 keeps call aliveCall Errors (3 tests)
Call Edge Cases (3 tests)
Total: 26 call tests across 8 serial groups, all running in the
SET_2USERworker.The GAI Coding Policy And Copyright Annotation Best Practices
I certified that