@dev-blinq/cucumber_client 1.0.1407-dev → 1.0.1408-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.
@@ -6,6 +6,7 @@ import crypto from "crypto";
6
6
  import { findFilesWithExtension } from "./cucumber/steps_definitions.js";
7
7
  import fs from "fs";
8
8
  //import { spawn } from "child_process";
9
+ const __dirname = path.dirname(new URL(import.meta.url).pathname);
9
10
 
10
11
  if (process.argv.length < 3) {
11
12
  console.log("Usage: node cucumber_selector.js <projectsDir> --all");
@@ -100,8 +101,8 @@ if (process.argv.includes("--scenario-name")) {
100
101
  }
101
102
  const projectName = selectedScenario.featureFile.split(path.sep)[0];
102
103
  let deleteMjsFiles = readlineSync.keyInYN("Delete mjs file?");
104
+ let stepsPath = path.join(selectedScenario.projectsDir, projectName, "features", "step_definitions");
103
105
  if (deleteMjsFiles) {
104
- let stepsPath = path.join(selectedScenario.projectsDir, projectName, "features", "step_definitions");
105
106
  if (fs.existsSync(stepsPath)) {
106
107
  // delete all the *.mjs files
107
108
  let files = fs.readdirSync(stepsPath);
@@ -112,6 +113,17 @@ if (deleteMjsFiles) {
112
113
  }
113
114
  }
114
115
  }
116
+ // copy utils file to the steps directory
117
+ const utilsPath = path.join(__dirname, "../assets/templates/utils_template.txt");
118
+ const utilsContent = fs.readFileSync(utilsPath, "utf8");
119
+ const utilsFileName = stepsPath + "/utils.mjs";
120
+ fs.writeFileSync(utilsFileName, utilsContent, "utf8");
121
+ // copy hooks file to the steps directory
122
+ const hooksTemplateFilePath = path.join(__dirname, "../assets/templates/_hooks_template.txt");
123
+ const hooksContent = fs.readFileSync(hooksTemplateFilePath, "utf8");
124
+ const hooksFilePath = path.join(stepsPath, "_hooks.mjs");
125
+ fs.writeFileSync(hooksFilePath, hooksContent, "utf8");
126
+
115
127
  process.env.PROJECT_PATH = path.join(selectedScenario.projectsDir, projectName);
116
128
  //chanks[currentChank][index];
117
129
  console.log("Running scenario:");
@@ -216,12 +216,18 @@ export async function saveRecording({ step, cucumberStep, codePage, projectDir,
216
216
  if (step.commands && step.commands.length > 0 && step.commands[0]) {
217
217
  path = step.commands[0].lastKnownUrlPath;
218
218
  }
219
+ let protect = false;
220
+ if (step.commands && step.commands.length > 0 && step.commands[0].type) {
221
+ if (step.commands[0].type === "verify_element_property" || step.commands[0].type === "conditional_wait") {
222
+ protect = true;
223
+ }
224
+ }
219
225
  const infraResult = codePage.addInfraCommand(
220
226
  methodName,
221
227
  description,
222
228
  cucumberStep.getVariablesList(),
223
229
  generateCodeResult.codeLines,
224
- false,
230
+ protect,
225
231
  "recorder",
226
232
  path
227
233
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1407-dev",
3
+ "version": "1.0.1408-dev",
4
4
  "description": " ",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",