@dev-blinq/cucumber_client 1.0.1247-dev → 1.0.1247-stage
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/assets/bundled_scripts/recorder.js +220 -0
- package/bin/assets/preload/recorderv3.js +5 -3
- package/bin/assets/preload/unique_locators.js +1 -1
- package/bin/assets/scripts/aria_snapshot.js +235 -0
- package/bin/assets/scripts/dom_attr.js +372 -0
- package/bin/assets/scripts/dom_element.js +0 -0
- package/bin/assets/scripts/dom_parent.js +185 -0
- package/bin/assets/scripts/event_utils.js +105 -0
- package/bin/assets/scripts/pw.js +7886 -0
- package/bin/assets/scripts/recorder.js +1147 -0
- package/bin/assets/scripts/snapshot_capturer.js +155 -0
- package/bin/assets/scripts/unique_locators.js +852 -0
- package/bin/assets/scripts/yaml.js +4770 -0
- package/bin/assets/templates/_hooks_template.txt +37 -0
- package/bin/assets/templates/page_template.txt +2 -16
- package/bin/assets/templates/utils_template.txt +44 -71
- package/bin/client/apiTest/apiTest.js +6 -0
- package/bin/client/cli_helpers.js +11 -13
- package/bin/client/code_cleanup/utils.js +41 -14
- package/bin/client/code_gen/code_inversion.js +61 -4
- package/bin/client/code_gen/page_reflection.js +12 -15
- package/bin/client/code_gen/playwright_codeget.js +55 -16
- package/bin/client/cucumber/feature.js +89 -27
- package/bin/client/cucumber/project_to_document.js +1 -1
- package/bin/client/cucumber/steps_definitions.js +84 -76
- package/bin/client/cucumber_selector.js +13 -1
- package/bin/client/local_agent.js +3 -3
- package/bin/client/project.js +7 -1
- package/bin/client/recorderv3/bvt_recorder.js +298 -123
- package/bin/client/recorderv3/implemented_steps.js +74 -16
- package/bin/client/recorderv3/index.js +47 -25
- package/bin/client/recorderv3/network.js +299 -0
- package/bin/client/recorderv3/services.js +3 -15
- package/bin/client/recorderv3/step_runner.js +325 -67
- package/bin/client/recorderv3/step_utils.js +152 -5
- package/bin/client/recorderv3/update_feature.js +66 -34
- package/bin/client/recording.js +3 -0
- package/bin/client/run_cucumber.js +5 -1
- package/bin/client/scenario_report.js +0 -5
- package/bin/client/test_scenario.js +0 -1
- package/bin/client/utils/socket_logger.js +132 -0
- package/bin/index.js +1 -0
- package/package.json +17 -9
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, writeFileSync } from "fs";
|
|
1
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import fs from "fs";
|
|
4
3
|
import { generatePageName } from "../code_gen/playwright_codeget.js";
|
|
5
4
|
import {
|
|
6
5
|
executeStep,
|
|
@@ -9,43 +8,75 @@ import {
|
|
|
9
8
|
getUtilsCodePage,
|
|
10
9
|
loadStepDefinitions,
|
|
11
10
|
saveRecording,
|
|
11
|
+
saveRoutes,
|
|
12
12
|
} from "./step_utils.js";
|
|
13
13
|
import { escapeString, getExamplesContent } from "./update_feature.js";
|
|
14
|
+
import fs from "fs";
|
|
14
15
|
import { locateDefinitionPath } from "../cucumber/steps_definitions.js";
|
|
16
|
+
import { tmpdir } from "os";
|
|
17
|
+
import socketLogger from "../utils/socket_logger.js";
|
|
15
18
|
|
|
16
|
-
// let copiedCodeToTemp = false;
|
|
17
|
-
async function withAbort(fn, signal) {
|
|
18
|
-
if (!signal) {
|
|
19
|
-
return await fn();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const abortPromise = new Promise((_, reject) => {
|
|
23
|
-
signal.addEventListener("abort", () => reject(new Error("Aborted")), { once: true });
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
return await Promise.race([fn(), abortPromise]);
|
|
27
|
-
}
|
|
28
19
|
export class BVTStepRunner {
|
|
29
|
-
#currentStepController;
|
|
20
|
+
#currentStepController = null;
|
|
30
21
|
#port;
|
|
31
|
-
|
|
22
|
+
#lastAttemptedCmdId = null;
|
|
23
|
+
|
|
24
|
+
constructor({ projectDir, sendExecutionStatus, bvtContext }) {
|
|
32
25
|
this.projectDir = projectDir;
|
|
26
|
+
this.sendExecutionStatus = sendExecutionStatus;
|
|
27
|
+
this.bvtContext = bvtContext;
|
|
28
|
+
this.liveExecutionMap = new Map();
|
|
33
29
|
}
|
|
30
|
+
|
|
34
31
|
setRemoteDebugPort(port) {
|
|
35
32
|
this.#port = port;
|
|
36
33
|
}
|
|
34
|
+
|
|
35
|
+
// Abort the current cucumber step execution by signaling the wrapper
|
|
37
36
|
async abortExecution() {
|
|
37
|
+
if (this.bvtContext.web.pausedCmd) {
|
|
38
|
+
this.bvtContext.web.pausedCmd = null;
|
|
39
|
+
}
|
|
40
|
+
this.liveExecutionMap.clear();
|
|
38
41
|
if (this.#currentStepController) {
|
|
39
42
|
this.#currentStepController.abort();
|
|
40
43
|
}
|
|
41
44
|
}
|
|
42
45
|
|
|
46
|
+
async pauseExecution(cmdId) {
|
|
47
|
+
if (this.bvtContext.web) {
|
|
48
|
+
this.bvtContext.web.pausedCmd = {
|
|
49
|
+
id: cmdId,
|
|
50
|
+
...this.liveExecutionMap.get(cmdId),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async resumeExecution(cmdId) {
|
|
56
|
+
if (this.bvtContext.web.pausedCmd) {
|
|
57
|
+
const { resolve } = this.bvtContext.web.pausedCmd;
|
|
58
|
+
if (resolve) {
|
|
59
|
+
resolve();
|
|
60
|
+
}
|
|
61
|
+
this.bvtContext.web.pausedCmd = null;
|
|
62
|
+
} else {
|
|
63
|
+
socketLogger.warn(`bvtContext.web.pausedCmd is null`);
|
|
64
|
+
if (this.liveExecutionMap.has(cmdId)) {
|
|
65
|
+
const { resolve } = this.liveExecutionMap.get(cmdId);
|
|
66
|
+
if (resolve) {
|
|
67
|
+
resolve();
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
console.warn(`No paused command found for cmdId: ${cmdId}`);
|
|
71
|
+
socketLogger.error(`No paused command found for cmdId: ${cmdId}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
43
76
|
async copyCodetoTempFolder({ step, parametersMap, tempFolderPath }) {
|
|
44
|
-
// const tempFolderPath = path.join(this.projectDir, "__temp_features");
|
|
45
77
|
if (!fs.existsSync(tempFolderPath)) {
|
|
46
78
|
fs.mkdirSync(tempFolderPath);
|
|
47
79
|
}
|
|
48
|
-
//copy all files from "./features" "./temp" folder
|
|
49
80
|
if (fs.existsSync(tempFolderPath)) {
|
|
50
81
|
fs.rmSync(tempFolderPath, { recursive: true });
|
|
51
82
|
}
|
|
@@ -53,14 +84,13 @@ export class BVTStepRunner {
|
|
|
53
84
|
overwrite: true,
|
|
54
85
|
recursive: true,
|
|
55
86
|
});
|
|
56
|
-
// copiedCodeToTemp = true;
|
|
57
87
|
}
|
|
58
88
|
|
|
59
|
-
async writeTempFeatureFile({ step, parametersMap, tempFolderPath }) {
|
|
89
|
+
async writeTempFeatureFile({ step, parametersMap, tempFolderPath, tags }) {
|
|
60
90
|
const tFilePath = path.join(tempFolderPath, "__temp.feature");
|
|
61
|
-
// console.log(tFilePath);
|
|
62
91
|
let tFileContent = `# temp feature file
|
|
63
92
|
Feature: Temp feature
|
|
93
|
+
${tags ? tags.join(" ") : ""}
|
|
64
94
|
Scenario Outline: Temp Scenario
|
|
65
95
|
Given ${escapeString(step.text)}
|
|
66
96
|
`;
|
|
@@ -68,67 +98,295 @@ export class BVTStepRunner {
|
|
|
68
98
|
writeFileSync(tFilePath, tFileContent);
|
|
69
99
|
return tFilePath;
|
|
70
100
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
|
|
102
|
+
// Generate wrapper code that integrates AbortSignal into cucumber step definitions
|
|
103
|
+
generateWrapperCode() {
|
|
104
|
+
return `
|
|
105
|
+
import {setDefinitionFunctionWrapper} from "@dev-blinq/cucumber-js";
|
|
106
|
+
|
|
107
|
+
setDefinitionFunctionWrapper((fn) => {
|
|
108
|
+
return async function (...args) {
|
|
109
|
+
const signal = global.__BVT_STEP_ABORT_SIGNAL;
|
|
110
|
+
if (signal) {
|
|
111
|
+
signal.throwIfAborted?.();
|
|
112
|
+
const abortHandler = () => {
|
|
113
|
+
throw new Error("Aborted");
|
|
114
|
+
};
|
|
115
|
+
signal.addEventListener("abort", abortHandler, { once: true });
|
|
116
|
+
try {
|
|
117
|
+
return await fn.apply(this, args);
|
|
118
|
+
} finally {
|
|
119
|
+
signal.removeEventListener("abort", abortHandler);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return await fn.apply(this, args);
|
|
123
|
+
};
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
`;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Write the wrapper code to temp folder
|
|
130
|
+
async writeWrapperCode(tempFolderPath, abortSignal) {
|
|
131
|
+
// tempFolderPath/step_definitions/utils.mjs -> Make a file name that follows this file but always before the next file
|
|
132
|
+
let fileName = "utils" + Math.random().toString(36).substring(2, 7) + ".mjs";
|
|
133
|
+
while (existsSync(path.join(tempFolderPath, "step_definitions", fileName))) {
|
|
134
|
+
fileName = "utils" + Math.random().toString(36).substring(2, 7) + ".mjs";
|
|
135
|
+
}
|
|
136
|
+
const wrapperCode = this.generateWrapperCode();
|
|
137
|
+
|
|
138
|
+
// Ensure directory exists
|
|
139
|
+
const stepDefinitionFolderPath = path.join(tempFolderPath, "step_definitions");
|
|
140
|
+
if (!existsSync(stepDefinitionFolderPath)) {
|
|
141
|
+
mkdirSync(stepDefinitionFolderPath, { recursive: true });
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
writeFileSync(path.join(stepDefinitionFolderPath, fileName), wrapperCode);
|
|
145
|
+
|
|
146
|
+
// Set the abort signal globally so the wrapper can access it
|
|
147
|
+
global.__BVT_STEP_ABORT_SIGNAL = abortSignal;
|
|
148
|
+
|
|
149
|
+
return path.join(stepDefinitionFolderPath, fileName);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Execute cucumber step - simplified without abort signal handling at this level
|
|
153
|
+
async executeStepWithAbort({ feature_file_path, scenario, tempFolderPath, stepText, config }, options) {
|
|
154
|
+
const { skipAfter = true, skipBefore = true } = options || {};
|
|
155
|
+
|
|
156
|
+
const environment = { ...process.env };
|
|
157
|
+
const { loadConfiguration, loadSupport, runCucumber } = await import("@dev-blinq/cucumber-js/api");
|
|
158
|
+
|
|
159
|
+
const { runConfiguration } = await loadConfiguration(
|
|
160
|
+
{
|
|
161
|
+
provided: {
|
|
162
|
+
name: [scenario],
|
|
163
|
+
paths: [feature_file_path],
|
|
164
|
+
import: [path.join(tempFolderPath, "step_definitions", "**", "*.mjs")],
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
{ cwd: process.cwd(), env: environment }
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const support = await loadSupport(runConfiguration, { cwd: process.cwd(), env: environment });
|
|
171
|
+
|
|
172
|
+
support.afterTestRunHookDefinitions = [];
|
|
173
|
+
if (skipAfter) {
|
|
174
|
+
support.afterTestCaseHookDefinitions = [];
|
|
175
|
+
}
|
|
176
|
+
if (skipBefore && !config.legacySyntax) {
|
|
177
|
+
support.beforeTestCaseHookDefinitions = support.beforeTestCaseHookDefinitions.filter((hook) => {
|
|
178
|
+
return hook.uri.endsWith("_hooks.mjs");
|
|
91
179
|
});
|
|
92
180
|
}
|
|
181
|
+
support.beforeTestRunHookDefinitions = [];
|
|
93
182
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
183
|
+
let errorMessage = null;
|
|
184
|
+
let info = null;
|
|
185
|
+
let errInfo = null;
|
|
186
|
+
|
|
187
|
+
const result = await runCucumber({ ...runConfiguration, support }, environment, (message) => {
|
|
188
|
+
if (message.testStepFinished) {
|
|
189
|
+
const { testStepFinished } = message;
|
|
190
|
+
const { testStepResult } = testStepFinished;
|
|
191
|
+
if (testStepResult.status === "FAILED" || testStepResult.status === "AMBIGUOUS") {
|
|
192
|
+
if (!errorMessage) {
|
|
193
|
+
errorMessage = testStepResult.message;
|
|
194
|
+
if (info) {
|
|
195
|
+
errInfo = info;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (testStepResult.status === "UNDEFINED") {
|
|
200
|
+
if (!errorMessage) {
|
|
201
|
+
errorMessage = `step ${JSON.stringify(stepText)} is ${testStepResult.status}`;
|
|
202
|
+
if (info) {
|
|
203
|
+
errInfo = info;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
107
207
|
}
|
|
108
|
-
if (
|
|
109
|
-
|
|
208
|
+
if (message.attachment) {
|
|
209
|
+
const attachment = message.attachment;
|
|
210
|
+
if (attachment.mediaType === "application/json" && attachment.body) {
|
|
211
|
+
const body = JSON.parse(attachment.body);
|
|
212
|
+
info = body.info;
|
|
213
|
+
const result = body.result;
|
|
214
|
+
|
|
215
|
+
if (result.status === "PASSED") {
|
|
216
|
+
this.sendExecutionStatus({
|
|
217
|
+
type: "cmdExecutionSuccess",
|
|
218
|
+
cmdId: body.cmdId,
|
|
219
|
+
selectedStrategy: info?.selectedStrategy,
|
|
220
|
+
});
|
|
221
|
+
} else {
|
|
222
|
+
this.sendExecutionStatus({
|
|
223
|
+
type: "cmdExecutionError",
|
|
224
|
+
cmdId: body.cmdId,
|
|
225
|
+
error: {
|
|
226
|
+
message: result.message,
|
|
227
|
+
info,
|
|
228
|
+
},
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
} else if (attachment.mediaType === "application/json+intercept-results" && attachment.body) {
|
|
232
|
+
const body = JSON.parse(attachment.body);
|
|
233
|
+
if (body) {
|
|
234
|
+
this.sendExecutionStatus({
|
|
235
|
+
type: "interceptResults",
|
|
236
|
+
interceptResults: body,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}
|
|
110
240
|
}
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
if (errorMessage) {
|
|
244
|
+
const bvtError = new Error(errorMessage);
|
|
245
|
+
Object.assign(bvtError, { info: errInfo });
|
|
246
|
+
throw bvtError;
|
|
111
247
|
}
|
|
112
|
-
const feature_file_path = await this.writeTempFeatureFile({ step, parametersMap, tempFolderPath });
|
|
113
|
-
// console.log({ feature_file_path, step_text: step.text });
|
|
114
248
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
249
|
+
return { result, info };
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
async runStep({ step, parametersMap, envPath, tags, config }, bvtContext, options) {
|
|
253
|
+
// Create a new AbortController for this specific step execution
|
|
254
|
+
this.#currentStepController = new AbortController();
|
|
255
|
+
const { signal } = this.#currentStepController;
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
this.#lastAttemptedCmdId = null;
|
|
259
|
+
let cmdIDs = (step.commands || []).map((cmd) => cmd.cmdId);
|
|
260
|
+
bvtContext.web.pausedCmd = null;
|
|
261
|
+
|
|
262
|
+
// Clear the liveExecutionMap and set up new entries for this step
|
|
263
|
+
this.liveExecutionMap.clear();
|
|
264
|
+
|
|
265
|
+
for (const cmdId of cmdIDs) {
|
|
266
|
+
this.liveExecutionMap.set(cmdId, {
|
|
267
|
+
resolve: () => {},
|
|
268
|
+
reject: () => {},
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (bvtContext.web) {
|
|
273
|
+
bvtContext.web.getCmdId = () => {
|
|
274
|
+
if (cmdIDs.length === 0) {
|
|
275
|
+
cmdIDs = (step.commands || []).map((cmd) => cmd.cmdId);
|
|
276
|
+
}
|
|
277
|
+
const cId = cmdIDs.shift();
|
|
278
|
+
this.sendExecutionStatus({
|
|
279
|
+
type: "cmdExecutionStart",
|
|
280
|
+
cmdId: cId,
|
|
281
|
+
});
|
|
282
|
+
this.#lastAttemptedCmdId = cId;
|
|
283
|
+
return cId;
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const __temp_features_FolderName = "__temp_features" + Math.random().toString(36).substring(2, 7);
|
|
288
|
+
const tempFolderPath = path.join(this.projectDir, __temp_features_FolderName);
|
|
289
|
+
process.env.tempFeaturesFolderPath = __temp_features_FolderName;
|
|
290
|
+
process.env.TESTCASE_REPORT_FOLDER_PATH = tempFolderPath;
|
|
291
|
+
|
|
292
|
+
await this.copyCodetoTempFolder({ step, parametersMap, tempFolderPath });
|
|
293
|
+
|
|
294
|
+
// Write abort wrapper code with this step's signal
|
|
295
|
+
await this.writeWrapperCode(tempFolderPath, signal);
|
|
296
|
+
|
|
297
|
+
let stepsDefinitions = loadStepDefinitions(this.projectDir, false, true);
|
|
298
|
+
const cucumberStep = getCucumberStep({ step });
|
|
299
|
+
|
|
300
|
+
if (cucumberStep.parameters && Array.isArray(cucumberStep.parameters)) {
|
|
301
|
+
cucumberStep.parameters.forEach((param) => {
|
|
302
|
+
if (param.variableName) {
|
|
303
|
+
param.callValue = parametersMap[param.variableName];
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (!step.isImplemented && step.commands.length > 0) {
|
|
309
|
+
const pageName = generatePageName(step.startFrame?.url ?? "default");
|
|
310
|
+
const stepDefinitionFolderPath = path.join(tempFolderPath, "step_definitions");
|
|
311
|
+
if (!existsSync(stepDefinitionFolderPath)) {
|
|
312
|
+
mkdirSync(stepDefinitionFolderPath, { recursive: true });
|
|
313
|
+
}
|
|
314
|
+
const stepDefsFilePath = locateDefinitionPath(tempFolderPath, pageName);
|
|
315
|
+
let codePage = getCodePage(stepDefsFilePath);
|
|
316
|
+
codePage = await saveRecording({
|
|
317
|
+
step,
|
|
318
|
+
cucumberStep,
|
|
319
|
+
codePage,
|
|
320
|
+
projectDir: this.projectDir,
|
|
321
|
+
stepsDefinitions,
|
|
322
|
+
});
|
|
323
|
+
if (codePage) {
|
|
324
|
+
await codePage.save(stepDefsFilePath);
|
|
325
|
+
}
|
|
326
|
+
if (!codePage) {
|
|
327
|
+
codePage = getUtilsCodePage(this.projectDir);
|
|
328
|
+
}
|
|
329
|
+
} else {
|
|
330
|
+
let routesPath = path.join(tmpdir(), `blinq_temp_routes`);
|
|
331
|
+
if (process.env.TEMP_RUN === "true") {
|
|
332
|
+
if (existsSync(routesPath)) {
|
|
333
|
+
rmSync(routesPath, { recursive: true });
|
|
334
|
+
}
|
|
335
|
+
mkdirSync(routesPath, { recursive: true });
|
|
336
|
+
saveRoutes({ step, folderPath: routesPath });
|
|
337
|
+
} else {
|
|
338
|
+
if (existsSync(routesPath)) {
|
|
339
|
+
try {
|
|
340
|
+
rmSync(routesPath, { recursive: true });
|
|
341
|
+
} catch (error) {
|
|
342
|
+
console.error("Error removing temp_routes folder", error);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
routesPath = path.join(this.projectDir, "data", "routes");
|
|
346
|
+
if (!existsSync(routesPath)) {
|
|
347
|
+
mkdirSync(routesPath, { recursive: true });
|
|
348
|
+
}
|
|
349
|
+
saveRoutes({ step, folderPath: routesPath });
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const feature_file_path = await this.writeTempFeatureFile({
|
|
354
|
+
step,
|
|
355
|
+
parametersMap,
|
|
356
|
+
tempFolderPath,
|
|
357
|
+
tags,
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
// Execute the cucumber step - if wrapper throws "Aborted", it will propagate up
|
|
361
|
+
const { result, info } = await this.executeStepWithAbort(
|
|
119
362
|
{
|
|
120
363
|
feature_file_path,
|
|
121
364
|
tempFolderPath,
|
|
122
365
|
stepText: step.text,
|
|
123
366
|
scenario: "Temp Scenario",
|
|
367
|
+
config,
|
|
124
368
|
},
|
|
125
369
|
options
|
|
126
370
|
);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
371
|
+
|
|
372
|
+
return { result, info };
|
|
373
|
+
} catch (error) {
|
|
374
|
+
if (error.message && error.message.includes("Aborted")) {
|
|
375
|
+
throw new Error("Aborted");
|
|
376
|
+
} else throw error;
|
|
377
|
+
} finally {
|
|
378
|
+
// Clean up this step's controller and global reference
|
|
379
|
+
this.#currentStepController = null;
|
|
380
|
+
global.__BVT_STEP_ABORT_SIGNAL = null;
|
|
381
|
+
|
|
382
|
+
// Clean up temp folder
|
|
383
|
+
const __temp_features_FolderName = process.env.tempFeaturesFolderPath;
|
|
384
|
+
if (__temp_features_FolderName) {
|
|
385
|
+
const tempFolderPath = path.join(this.projectDir, __temp_features_FolderName);
|
|
386
|
+
if (fs.existsSync(tempFolderPath)) {
|
|
387
|
+
fs.rmSync(tempFolderPath, { recursive: true });
|
|
388
|
+
}
|
|
131
389
|
}
|
|
132
|
-
}
|
|
390
|
+
}
|
|
133
391
|
}
|
|
134
392
|
}
|