1+ import type { BrowserContext } from '@playwright/test' ;
2+
13import { createFakeVisitor } from '../../mocks/data' ;
24import { IS_EE } from '../config/constants' ;
35import { createAuxContext } from '../fixtures/createAuxContext' ;
@@ -17,6 +19,7 @@ test.describe('OC - Livechat - Queue Management', () => {
1719
1820 let poHomeOmnichannel : HomeOmnichannel ;
1921 let poLiveChat : OmnichannelLiveChat ;
22+ let liveChatContext : BrowserContext ;
2023
2124 const waitingQueueMessage = 'This is a message from Waiting Queue' ;
2225 const queuePosition1 = 'Your spot is #1' ;
@@ -35,8 +38,8 @@ test.describe('OC - Livechat - Queue Management', () => {
3538 } ) ;
3639
3740 test . beforeEach ( async ( { browser, api } ) => {
38- const context = await browser . newContext ( ) ;
39- const page2 = await context . newPage ( ) ;
41+ liveChatContext = await browser . newContext ( ) ;
42+ const page2 = await liveChatContext . newPage ( ) ;
4043
4144 poLiveChat = new OmnichannelLiveChat ( page2 , api ) ;
4245 await poLiveChat . page . goto ( '/livechat' ) ;
@@ -54,7 +57,7 @@ test.describe('OC - Livechat - Queue Management', () => {
5457
5558 test . afterEach ( async ( ) => {
5659 await poLiveChat . closeChat ( ) ;
57- await poLiveChat . page . close ( ) ;
60+ await liveChatContext . close ( ) ;
5861 } ) ;
5962
6063 test ( 'OC - Queue Management - Waiting Queue Message enabled' , async ( ) => {
@@ -72,17 +75,18 @@ test.describe('OC - Livechat - Queue Management', () => {
7275
7376 test . describe ( 'OC - Queue Management - Update Queue Position' , ( ) => {
7477 let poLiveChat2 : OmnichannelLiveChat ;
78+ let liveChat2Context : BrowserContext ;
7579
7680 test . beforeEach ( async ( { browser, api } ) => {
77- const context = await browser . newContext ( ) ;
78- const page = await context . newPage ( ) ;
81+ liveChat2Context = await browser . newContext ( ) ;
82+ const page = await liveChat2Context . newPage ( ) ;
7983 poLiveChat2 = new OmnichannelLiveChat ( page , api ) ;
8084 await poLiveChat2 . page . goto ( '/livechat' ) ;
8185 } ) ;
8286
8387 test . afterEach ( async ( ) => {
8488 await poLiveChat2 . closeChat ( ) ;
85- await poLiveChat2 . page . close ( ) ;
89+ await liveChat2Context . close ( ) ;
8690 } ) ;
8791
8892 test ( 'Update user position on Queue' , async ( ) => {
@@ -125,6 +129,7 @@ test.describe('OC - Contact Manager Routing', () => {
125129
126130 let poHomeOmnichannel : HomeOmnichannel ;
127131 let poLiveChat : OmnichannelLiveChat ;
132+ let liveChatContext : BrowserContext ;
128133
129134 // User2 will be the contact manager
130135 let poHomeOmnichannelUser2 : HomeOmnichannel ;
@@ -152,8 +157,8 @@ test.describe('OC - Contact Manager Routing', () => {
152157 } ) ;
153158
154159 test . beforeEach ( async ( { browser, api } ) => {
155- const context = await browser . newContext ( ) ;
156- const page = await context . newPage ( ) ;
160+ liveChatContext = await browser . newContext ( ) ;
161+ const page = await liveChatContext . newPage ( ) ;
157162
158163 poLiveChat = new OmnichannelLiveChat ( page , api ) ;
159164 await poLiveChat . page . goto ( '/livechat' ) ;
@@ -173,7 +178,7 @@ test.describe('OC - Contact Manager Routing', () => {
173178
174179 test . afterEach ( async ( ) => {
175180 await poLiveChat . closeChat ( ) ;
176- await poLiveChat . page . close ( ) ;
181+ await liveChatContext . close ( ) ;
177182 } ) ;
178183
179184 test ( 'should route inquiry only to the contact manager' , async ( ) => {
0 commit comments