@@ -4,7 +4,7 @@ import { Users } from '../fixtures/userStates';
44import { OmnichannelChats } from '../page-objects/omnichannel-contact-center-chats' ;
55import { setSettingValueById } from '../utils' ;
66import { createAgent , makeAgentAvailable } from '../utils/omnichannel/agents' ;
7- import { createConversation } from '../utils/omnichannel/rooms' ;
7+ import { createConversation , waitForInquiryToBeTaken } from '../utils/omnichannel/rooms' ;
88import { test , expect } from '../utils/test' ;
99
1010test . use ( { storageState : Users . user1 . state } ) ;
@@ -20,7 +20,15 @@ test.describe('OC - Contact Center - Chats', () => {
2020 const visitorB = `visitorB_${ uuid } ` ;
2121
2222 test . beforeAll ( async ( { api } ) => {
23- expect ( ( await setSettingValueById ( api , 'Livechat_Routing_Method' , 'Auto_Selection' ) ) . status ( ) ) . toBe ( 200 ) ;
23+ const responses = await Promise . all ( [
24+ setSettingValueById ( api , 'Livechat_Routing_Method' , 'Auto_Selection' ) ,
25+ setSettingValueById ( api , 'Livechat_waiting_queue' , true ) ,
26+ setSettingValueById ( api , 'Omnichannel_queue_delay_timeout' , 1 ) ,
27+ ] ) ;
28+ responses . forEach ( async ( res ) => {
29+ console . log ( res . status ( ) , await res . json ( ) ) ;
30+ expect ( res . status ( ) ) . toBe ( 200 ) ;
31+ } ) ;
2432 } ) ;
2533
2634 test . beforeAll ( async ( { api } ) => {
@@ -34,6 +42,11 @@ test.describe('OC - Contact Center - Chats', () => {
3442 createConversation ( api , { agentId : `user1` , visitorName : visitorA } ) ,
3543 createConversation ( api , { agentId : `user1` , visitorName : visitorB } ) ,
3644 ] ) ;
45+
46+ await waitForInquiryToBeTaken (
47+ api ,
48+ conversations . map ( ( c ) => c . data . room . _id ) ,
49+ ) ;
3750 } ) ;
3851
3952 test . beforeEach ( async ( { page } ) => {
@@ -47,8 +60,13 @@ test.describe('OC - Contact Center - Chats', () => {
4760 } ) ;
4861
4962 test . afterAll ( async ( { api } ) => {
50- await Promise . all ( [ ...conversations . map ( ( conversation ) => conversation . delete ( ) ) , agent . delete ( ) ] ) ;
51- expect ( ( await setSettingValueById ( api , 'Livechat_Routing_Method' , 'Auto_Selection' ) ) . status ( ) ) . toBe ( 200 ) ;
63+ await Promise . all ( [
64+ ...conversations . map ( ( conversation ) => conversation . delete ( ) ) ,
65+ agent . delete ( ) ,
66+ setSettingValueById ( api , 'Livechat_Routing_Method' , 'Auto_Selection' ) ,
67+ setSettingValueById ( api , 'Livechat_waiting_queue' , false ) ,
68+ setSettingValueById ( api , 'Omnichannel_queue_delay_timeout' , 5 ) ,
69+ ] ) ;
5270 } ) ;
5371
5472 test ( `OC - Contact Center - Chats - Filter from and to same date` , async ( { page } ) => {
0 commit comments