Skip to content

feat(cc-widgets): UI Automation for Basic Task Controls#497

Merged
Shreyas281299 merged 17 commits into
webex:ccwidgetsfrom
PrayagGP:ccwidgets
Jul 24, 2025
Merged

feat(cc-widgets): UI Automation for Basic Task Controls#497
Shreyas281299 merged 17 commits into
webex:ccwidgetsfrom
PrayagGP:ccwidgets

Conversation

@PrayagGP

@PrayagGP PrayagGP commented Jul 14, 2025

Copy link
Copy Markdown
Contributor

COMPLETES #https://jira-eng-sjc12.cisco.com/jira/browse/CAI-6523

This pull request addresses

UI automation for testing the basic task controls

by making the following changes

    1. Created util methods and tests for basic task controls.

https://app.vidcast.io/share/4ccc2926-2988-4150-b661-e651c529cc73

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

  • The testing is done with the amplify link
    < 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
  • [x ] 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
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • [ ] I have updated the testing document

@coderabbitai

coderabbitai Bot commented Jul 14, 2025

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@aws-amplify-us-east-2

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-497.d1b38q61t1z947.amplifyapp.com

Comment on lines +320 to +322
if (!extensionPage) {
throw new Error('Extension page is not available for handling extension call');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we rather check if the UI goes rightly to RONA if the extension page is not open?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should this be done as a separate test? If so, I think it would be more suitable to add it to incomingTask tests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@rsarika - Here' we are failing the test. However, shouldn't it be a test that simply ensures it goes to RONA if the extension isn't open?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes. we should do this

*/
export async function callTaskControlCheck(page: Page): Promise<void> {
// Verify call control container is visible
await expect(page.getByTestId('call-control-container').nth(0)).toBeVisible({ timeout: 30000 });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If Akula's PR goes in before this, let us ensure to include the mute button as well

Comment thread playwright/Utils/taskControlUtils.ts Outdated
* @param expectedIsHeld - Expected hold state (true for hold, false for resume)
* @throws Error if verification fails with detailed error message
*/
export function verifyHoldLogs(expectedIsHeld: boolean): void {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we not verify anywhere if the icons were changing based on the state?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added utils and checks for the same

Comment thread playwright/Utils/taskControlUtils.ts Outdated
// Verify audio element properties using JavaScript evaluation
// Handle multiple audio elements with same ID by checking all of them
const audioProperties = await page.evaluate(() => {
const audioElements = document.querySelectorAll('#remote-audio') as NodeListOf<HTMLAudioElement>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We add IDs(#remote-audio) as unique elements. Why do we need to do querySelectorAll? We could do querySelector instead that will result in not having a forEach in line#270

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sure. Will look into it

Comment thread playwright/Utils/taskControlUtils.ts Outdated
Comment on lines +280 to +281
tracksCount = mediaStream.getTracks().length;
audioTracksCount = mediaStream.getAudioTracks().length;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't the audioTracksCount enough here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-checking the way I am verifying audio stream

Comment thread playwright/Utils/taskControlUtils.ts Outdated
* @returns Promise<void>
* @throws Error if remote audio element is not found
*/
export async function executeRemoteAudioQuery(page: Page): Promise<void> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

let context2: BrowserContext;
const maxRetries = 3;

test.describe('Basic Task Controls Tests', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this test. prefix everywhere?

Can't we simply do describe, beforeEach, beforeAll etc.,?


try {
// Clear logs first to ensure clean state
clearCapturedLogs();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Doesn't this happen before each test anyway?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah removed the unnecessary calls of that function. But in some cases it is needed because I wanted to clear the logs related to pause recording before looking at logs for resume recording within the same test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes. Those clear log calls are alright. That is why I hadn't commented there.

await page.waitForTimeout(2000);

// Verify resume callback logs
verifyHoldLogs(false);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would have been better if we had the parameter as JSON. Gives more readability.

Suggested change
verifyHoldLogs(false);
verifyHoldLogs({expectedIsHeld: false});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be similar everywhere we have parameters

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, this looks better. Will update the concerned functions with such parameters


// Verify resume recording callback logs
verifyRecordingLogs(true);
clearCapturedLogs(); // Clear logs for next verification

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Again, wouldn't this happen as part of beforeEach?

@Shreyas281299 Shreyas281299 added the validated Indicates that the PR is ready for actions label Jul 16, 2025
@rsarika rsarika added the run_e2e Add this label to run E2E test for meeting and CC widgets label Jul 16, 2025
@rsarika

rsarika commented Jul 16, 2025

Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 16, 2025

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rsarika
rsarika requested a review from mkesavan13 July 16, 2025 14:24
Comment thread playwright.config.ts
{
name: 'Test: Chrome',
// Run all tests except advanced tests and transfer/consult tests on Chrome
testIgnore: [/advanced-task-controls-test\.spec\.ts/],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why we are not running this in chromium?

* Utility function to get all captured logs for debugging purposes.
* @returns Array of all captured log messages
*/
export function getAllCapturedLogs(): string[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should remove this if not used

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

removed

* @param agentName - Name of the agent to consult with (e.g., 'User2 Agent2')
* @returns Promise<void>
*/
export async function consultViaAgent(page: Page, agentName: string = 'User2 Agent2'): Promise<void> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

combine 4 methods as one and differentiate using param, param should be a json

Comment on lines +320 to +322
if (!extensionPage) {
throw new Error('Extension page is not available for handling extension call');
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes. we should do this

clearAdvancedCapturedLogs();
});

test('Normal Call Blind Transferred by Agent to Another Agent', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Normal Call Blind Transferred by Agent to Another Agent', async () => {
test('Desktop Call Blind Transferred by Agent to Another Agent', async () => {

await verifyCurrentState(agent1Page, USER_STATES.AVAILABLE);
});

test('Normal Call Consulted via Agent and Declined (A1 → A2)', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Normal Call Consulted via Agent and Declined (A1 → A2)', async () => {
test('Desktop Call Consulted via Agent and Declined (A1 → A2)', async () => {

await agent1Page.waitForTimeout(2000);
});

test('Normal Call Consulted via Agent and Not Picked Up by Agent 2', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Normal Call Consulted via Agent and Not Picked Up by Agent 2', async () => {
test('Desktop Call Consulted via Agent and Not Picked Up by Agent 2', async () => {

await agent1Page.waitForTimeout(2000);
});

test('Consult Transfer - Normal Call to Agent 2', async () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
test('Consult Transfer - Normal Call to Agent 2', async () => {
test('Consult Transfer - Desktop Call to Agent 2', async () => {

await endTask(agent1Page);
await agent1Page.waitForTimeout(3000);
await submitWrapup(agent1Page, WRAPUP_REASONS.RESOLVED);
await agent1Page.waitForTimeout(2000);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we should test two way audio for desktop calls, in all the consult and transfer flows

}
})(),
(async () => {
await pageSetup(agent1Page, LOGIN_MODE.DESKTOP, 'AGENT1');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets make it Extension mode so that we can test two mode at one shot
update the tests accordingly


// Verify the correct icon based on recording state
const expectedIcon = expectedIsRecording ? 'record-paused-bold' : 'record-bold';
const actualIcon = await iconElement.getAttribute('name');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should also verify if the button in the top right (the recording indicator) is changing

@mkesavan13

Copy link
Copy Markdown
Contributor

Let the E2E tests pass and we shall merge. The reviews posted by Ravi & Me (In Ravi's review itself) should be addressed as a separate PR & ticket.

@Shreyas281299
Shreyas281299 merged commit 6aa1c90 into webex:ccwidgets Jul 24, 2025
12 of 16 checks passed
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2025
# [1.28.0-ccwidgets.96](v1.28.0-ccwidgets.95...v1.28.0-ccwidgets.96) (2025-07-24)

### Features

* **cc-widgets:** UI Automation for Basic Task Controls ([#497](#497)) ([6aa1c90](6aa1c90))
@sreenara

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.28.0-ccwidgets.96 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @ccwidgets run_e2e Add this label to run E2E test for meeting and CC widgets validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants