test(calling): add Playwright E2E base setup and SDK initialization tests#4790
test(calling): add Playwright E2E base setup and SDK initialization tests#4790eigengravy wants to merge 2 commits intowebex:calling-sdk-e2e-testsfrom
Conversation
…ests Add Playwright infrastructure for Calling SDK E2E tests against the kitchen sink sample app, including OAuth global setup, shared utilities, and INIT-001 through INIT-003 test cases for SDK initialization.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 504ec1deae
ℹ️ 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".
| await Promise.all(tokenFetches); | ||
| upsertEnvVariables(tokenUpdates); |
There was a problem hiding this comment.
Pass fetched PATs to dependent projects explicitly
Writing the freshly fetched tokens into .env here does not make them available to the dependent project in the same playwright test run. playwright.config.ts:7 loads dotenv once before projects start, while playwright/tests/01-sdk-initialization.spec.ts:11-17 reads process.env.CALLER_ACCESS_TOKEN directly, so on a clean machine the OAuth project can succeed and still leave the init project failing with CALLER_ACCESS_TOKEN not set. Persist the tokens through a Playwright-supported handoff (for example a temp file/storage state that the tests read) instead of relying on a late .env rewrite.
Useful? React with 👍 / 👎.
| process.env.SKIP_AUTH === 'true' && | ||
| process.env.CALLER_ACCESS_TOKEN && | ||
| process.env.CALLEE_ACCESS_TOKEN && | ||
| process.env.TRANSFER_ACCESS_TOKEN |
There was a problem hiding this comment.
Skip auth when only the caller token is needed
The SKIP_AUTH fast path currently requires CALLEE_ACCESS_TOKEN and TRANSFER_ACCESS_TOKEN, even though this commit's initialization suite only ever consumes CALLER_ACCESS_TOKEN (playwright/tests/01-sdk-initialization.spec.ts:11-37). In the common rerun case where a developer has a cached caller PAT but no callee/transfer accounts configured, setup falls through this guard and then throws at lines 125-129 unless extra credentials are supplied, so SKIP_AUTH=true cannot actually skip login for the tests added here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53f6565ebc
ℹ️ 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".
| ); | ||
| } | ||
|
|
||
| await Promise.all(tokenFetches); |
There was a problem hiding this comment.
Serialize token fetches that depend on the shared clipboard
When CALLEE_* or TRANSFER_* credentials are present, Promise.all(tokenFetches) runs multiple fetchAccessTokenFromDevPortal() calls at once even though that helper clears, copies, and reads navigator.clipboard (playwright/global.setup.ts:89-100). Because the clipboard is shared across those browser contexts, one login can read another account's token and write the wrong value into CALLER_ACCESS_TOKEN, CALLEE_ACCESS_TOKEN, or TRANSFER_ACCESS_TOKEN, which makes any multi-user E2E flow fail nondeterministically.
Useful? React with 👍 / 👎.
| "@babel/types": "^7.14.9", | ||
| "@commitlint/cli": "^17.1.2", | ||
| "@commitlint/config-conventional": "^17.1.0", | ||
| "@playwright/test": "^1.58.2", |
There was a problem hiding this comment.
Hook the new Playwright suite into a CI-visible test entrypoint
Checked package.json and .github/workflows/pull-request.yml: the root package still only exposes the existing test:integration / samples:test commands, and the PR workflow runs workspace test:integration while explicitly excluding the root webex-js-sdk workspace. Adding Playwright as a dependency without updating one of those entrypoints means the new playwright/** initialization tests never run in automation, so regressions here will go unnoticed unless someone remembers to invoke Playwright manually.
Useful? React with 👍 / 👎.
COMPLETES https://jira-eng-gpk2.cisco.com/jira/browse/CAI-7736
This pull request addresses
Adding Playwright E2E test infrastructure for the Calling SDK kitchen sink sample app, starting with SDK initialization test cases (INIT-001 through INIT-003).
by making the following changes
playwright.config.ts) with Chrome WebRTC flags, web server setup, and project configurationplaywright/global.setup.ts) that fetches personal access tokens from developer.webex.com with parallel token fetching for caller, callee, and transfer usersplaywright/Utils/callingUtils.ts) for navigation, SDK init, and service indicator/domain selection (with commented-out future utils for registration, calls, hold, etc.)playwright/constants.ts) for element selectors and timeoutsplaywright/tests/01-sdk-initialization.spec.ts)@playwright/testdevDependency and ESLint override for playwright filesChange Type
The following scenarios were tested
callingservice indicatorcontactcenterservice indicator and service domainguestcallingservice indicatorThe GAI Coding Policy And Copyright Annotation Best Practices
I certified that