From ffc0ee5e82a28cff7f703c1dd50b612a39d1aa37 Mon Sep 17 00:00:00 2001 From: uid11 Date: Mon, 2 Mar 2026 06:22:11 +0300 Subject: [PATCH] SUPPORT-5994 fix: circular structure error in step error --- src/config.ts | 3 ++- src/constants/error.ts | 6 ++++++ src/constants/internal.ts | 2 ++ src/step.ts | 2 +- src/utils/test/afterErrorInTest.ts | 5 ++--- 5 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/constants/error.ts diff --git a/src/config.ts b/src/config.ts index 3e275ec3..3073bb9c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -8,6 +8,7 @@ import {join, relative} from 'node:path'; import { ABSOLUTE_PATH_TO_INSTALLED_E2ED_DIRECTORY, ABSOLUTE_PATH_TO_PROJECT_ROOT_DIRECTORY, + AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS, COMPILED_USERLAND_CONFIG_DIRECTORY, e2edEnvironment, EXPECTED_SCREENSHOTS_DIRECTORY_PATH, @@ -128,7 +129,7 @@ const playwrightConfig = defineConfig({ testDir: join(relativePathFromInstalledE2edToRoot, TESTS_DIRECTORY_PATH), testIgnore: ['**/node_modules/**', '**/*.skip.ts'], testMatch: userlandPack.testFileGlobs as Mutable, - timeout: userlandPack.testTimeout, + timeout: userlandPack.testTimeout + AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS, workers: userlandPack.concurrency, ...userlandPack.overriddenConfigFields, use: useOptions, diff --git a/src/constants/error.ts b/src/constants/error.ts new file mode 100644 index 00000000..56560f0f --- /dev/null +++ b/src/constants/error.ts @@ -0,0 +1,6 @@ +/** + * Timeout in milliseconds for additional actions after an error in test + * (taking a screenshot of the page, etc.). + * @internal + */ +export const AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS = 8_000; diff --git a/src/constants/internal.ts b/src/constants/internal.ts index 97aae588..89328370 100644 --- a/src/constants/internal.ts +++ b/src/constants/internal.ts @@ -18,6 +18,8 @@ export { START_TIME_IN_MS_VARIABLE_NAME, UI_MODE_VARIABLE_NAME, } from './environment'; +/** @internal */ +export {AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS} from './error'; export {READ_FILE_OPTIONS} from './fs'; /** @internal */ export {AMOUNT_OF_PARALLEL_OPEN_FILES} from './fs'; diff --git a/src/step.ts b/src/step.ts index c4a97102..1d58094f 100644 --- a/src/step.ts +++ b/src/step.ts @@ -34,7 +34,7 @@ export const step = async ( const errorProperties: StepErrorProperties = { stepBody: body, stepName: name, - stepOptions: options, + stepOptions: {...options, payload: {...options.payload}}, }; let isTestRunCompleted = false; let payload = undefined as LogPayload | Void; diff --git a/src/utils/test/afterErrorInTest.ts b/src/utils/test/afterErrorInTest.ts index db38c836..1c1a1bc4 100644 --- a/src/utils/test/afterErrorInTest.ts +++ b/src/utils/test/afterErrorInTest.ts @@ -2,6 +2,7 @@ import {getBrowserConsoleMessages} from '../../actions/getBrowserConsoleMessages'; // eslint-disable-next-line import/no-internal-modules import {getBrowserJsErrors} from '../../actions/getBrowserJsErrors'; +import {AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS} from '../../constants/internal'; import {addTimeoutToPromise} from '../promise'; @@ -9,8 +10,6 @@ import {takeScreenshotsOnErrorIfNeeded} from './takeScreenshotsOnErrorIfNeeded'; import type {TestStaticOptions} from '../../types/internal'; -const afterErrorInTestTimeoutInMs = 8_000; - /** * Internal "after error in test" hook. * @internal @@ -24,5 +23,5 @@ export const afterErrorInTest = (testStaticOptions: TestStaticOptions): Promise< await takeScreenshotsOnErrorIfNeeded(testStaticOptions); })(), - afterErrorInTestTimeoutInMs, + AFTER_ERROR_IN_TEST_TIMEOUT_IN_MS, );