Skip to content

Commit 093124c

Browse files
authored
fix(cc-widgets): e2e tests (#588)
1 parent cc52c3c commit 093124c

25 files changed

Lines changed: 1088 additions & 901 deletions

playwright/Utils/advancedTaskControlUtils.ts

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Page, expect} from '@playwright/test';
22
import {loginExtension} from './incomingTaskUtils';
33
import {dismissOverlays} from './helperUtils';
4-
import {AWAIT_TIMEOUT, FORM_FIELD_TIMEOUT} from '../constants';
4+
import {AWAIT_TIMEOUT, FORM_FIELD_TIMEOUT, EXTENSION_REGISTRATION_TIMEOUT} from '../constants';
55

66
/**
77
* Utility functions for advanced task controls testing.
@@ -118,6 +118,7 @@ export async function consultOrTransfer(
118118
action: 'consult' | 'transfer',
119119
value: string
120120
): Promise<void> {
121+
await page.bringToFront();
121122
await openConsultOrTransferMenu(page, action);
122123
const popover = await getPopover(page);
123124

@@ -139,14 +140,13 @@ export async function consultOrTransfer(
139140

140141
// ===== Internal helper functions =====
141142
async function openConsultOrTransferMenu(page: Page, action: 'consult' | 'transfer'): Promise<void> {
143+
await page.bringToFront();
144+
await dismissOverlays(page);
145+
142146
if (action === 'consult') {
143-
await dismissOverlays(page);
144-
await page.getByTestId('call-control:consult').nth(1).click({timeout: AWAIT_TIMEOUT});
147+
await page.getByTestId('call-control:consult').first().click({timeout: AWAIT_TIMEOUT});
145148
} else {
146-
await page
147-
.getByRole('group', {name: 'Call Control with Call'})
148-
.getByLabel('Transfer Call')
149-
.click({timeout: AWAIT_TIMEOUT});
149+
await page.getByTestId('call-control:transfer').first().click({timeout: AWAIT_TIMEOUT});
150150
}
151151
}
152152

@@ -161,7 +161,7 @@ async function clickCategory(
161161
popover: ReturnType<Page['locator']>,
162162
name: 'Agents' | 'Queues' | 'Dial Number' | 'Entry Point'
163163
): Promise<void> {
164-
const button = popover.getByRole('button', {name});
164+
const button = popover.getByRole('button', {name, exact: true});
165165
await button.click({timeout: AWAIT_TIMEOUT});
166166
await page.waitForTimeout(200);
167167
}
@@ -262,29 +262,3 @@ export async function cancelConsult(page: Page): Promise<void> {
262262
// Click cancel consult button
263263
await page.getByTestId('cancel-consult-btn').click({timeout: AWAIT_TIMEOUT});
264264
}
265-
266-
/**
267-
* Ensures the Dial Number softphone (web.webex.com) page is logged in using env creds.
268-
* Uses: PW_DIAL_NUMBER_LOGIN_USERNAME, PW_DIAL_NUMBER_LOGIN_PASSWORD
269-
* Also dismisses any stale overlays/popovers (e.g., "Media failed") that might block interaction.
270-
*/
271-
export async function ensureDialNumberLoggedIn(page: Page): Promise<void> {
272-
const currentUrl = page?.url?.() || '';
273-
if (!/\.webex\.com\/calling/.test(currentUrl)) {
274-
const user = process.env.PW_DIAL_NUMBER_LOGIN_USERNAME;
275-
const pass = process.env.PW_DIAL_NUMBER_LOGIN_PASSWORD;
276-
if (user && pass) {
277-
await loginExtension(page, user, pass);
278-
}
279-
}
280-
281-
// Dismiss any stale overlays/popovers (e.g., "Media failed" from previous calls)
282-
await dismissOverlays(page);
283-
284-
// Ensure the dial number page is in the foreground to avoid background throttling
285-
await page.bringToFront();
286-
287-
// Wait for the incoming call to appear on the dial number page
288-
// Use extended timeout to handle network routing delays and test interference
289-
await page.locator('[data-test="right-action-button"]').waitFor({state: 'visible', timeout: AWAIT_TIMEOUT * 2.5});
290-
}

0 commit comments

Comments
 (0)