Skip to content

Taskreflocal#4801

Draft
lego0110 wants to merge 5 commits intowebex:task-refactorfrom
lego0110:taskreflocal
Draft

Taskreflocal#4801
lego0110 wants to merge 5 commits intowebex:task-refactorfrom
lego0110:taskreflocal

Conversation

@lego0110
Copy link
Copy Markdown

@lego0110 lego0110 commented Mar 24, 2026

COMPLETES #< https://jira-eng-sjc12.cisco.com/jira/browse/CAI-7523>

This pull request addresses

by making the following changes

< Contains tests for station login, user state management, telephony tasks and basic call task controls>

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Claude code
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

Rankush Kumar and others added 2 commits March 17, 2026 01:12
Add task type G (E2E Test Work) to root AGENTS.md orchestrator with
decision tree, signal keywords, routing, context loading, and service
routing table entries. Create complete template set (00-master through
04-validation), playwright-specific AGENTS.md and ARCHITECTURE.md with
TestManager, Utils, Constants, and Console Log Verification reference,
and e2e-patterns.md covering 8 patterns + anti-patterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tion

Add cc_playwright directory with E2E test infrastructure, configure
Playwright with playwright.config.ts, and update dependencies. Update
contact-center sample app for testing support.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@lego0110 lego0110 requested a review from a team as a code owner March 24, 2026 14:39
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 653a669185

ℹ️ 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".

Comment on lines +44 to +48
process.env[key] = value;
}

envContent = envContent.replace(/\n{3,}/g, '\n\n');
fs.writeFileSync(ENV_PATH, envContent, 'utf8');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Propagate OAuth tokens beyond setup worker

This only updates process.env inside the OAuth setup test worker and writes .env to disk, but dependent projects read tokens directly from process.env (for example in TestManager.getEnvTokens) without reloading from file. In Playwright project-dependency runs, that means the fresh ${SET}_AGENT*_ACCESS_TOKEN values generated here are not reliably visible to the actual test projects, so runs can fail with empty or expired tokens.

Useful? React with 👍 / 👎.

Comment on lines +2523 to +2533
if (state === 'new' && !agentJoined) {
const taskCreatedAt = taskCreationTimes.get(taskId);
const taskAgeMs = Date.now() - taskCreatedAt;

if (taskAgeMs > ALERTING_STALE_THRESHOLD_MS) {
console.warn(
`⚠️ Customer disconnect in ALERTING detected - filtering stale task ${taskId} ` +
`(age: ${Math.round(taskAgeMs/1000)}s, threshold: ${ALERTING_STALE_THRESHOLD_MS/1000}s)`
);
taskCreationTimes.delete(taskId); // Clean up tracking
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid timing out valid NEW tasks from task list

This filters out any task that stays in state === 'new' for more than 25 seconds when the agent has not joined, but that state can legitimately persist for digital tasks (chat/email/social) and longer queue scenarios. In those cases the task is still actionable, yet it disappears from the UI and the agent loses the ability to accept it.

Useful? React with 👍 / 👎.

…tors

Migrated advanced task control and basic task control tests from widget-style
data-testid selectors to sample app plain HTML ID selectors.

Key changes:
- Fixed waitForPrimaryCallAfterConsult() to use #consult, #end-consult, #end buttons
  instead of widget testids (call-control:consult, call-control:end-call)
- Fixed isCallHeld() to check button text ("Resume"/"Hold") instead of icon name
- Added consultTransferWorkaround.ts to handle SDK limitation where consultingAgentId
  is not populated in task data
- Updated submitWrapup() to use #wrapupCodesDropdown and #wrapup button
- Improved login detection in pageSetup() to check logout button visibility,
  login mode selection, AND state dropdown (more reliable than single check)
- Updated afterAll cleanup to check #end button visibility instead of Engaged state
  (Desktop mode doesn't auto-transition to Engaged)
- Added ESLint rules for Playwright test patterns (no-await-in-loop, etc.)

Test results: 10 passed, 2 skipped, 0 failed (100% success rate)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4fe16f3d4d

ℹ️ 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".

import {defineConfig, devices} from '@playwright/test';
import dotenv from 'dotenv';
import path from 'path';
import {USER_SETS} from './cc_playwright/test-data';
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Load dotenv before importing USER_SETS

USER_SETS is imported before dotenv.config({path: ...}), so cc_playwright/test-data.ts is evaluated before cc_playwright/.env is loaded and it snapshots ENTRY_POINT/CHAT_URL values from an uninitialized environment. In runs where variables are provided via cc_playwright/.env (the file global setup writes), this yields empty or undefined-* set values, and downstream setup propagates blank ${SET}_ENTRY_POINT/${SET}_CHAT_URL, breaking call/chat task creation.

Useful? React with 👍 / 👎.

});

test.beforeEach(async () => {
testManager.softCleanup();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Await soft cleanup before resetting agent states

softCleanup() is async, but this hook does not await it, so stray-task cleanup can run concurrently with the next test's state changes. When cleanup is still in progress, the following test starts with leftover task/wrapup UI and becomes flaky (for example, state transitions and incoming-task assertions race with unfinished teardown).

Useful? React with 👍 / 👎.

Retained only the two core test suites and their dependencies:
- station-login-user-state-tests.spec.ts
  (uses: station-login-test, user-state-test, incoming-telephony-task-test)
- basic-advanced-task-controls-tests.spec.ts
  (uses: basic-task-controls-test, advance-task-control-combinations-test)

Removed suites:
- advanced-task-controls-tests
- dial-number-tests
- digital-incoming-task-tests
- multiparty-conference-set-7/8/9-tests
- task-list-multi-session-tests

Removed test files:
- advanced-task-controls-test
- dial-number-task-control-test
- digital-incoming-task-and-task-controls
- incoming-task-and-controls-multi-session
- multiparty-conference-set-7/8/9-test
- tasklist-test

All utility files remain intact for use by the retained test suites.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dcea68473

ℹ️ 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".

CHAT_URL: `${env.PW_CHAT_URL}-e2e.html`,
EMAIL_ENTRY_POINT: `${env.PW_SANDBOX}.e2e@gmail.com`,
ENTRY_POINT: env.PW_ENTRY_POINT1,
TEST_SUITE: 'digital-incoming-task-tests.spec.ts',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Point each USER_SET to an existing suite file

This TEST_SUITE mapping (and similar entries for SET_2 and SET_5SET_9) references suite filenames that are not present under cc_playwright/suites in this commit, so those Playwright projects will be created but execute zero tests. That silently drops most configured set coverage while still running setup/dependency work, which can make CI look green without actually validating those sets.

Useful? React with 👍 / 👎.

Comment on lines +2532 to +2533
taskCreationTimes.delete(taskId); // Clean up tracking
return false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve stale-task timestamps until task is removed

Deleting the timestamp when a task first crosses the stale threshold causes the same still-present task to be treated as brand new on the next renderTaskList() call (taskCreationTimes is recreated at first sight), so orphaned tasks can reappear for another 25s and then disappear again in cycles. This makes filtering non-deterministic whenever unrelated updates trigger another render; keep the timestamp until the task actually leaves taskList.

Useful? React with 👍 / 👎.

@lego0110 lego0110 marked this pull request as draft March 25, 2026 17:57
… improved advanced controls

- Enhanced advancedTaskControlUtils with dialog visibility waits instead of
  fixed timeouts
- Implemented smart dropdown selection for handling duplicate IDs
  (#consultDestination, #transfer-destination)
- Added 7 test suite orchestration files covering all test scenarios
- Added 9 test implementation files for comprehensive E2E coverage
- Fixed basic-task-controls-test with proper UI cleanup verification

Test coverage: digital tasks, task lists, multi-session, station login,
user states, basic/advanced task controls, dial number, and multiparty
conference (3 sets).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant