@dev-blinq/cucumber_client 1.0.1668-dev → 1.0.1670-dev
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.
|
@@ -370,7 +370,7 @@ export class CodePage {
|
|
|
370
370
|
return result;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
addInfraCommandUtil(methodName, description, stepVariables, stepCodeLines, renamedText, previousText, protectStep = false, source = null, codePath = "") {
|
|
373
|
+
addInfraCommandUtil(methodName, description, stepVariables, stepCodeLines, renamedText, previousText, parametersMap, protectStep = false, source = null, codePath = "") {
|
|
374
374
|
let code = "\n";
|
|
375
375
|
code += "/**\n";
|
|
376
376
|
code += ` * ${description}\n`;
|
|
@@ -393,7 +393,11 @@ export class CodePage {
|
|
|
393
393
|
code += `// source: ${source}\n`;
|
|
394
394
|
code += `// implemented_at: ${new Date().toISOString()}\n`;
|
|
395
395
|
stepCodeLines.forEach((line) => (code += ` ${line}\n`));
|
|
396
|
-
if (renamedText) {
|
|
396
|
+
if (renamedText === "verify_page_title" || renamedText === "verify_page_url") {
|
|
397
|
+
const parameters = stepVariables.map((v) => parametersMap[v.text.replace(/[<>]/g, "")]);
|
|
398
|
+
code += `await ${renamedText}(${parameters.map((v) => (isNaN(Number(v)) ? `"${v}"` : Number(v))).join(", ")});\n`;
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
397
401
|
code += `await ${renamedText}(${stepVariables.map((v) => (isNaN(Number(v.text)) ? `"${v.text}"` : Number(v.text))).join(", ")});\n`;
|
|
398
402
|
}
|
|
399
403
|
code += "}\n";
|
|
@@ -43,7 +43,7 @@ class PromisifiedSocketServer {
|
|
|
43
43
|
}
|
|
44
44
|
this.socket.emit("response", { id, value: response, roomId, socketId });
|
|
45
45
|
} catch (error) {
|
|
46
|
-
console.error(`Error handling request for event: ${event}`, error);
|
|
46
|
+
console.error(`Error handling request for event: ${JSON.stringify(event, null, 2)}`, error);
|
|
47
47
|
socketLogger.error("Error handling request", {
|
|
48
48
|
event,
|
|
49
49
|
input,
|
|
@@ -157,37 +157,45 @@ export class PublishService {
|
|
|
157
157
|
const runsURL = getRunsServiceBaseURL();
|
|
158
158
|
const workspaceURL = runsURL.replace("/runs", "/workspace");
|
|
159
159
|
const url = `${workspaceURL}/publish-recording`;
|
|
160
|
-
const result = await axiosClient({
|
|
161
|
-
url,
|
|
162
|
-
method: "POST",
|
|
163
|
-
data: {
|
|
164
|
-
scenario,
|
|
165
|
-
featureName,
|
|
166
|
-
override,
|
|
167
|
-
env,
|
|
168
|
-
},
|
|
169
|
-
params: {
|
|
170
|
-
branch,
|
|
171
|
-
},
|
|
172
|
-
headers: {
|
|
173
|
-
Authorization: `Bearer ${this.TOKEN}`,
|
|
174
|
-
"X-Source": "recorder",
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
if (result.status !== 200) {
|
|
178
|
-
return { success: false, message: "Error while saving scenario" };
|
|
179
|
-
}
|
|
180
160
|
try {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
161
|
+
const result = await axiosClient({
|
|
162
|
+
url,
|
|
163
|
+
method: "POST",
|
|
164
|
+
data: {
|
|
165
|
+
scenario,
|
|
166
|
+
featureName,
|
|
167
|
+
override,
|
|
168
|
+
env,
|
|
169
|
+
},
|
|
170
|
+
params: {
|
|
171
|
+
branch,
|
|
172
|
+
},
|
|
173
|
+
headers: {
|
|
174
|
+
Authorization: `Bearer ${this.TOKEN}`,
|
|
175
|
+
"X-Source": "recorder",
|
|
176
|
+
},
|
|
187
177
|
});
|
|
178
|
+
if (result.status !== 200) {
|
|
179
|
+
return { success: false, message: "Error while saving scenario" };
|
|
180
|
+
}
|
|
181
|
+
try {
|
|
182
|
+
this.updateProjectMetadata({
|
|
183
|
+
featureName,
|
|
184
|
+
scenarioName: scenario.name,
|
|
185
|
+
projectId,
|
|
186
|
+
branch,
|
|
187
|
+
isEditing: override,
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
catch (error) { }
|
|
191
|
+
return { success: true, data: result.data };
|
|
192
|
+
}
|
|
193
|
+
catch (error) {
|
|
194
|
+
// @ts-ignore
|
|
195
|
+
const reason = error?.response?.data?.error || "";
|
|
196
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
197
|
+
throw new Error(`Failed to save scenario: ${errorMessage} \n ${reason}`);
|
|
188
198
|
}
|
|
189
|
-
catch (error) { }
|
|
190
|
-
return { success: true, data: result.data };
|
|
191
199
|
}
|
|
192
200
|
async updateProjectMetadata({ featureName, scenarioName, projectId, branch, isEditing }) {
|
|
193
201
|
try {
|
|
@@ -665,6 +665,7 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
665
665
|
generateCodeResult.codeLines,
|
|
666
666
|
step.renamedText,
|
|
667
667
|
step.text,
|
|
668
|
+
parametersMap,
|
|
668
669
|
protect,
|
|
669
670
|
"recorder",
|
|
670
671
|
path
|
|
@@ -690,7 +691,7 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
|
|
|
690
691
|
step.finalTimeout
|
|
691
692
|
);
|
|
692
693
|
|
|
693
|
-
if (!step.renamedText) {
|
|
694
|
+
if (!step.renamedText && !(step.isImplemented && step.shouldOverride)) {
|
|
694
695
|
stepsDefinitions.addStep({
|
|
695
696
|
name: step.text,
|
|
696
697
|
file: codePage.sourceFileName,
|