@dev-blinq/cucumber_client 1.0.1678-dev → 1.0.1679-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.
|
@@ -375,7 +375,7 @@ const _generateCodeFromCommand = (step, elements, userData) => {
|
|
|
375
375
|
codeLines.push(escapeNonPrintables(comment));
|
|
376
376
|
line = `const frameLocator = ${JSON.stringify(step.selectors ?? null)}`;
|
|
377
377
|
codeLines.push(line);
|
|
378
|
-
line = `await context.web.snapshotValidation(frameLocator
|
|
378
|
+
line = `await context.web.snapshotValidation(frameLocator,${step.valueInStepText ? "_param_0" : `"${step.parameters[0]}"`}, _params, ${JSON.stringify(options)}, this);`;
|
|
379
379
|
codeLines.push(line);
|
|
380
380
|
|
|
381
381
|
const data = step.data;
|
|
@@ -666,7 +666,7 @@ const _generateCodeFromCommand = (step, elements, userData) => {
|
|
|
666
666
|
}
|
|
667
667
|
case Types.VERIFY_PROPERTY: {
|
|
668
668
|
line = `await context.web.verifyProperty(elements["${elementIdentifier}"], `;
|
|
669
|
-
input = "_param_0"
|
|
669
|
+
input = step.valueInStepText ? "_param_0" : `"${escapeNonPrintables(step.parameters[1].replaceAll('"', '\\"'))}"`;
|
|
670
670
|
if (step.dataSource === "userData" || step.dataSource === "parameters") {
|
|
671
671
|
input = "_" + step.dataKey;
|
|
672
672
|
}
|
|
@@ -676,7 +676,7 @@ const _generateCodeFromCommand = (step, elements, userData) => {
|
|
|
676
676
|
}
|
|
677
677
|
case Types.CONDITIONAL_WAIT: {
|
|
678
678
|
line = `await context.web.conditionalWait(elements["${elementIdentifier}"], `;
|
|
679
|
-
input = "_param_0"
|
|
679
|
+
input = step.valueInStepText ? "_param_0" : `"${escapeNonPrintables(step.parameters[1].replaceAll('"', '\\"'))}"`;
|
|
680
680
|
line += `"${step.parameters[1]}", ${input}, _params, null, this);`;
|
|
681
681
|
codeLines.push(line);
|
|
682
682
|
break;
|
|
@@ -706,22 +706,6 @@ const _generateCodeFromCommand = (step, elements, userData) => {
|
|
|
706
706
|
return { codeLines, elements: elementsChanged ? elements : null, elementIdentifier, allStrategyLocators };
|
|
707
707
|
};
|
|
708
708
|
|
|
709
|
-
/**
|
|
710
|
-
* Generates a report command based on the given position.
|
|
711
|
-
* @param {"start"|"end"} position
|
|
712
|
-
*/
|
|
713
|
-
const generateReportCommand = (position, cmdId) => {
|
|
714
|
-
const codeLines = [];
|
|
715
|
-
if (position === "start") {
|
|
716
|
-
const line = `await context.web.addCommandToReport("${cmdId}", "PASSED", '{"status":"start","cmdId":"${cmdId}"}', {type:"cmdReport"},this);`;
|
|
717
|
-
codeLines.push(line);
|
|
718
|
-
} else if (position === "end") {
|
|
719
|
-
const line = `await context.web.addCommandToReport("${cmdId}", "PASSED", '{"status":"end","cmdId":"${cmdId}"}', {type:"cmdReport"},this);`;
|
|
720
|
-
codeLines.push(line);
|
|
721
|
-
}
|
|
722
|
-
return codeLines;
|
|
723
|
-
};
|
|
724
|
-
|
|
725
709
|
const generateCode = (recording, codePage, userData, projectDir, methodName) => {
|
|
726
710
|
const stepsDefinitions = new StepsDefinitions(projectDir);
|
|
727
711
|
stepsDefinitions.load(false);
|
|
@@ -48,7 +48,7 @@ const replaceLastOccurence = (str, search, replacement) => {
|
|
|
48
48
|
return str.substring(0, lastIndex) + replacement + str.substring(lastIndex + search.length);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
const _toRecordingStep = (cmd) => {
|
|
51
|
+
const _toRecordingStep = (cmd, stepText) => {
|
|
52
52
|
switch (cmd.type) {
|
|
53
53
|
case "hover_element": {
|
|
54
54
|
return {
|
|
@@ -250,6 +250,7 @@ const _toRecordingStep = (cmd) => {
|
|
|
250
250
|
},
|
|
251
251
|
parameters: [cmd.selectedField, cmd.value],
|
|
252
252
|
lastKnownUrlPath: cmd.lastKnownUrlPath,
|
|
253
|
+
valueInStepText: stepText && typeof stepText === "string" ? stepText.includes(`"${cmd.value}"`) : false,
|
|
253
254
|
};
|
|
254
255
|
}
|
|
255
256
|
case "conditional_wait": {
|
|
@@ -261,6 +262,7 @@ const _toRecordingStep = (cmd) => {
|
|
|
261
262
|
},
|
|
262
263
|
parameters: [cmd.timeout, cmd.selectedField, cmd.value],
|
|
263
264
|
lastKnownUrlPath: cmd.lastKnownUrlPath,
|
|
265
|
+
valueInStepText: stepText && typeof stepText === "string" ? stepText.includes(`"${cmd.value}"`) : false,
|
|
264
266
|
};
|
|
265
267
|
}
|
|
266
268
|
case "navigate": {
|
|
@@ -297,6 +299,7 @@ const _toRecordingStep = (cmd) => {
|
|
|
297
299
|
parameters: [cmd.value],
|
|
298
300
|
selectors: cmd.selectors,
|
|
299
301
|
data: cmd.data,
|
|
302
|
+
valueInStepText: stepText && typeof stepText === "string" ? stepText.includes(`"${cmd.value}"`) : false,
|
|
300
303
|
};
|
|
301
304
|
}
|
|
302
305
|
default: {
|
|
@@ -360,14 +363,14 @@ const parameterizeLocators = ({ cmd, locs, isValueVariable, isTargetValueVariabl
|
|
|
360
363
|
};
|
|
361
364
|
|
|
362
365
|
//TODO: IMPORTAN
|
|
363
|
-
export const toRecordingStep = (cmd, parametersMap) => {
|
|
366
|
+
export const toRecordingStep = (cmd, parametersMap, stepText) => {
|
|
364
367
|
if (cmd.type === "api") {
|
|
365
368
|
return {
|
|
366
369
|
type: "api",
|
|
367
370
|
value: cmd.value,
|
|
368
371
|
};
|
|
369
372
|
}
|
|
370
|
-
const step = _toRecordingStep(cmd);
|
|
373
|
+
const step = _toRecordingStep(cmd, stepText);
|
|
371
374
|
const cmdID = {
|
|
372
375
|
cmdId: cmd.id,
|
|
373
376
|
};
|
|
@@ -494,7 +497,7 @@ function makeStepTextUnique(step, stepsDefinitions) {
|
|
|
494
497
|
|
|
495
498
|
export async function saveRecording({ step, cucumberStep, codePage, projectDir, stepsDefinitions, parametersMap }) {
|
|
496
499
|
if (step.commands && Array.isArray(step.commands)) {
|
|
497
|
-
step.commands = step.commands.map((cmd) => toRecordingStep(cmd, parametersMap));
|
|
500
|
+
step.commands = step.commands.map((cmd) => toRecordingStep(cmd, parametersMap, step.text));
|
|
498
501
|
}
|
|
499
502
|
let routesPath = path.join(tmpdir(), "blinq_temp_routes");
|
|
500
503
|
|