@dev-blinq/cucumber_client 1.0.1729-dev → 1.0.1731-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.
|
@@ -898,63 +898,70 @@ export async function updateStepDefinitions({ scenario, featureName, projectDir,
|
|
|
898
898
|
|
|
899
899
|
stepsDefinitions.load(false);
|
|
900
900
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
901
|
+
steps.forEach(async (step, index) => {
|
|
902
|
+
try {
|
|
903
|
+
if (step.internalImplementedStepId) {
|
|
904
|
+
const si = steps.findIndex((s) => s.id === step.internalImplementedStepId);
|
|
905
|
+
if (si !== -1) {
|
|
906
|
+
step.isImplementedWhileRecording = true;
|
|
907
|
+
}
|
|
906
908
|
}
|
|
907
|
-
}
|
|
908
909
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
910
|
+
if (!step.isUtilStep && ((step.isImplemented && !step.shouldOverride) || step.commands.length === 0)) {
|
|
911
|
+
let routesPath = path.join(tmpdir(), `blinq_temp_routes`);
|
|
912
|
+
if (process.env.TEMP_RUN === "true") {
|
|
913
|
+
if (existsSync(routesPath)) rmSync(routesPath, { recursive: true });
|
|
914
|
+
mkdirSync(routesPath, { recursive: true });
|
|
915
|
+
saveRoutes({ step, folderPath: routesPath }, logger);
|
|
916
|
+
} else {
|
|
917
|
+
if (existsSync(routesPath)) {
|
|
918
|
+
try {
|
|
919
|
+
rmSync(routesPath, { recursive: true });
|
|
920
|
+
} catch (error) {
|
|
921
|
+
logger.error(`❌ Error removing temp routes folder: ${getErrorMessage(error)}`);
|
|
922
|
+
}
|
|
921
923
|
}
|
|
924
|
+
routesPath = path.join(projectDir, "data", "routes");
|
|
925
|
+
if (!existsSync(routesPath)) mkdirSync(routesPath, { recursive: true });
|
|
926
|
+
saveRoutes({ step, folderPath: routesPath }, logger);
|
|
922
927
|
}
|
|
923
|
-
routesPath = path.join(projectDir, "data", "routes");
|
|
924
|
-
if (!existsSync(routesPath)) mkdirSync(routesPath, { recursive: true });
|
|
925
|
-
saveRoutes({ step, folderPath: routesPath }, logger);
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
if (step.commands && Array.isArray(step.commands)) {
|
|
929
|
-
step.commands = step.commands.map((cmd) => toRecordingStep(cmd, scenario.parametersMap));
|
|
930
|
-
}
|
|
931
|
-
|
|
932
|
-
continue;
|
|
933
|
-
}
|
|
934
928
|
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
let codePage = getCodePage(stepDefsFilePath);
|
|
939
|
-
|
|
940
|
-
codePage = await saveRecording({
|
|
941
|
-
step,
|
|
942
|
-
cucumberStep,
|
|
943
|
-
codePage,
|
|
944
|
-
projectDir,
|
|
945
|
-
stepsDefinitions,
|
|
946
|
-
parametersMap: scenario.parametersMap,
|
|
947
|
-
});
|
|
929
|
+
if (step.commands && Array.isArray(step.commands)) {
|
|
930
|
+
step.commands = step.commands.map((cmd) => toRecordingStep(cmd, scenario.parametersMap));
|
|
931
|
+
}
|
|
948
932
|
|
|
949
|
-
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
950
935
|
|
|
951
|
-
|
|
952
|
-
|
|
936
|
+
const cucumberStep = getCucumberStep({ step });
|
|
937
|
+
const pageName = generatePageName(step.startFrame?.url ?? "default", step.isUtilStep);
|
|
938
|
+
const stepDefsFilePath = locateDefinitionPath(featureFolder, pageName);
|
|
939
|
+
let codePage = getCodePage(stepDefsFilePath);
|
|
940
|
+
|
|
941
|
+
codePage = await saveRecording({
|
|
942
|
+
step,
|
|
943
|
+
cucumberStep,
|
|
944
|
+
codePage,
|
|
945
|
+
projectDir,
|
|
946
|
+
stepsDefinitions,
|
|
947
|
+
parametersMap: scenario.parametersMap,
|
|
948
|
+
});
|
|
949
|
+
|
|
950
|
+
if (!codePage) return;
|
|
951
|
+
|
|
952
|
+
const res = await codePage.save();
|
|
953
|
+
if (!res) {
|
|
954
|
+
throw new DomainError(
|
|
955
|
+
`Failed to save step definition for "${cucumberStep.text}" in "${codePage.sourceFileName}"`
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
} catch (error) {
|
|
959
|
+
logger.error(`❌ Failed to update step definition for step "${step.text}": ${getErrorMessage(error)}`);
|
|
953
960
|
throw new DomainError(
|
|
954
|
-
`Failed to
|
|
961
|
+
`Failed to update step definition for step "${step.text}" at index ${index}: ${getErrorMessage(error)}`
|
|
955
962
|
);
|
|
956
963
|
}
|
|
957
|
-
}
|
|
964
|
+
});
|
|
958
965
|
|
|
959
966
|
writeFileSync(utilsFilePath, utilsContent, "utf8");
|
|
960
967
|
} catch (error) {
|