1- import { TEST_ENDED_ERROR_MESSAGE } from './constants/internal' ;
1+ import { TARGET_CLOSED_ERROR_MESSAGE , TEST_ENDED_ERROR_MESSAGE } from './constants/internal' ;
22import { getTestIdleTimeout } from './context/testIdleTimeout' ;
33import { E2edError } from './utils/error' ;
44import { setCustomInspectOnFunction } from './utils/fn' ;
@@ -13,7 +13,6 @@ import type {ClientFunction} from './types/internal';
1313type Options = Readonly < { name ?: string ; retries ?: number ; timeout ?: number } > ;
1414
1515const contextErrorMessage = 'Execution context was destroyed' ;
16- const targetErrorMessage = 'Target page, context or browser has been closed' ;
1716
1817/**
1918 * Creates a client function.
@@ -48,7 +47,7 @@ export const createClientFunction = <Args extends readonly unknown[], Result>(
4847
4948 if (
5049 errorString . includes ( contextErrorMessage ) ||
51- errorString . includes ( targetErrorMessage ) ||
50+ errorString . includes ( TARGET_CLOSED_ERROR_MESSAGE ) ||
5251 errorString . includes ( TEST_ENDED_ERROR_MESSAGE )
5352 ) {
5453 await page . waitForLoadState ( ) ;
@@ -58,7 +57,7 @@ export const createClientFunction = <Args extends readonly unknown[], Result>(
5857
5958 if (
6059 suberrorString . includes ( contextErrorMessage ) ||
61- suberrorString . includes ( targetErrorMessage ) ||
60+ suberrorString . includes ( TARGET_CLOSED_ERROR_MESSAGE ) ||
6261 suberrorString . includes ( TEST_ENDED_ERROR_MESSAGE )
6362 ) {
6463 return new Promise ( ( ) => { } ) ;
@@ -80,7 +79,7 @@ export const createClientFunction = <Args extends readonly unknown[], Result>(
8079
8180 if (
8281 suberrorString . includes ( contextErrorMessage ) ||
83- suberrorString . includes ( targetErrorMessage ) ||
82+ suberrorString . includes ( TARGET_CLOSED_ERROR_MESSAGE ) ||
8483 suberrorString . includes ( TEST_ENDED_ERROR_MESSAGE )
8584 ) {
8685 return new Promise ( ( ) => { } ) ;
0 commit comments