diff --git a/src/constants/internal.ts b/src/constants/internal.ts index 89328370..3052807a 100644 --- a/src/constants/internal.ts +++ b/src/constants/internal.ts @@ -68,7 +68,11 @@ export { TMP_DIRECTORY_PATH, } from './paths'; /** @internal */ -export {TARGET_CLOSED_ERROR_MESSAGE, TEST_ENDED_ERROR_MESSAGE} from './playwright'; +export { + OBJECT_NOT_BOUND_ERROR_REGEXP, + TARGET_CLOSED_ERROR_MESSAGE, + TEST_ENDED_ERROR_MESSAGE, +} from './playwright'; /** @internal */ export {RESOLVED_PROMISE} from './promise'; /** @internal */ diff --git a/src/constants/playwright.ts b/src/constants/playwright.ts index a27f728d..4c6f41ec 100644 --- a/src/constants/playwright.ts +++ b/src/constants/playwright.ts @@ -1,3 +1,11 @@ +/** + * Playwright error message for some connection error. + * The test fails after such an error, so it cannot be completely ignored (we write it in the warning). + * @internal + */ +export const OBJECT_NOT_BOUND_ERROR_REGEXP = + /Object with guid response@[a-zA-Z0-9]+ was not bound in the connection/; + /** * Playwright error message for already closed target (`TargetClosedError`). * @internal diff --git a/src/utils/end/endE2ed.ts b/src/utils/end/endE2ed.ts index c4c0ad84..433802e6 100644 --- a/src/utils/end/endE2ed.ts +++ b/src/utils/end/endE2ed.ts @@ -35,7 +35,7 @@ export const endE2ed = (definedEndE2edReason: EndE2edReason): void => { setEndE2edReason(definedEndE2edReason); if (testsSubprocess?.killed === false) { - console.log('Kill tests subprocess'); + console.log(`Kill tests subprocess (reason: ${definedEndE2edReason})`); testsSubprocess.kill(); } diff --git a/src/utils/getGlobalErrorHandler.ts b/src/utils/getGlobalErrorHandler.ts index 879f892d..43c9987e 100644 --- a/src/utils/getGlobalErrorHandler.ts +++ b/src/utils/getGlobalErrorHandler.ts @@ -1,4 +1,8 @@ -import {TARGET_CLOSED_ERROR_MESSAGE, TEST_ENDED_ERROR_MESSAGE} from '../constants/internal'; +import { + OBJECT_NOT_BOUND_ERROR_REGEXP, + TARGET_CLOSED_ERROR_MESSAGE, + TEST_ENDED_ERROR_MESSAGE, +} from '../constants/internal'; import {E2edError} from './error'; import {writeGlobalError, writeGlobalWarning} from './fs'; @@ -24,7 +28,7 @@ export const getGlobalErrorHandler = return; } - if (type === 'TestUnhandledRejection') { + if (type === 'TestUnhandledRejection' || OBJECT_NOT_BOUND_ERROR_REGEXP.test(errorString)) { void writeGlobalWarning(errorString).catch(() => {}); } else { void writeGlobalError(errorString).catch(() => {});