Skip to content

Commit 64134db

Browse files
riteshfyiPrayagGPShreyas281299
authored
feat(cc-widgets): UI Automation for Incoming Task (#485)
Co-authored-by: PrayagGP <127178102+PrayagGP@users.noreply.github.com> Co-authored-by: Shreyas Sharma <72344404+Shreyas281299@users.noreply.github.com>
1 parent f0dd79a commit 64134db

15 files changed

Lines changed: 1881 additions & 26 deletions

File tree

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,4 @@ jobs:
264264
run: yarn run test:tooling
265265

266266
- name: Test CC Widgets
267-
run: yarn run test:cc-widgets
267+
run: yarn run test:cc-widgets

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"jest": "29.7.0",
2828
"jest-canvas-mock": "^2.5.2",
2929
"node-gyp": "^10.2.0",
30+
"nodemailer": "^7.0.3",
3031
"os-browserify": "^0.3.0",
3132
"process": "^0.11.10",
3233
"querystring-es3": "^0.2.1",

packages/contact-center/cc-components/src/components/task/CallControl/call-control.tsx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ function CallControlComponent(props: CallControlComponentProps) {
295295
button.className +
296296
(button.disabled || (consultInitiated && isTelephony) ? ` ${button.className}-disabled` : '')
297297
}
298-
data-testid="ButtonCircle"
298+
data-testid={button.id === 'end' ? 'call-control:end-call' : button.id}
299299
onPress={button.onClick}
300300
disabled={button.disabled || (consultInitiated && isTelephony)}
301301
aria-label={button.tooltip}
@@ -332,6 +332,7 @@ function CallControlComponent(props: CallControlComponentProps) {
332332
postfix-icon="arrow-down-bold"
333333
type="button"
334334
role="button"
335+
data-testid="call-control:wrapup-button"
335336
>
336337
{WRAP_UP}
337338
</Button>
@@ -362,6 +363,7 @@ function CallControlComponent(props: CallControlComponentProps) {
362363
info-icon-aria-label=""
363364
name=""
364365
className="wrapup-select"
366+
data-testid="call-control:wrapup-select"
365367
placeholder={SELECT}
366368
onChange={(event: CustomEvent) => {
367369
const key = event.detail.value;
@@ -370,7 +372,11 @@ function CallControlComponent(props: CallControlComponentProps) {
370372
}}
371373
>
372374
{wrapupCodes?.map((code) => (
373-
<Option key={code.id} value={code.id}>
375+
<Option
376+
key={code.id}
377+
value={code.id}
378+
data-testid={`call-control:wrapup-reason-${code.name.toLowerCase()}`}
379+
>
374380
{code.name}
375381
</Option>
376382
))}
@@ -379,7 +385,7 @@ function CallControlComponent(props: CallControlComponentProps) {
379385
onClick={handleWrapupCall}
380386
variant="primary"
381387
className="submit-wrapup-button"
382-
data-testid="submit-wrapup-button"
388+
data-testid="call-control:wrapup-submit"
383389
aria-label="Submit wrap-up"
384390
disabled={selectedWrapupId && selectedWrapupReason ? false : true}
385391
>

packages/contact-center/cc-components/src/components/task/Task/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ const Task: React.FC<TaskProps> = ({
155155
<ListItemBaseSection position="end">
156156
<div className="task-button-container">
157157
{acceptText ? (
158-
<ButtonPill onPress={acceptTask} color="join" disabled={disableAccept}>
158+
<ButtonPill onPress={acceptTask} color="join" disabled={disableAccept} data-testid="task:accept-button">
159159
{acceptText}
160160
</ButtonPill>
161161
) : null}
162162
{declineText ? (
163-
<ButtonPill onPress={declineTask} color="cancel">
163+
<ButtonPill onPress={declineTask} color="cancel" data-testid="task:decline-button">
164164
{declineText}
165165
</ButtonPill>
166166
) : null}

playwright.config.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import {defineConfig, devices} from '@playwright/test';
1+
import { defineConfig, devices } from '@playwright/test';
22
import dotenv from 'dotenv';
33
import path from 'path';
44

55
// Alternatively, read from "../my.env" file.
6-
dotenv.config({path: path.resolve(__dirname, '.env')});
6+
dotenv.config({ path: path.resolve(__dirname, '.env') });
77

88
/**
99
* See https://playwright.dev/docs/test-configuration.
1010
*/
11+
const dummyAudioPath = path.resolve(__dirname, './playwright/wav/dummyAudio.wav');
1112
export default defineConfig({
1213
testDir: './playwright',
1314
/* Maximum time one test can run for. */
@@ -45,7 +46,22 @@ export default defineConfig({
4546
},
4647
{
4748
name: 'Test: Chrome',
48-
use: {...devices['Desktop Chrome']},
49+
use: {
50+
...devices['Desktop Chrome'],
51+
launchOptions: {
52+
args: [
53+
`--disable-site-isolation-trials`,
54+
`--disable-web-security`,
55+
`--no-sandbox`,
56+
`--disable-features=WebRtcHideLocalIpsWithMdns`,
57+
`--allow-file-access-from-files`,
58+
`--use-fake-ui-for-media-stream`,
59+
`--use-fake-device-for-media-stream`,
60+
`--use-file-for-fake-audio-capture=${dummyAudioPath}`,
61+
],
62+
}
63+
},
64+
4965
},
5066
// Once we have stability for playwright tests, we can enable the following browsers
5167
// {

0 commit comments

Comments
 (0)