Skip to content

Commit 1b7ec18

Browse files
authored
Merge pull request #136 from joomcode/fix/object-with-guid-was-not-bound
fix: do not fail run with Playwright OBJECT_NOT_BOUND error
2 parents ea23c2a + ed43761 commit 1b7ec18

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

src/constants/internal.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ export {
6868
TMP_DIRECTORY_PATH,
6969
} from './paths';
7070
/** @internal */
71-
export {TARGET_CLOSED_ERROR_MESSAGE, TEST_ENDED_ERROR_MESSAGE} from './playwright';
71+
export {
72+
OBJECT_NOT_BOUND_ERROR_REGEXP,
73+
TARGET_CLOSED_ERROR_MESSAGE,
74+
TEST_ENDED_ERROR_MESSAGE,
75+
} from './playwright';
7276
/** @internal */
7377
export {RESOLVED_PROMISE} from './promise';
7478
/** @internal */

src/constants/playwright.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/**
2+
* Playwright error message for some connection error.
3+
* The test fails after such an error, so it cannot be completely ignored (we write it in the warning).
4+
* @internal
5+
*/
6+
export const OBJECT_NOT_BOUND_ERROR_REGEXP =
7+
/Object with guid response@[a-zA-Z0-9]+ was not bound in the connection/;
8+
19
/**
210
* Playwright error message for already closed target (`TargetClosedError`).
311
* @internal

src/utils/end/endE2ed.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const endE2ed = (definedEndE2edReason: EndE2edReason): void => {
3535
setEndE2edReason(definedEndE2edReason);
3636

3737
if (testsSubprocess?.killed === false) {
38-
console.log('Kill tests subprocess');
38+
console.log(`Kill tests subprocess (reason: ${definedEndE2edReason})`);
3939

4040
testsSubprocess.kill();
4141
}

src/utils/getGlobalErrorHandler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import {TARGET_CLOSED_ERROR_MESSAGE, TEST_ENDED_ERROR_MESSAGE} from '../constants/internal';
1+
import {
2+
OBJECT_NOT_BOUND_ERROR_REGEXP,
3+
TARGET_CLOSED_ERROR_MESSAGE,
4+
TEST_ENDED_ERROR_MESSAGE,
5+
} from '../constants/internal';
26

37
import {E2edError} from './error';
48
import {writeGlobalError, writeGlobalWarning} from './fs';
@@ -24,7 +28,7 @@ export const getGlobalErrorHandler =
2428
return;
2529
}
2630

27-
if (type === 'TestUnhandledRejection') {
31+
if (type === 'TestUnhandledRejection' || OBJECT_NOT_BOUND_ERROR_REGEXP.test(errorString)) {
2832
void writeGlobalWarning(errorString).catch(() => {});
2933
} else {
3034
void writeGlobalError(errorString).catch(() => {});

0 commit comments

Comments
 (0)