@dev-blinq/cucumber_client 1.0.1245-dev → 1.0.1247-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.
@@ -109,13 +109,13 @@ const invertStableCommand = (call, elements, stepParams) => {
109
109
 
110
110
  case "click":
111
111
  // Handle different click scenarios
112
+ step.type = Types.CLICK;
113
+ step.element = extractElement(call.arguments[0]);
112
114
  if (call.arguments.length > 2 && call.arguments[2]?.type === "ObjectExpression") {
113
115
  // Context click
114
- step.type = "context_click";
115
- step.element = extractElement(call.arguments[0]);
116
-
117
116
  const contextProp = call.arguments[2].properties.find((prop) => prop.key.name === "context");
118
117
  if (contextProp) {
118
+ step.type = "context_click";
119
119
  const contextValue = parseDataSource(contextProp.value, stepParams);
120
120
  if (contextValue.type === "literal") {
121
121
  step.value = contextValue.value;
@@ -125,9 +125,10 @@ const invertStableCommand = (call, elements, stepParams) => {
125
125
  step.value = toVariableName(contextValue.dataKey);
126
126
  }
127
127
  }
128
- } else {
129
- step.type = Types.CLICK;
130
- step.element = extractElement(call.arguments[0]);
128
+ const clickCountProp = call.arguments[2].properties.find((prop) => prop.key.name === "clickCount");
129
+ if (clickCountProp) {
130
+ step.count = clickCountProp.value.value;
131
+ }
131
132
  }
132
133
  break;
133
134
 
@@ -53,8 +53,8 @@ const _isCodeGenerationStep = (step) => {
53
53
  step.type === Types.PRESS ||
54
54
  step.type === Types.SET_INPUT ||
55
55
  step.type === Types.FILL_UNKNOWN ||
56
- step.type === "context_click" ||
57
- step.type === "parameterized_click" ||
56
+ step.type === Types.CONTEXT_CLICK ||
57
+ step.type === Types.PARAMETERIZED_CLICK ||
58
58
  step.type === Types.VERIFY_ATTRIBUTE ||
59
59
  step.type === Types.VERIFY_PROPERTY ||
60
60
  step.type === Types.SET_INPUT_FILES ||
@@ -191,19 +191,51 @@ const _generateCodeFromCommand = (step, elements, userData) => {
191
191
  line = `await context.web.setCheck(elements["${elementIdentifier}"], ${step.check}, _params, null, this);`;
192
192
  codeLines.push(line);
193
193
  } else {
194
- if (element_name) {
195
- comment = `// Click on ${element_name}`;
196
- codeLines.push(escapeNonPrintables(comment));
194
+ switch (step.count) {
195
+ case 1:
196
+ if (element_name) {
197
+ comment = `// Click on ${element_name}`;
198
+ codeLines.push(escapeNonPrintables(comment));
199
+ }
200
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
201
+ codeLines.push(line);
202
+ break;
203
+ case 2:
204
+ if (element_name) {
205
+ comment = `// Double click on ${element_name}`;
206
+ codeLines.push(escapeNonPrintables(comment));
207
+ }
208
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, {clickCount:2}, this);`;
209
+ codeLines.push(line);
210
+ break;
211
+ default:
212
+ if (element_name) {
213
+ comment = `// Click on ${element_name}`;
214
+ codeLines.push(escapeNonPrintables(comment));
215
+ }
216
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
217
+ codeLines.push(line);
218
+ break;
197
219
  }
198
-
199
- line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
200
- codeLines.push(line);
201
220
  }
202
221
  break;
203
- case "parameterized_click":
204
- comment = `// Parameterized click on ${step.value}`;
205
- codeLines.push(escapeNonPrintables(comment));
206
- line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
222
+ case Types.PARAMETERIZED_CLICK:
223
+ switch (step.count) {
224
+ case 1:
225
+ comment = `// Parameterized click on ${step.value}`;
226
+ codeLines.push(escapeNonPrintables(comment));
227
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
228
+ break;
229
+ case 2:
230
+ comment = `// Parameterized double click on ${step.value}`;
231
+ codeLines.push(escapeNonPrintables(comment));
232
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, {clickCount:2}, this);`;
233
+ break;
234
+ default:
235
+ comment = `// Parameterized click on ${step.value}`;
236
+ codeLines.push(escapeNonPrintables(comment));
237
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, null, this);`;
238
+ }
207
239
  codeLines.push(line);
208
240
  break;
209
241
  case Types.SET_DATE_TIME:
@@ -541,15 +573,39 @@ const _generateCodeFromCommand = (step, elements, userData) => {
541
573
  line = `await context.web.clickType( elements["${elementIdentifier}"] ,"${step.key}",null, _params, {"press":true}, this);`;
542
574
  codeLines.push(line);
543
575
  break;
544
- case "context_click":
545
- comment = `// Click on ${elementIdentifier ? elementIdentifier : step.label} in the context of ${escapeNonPrintables(step.value)}`;
546
- codeLines.push(escapeNonPrintables(comment));
547
- input = `"${escapeNonPrintables(step.value)}"`;
548
- if (step.dataSource === "userData" || step.dataSource === "parameters") {
549
- input = "_" + step.dataKey;
576
+ case Types.CONTEXT_CLICK:
577
+ switch (step.count) {
578
+ case 1:
579
+ comment = `// Click on ${elementIdentifier ? elementIdentifier : step.label} in the context of ${escapeNonPrintables(step.value)}`;
580
+ codeLines.push(escapeNonPrintables(comment));
581
+ input = `"${escapeNonPrintables(step.value)}"`;
582
+ if (step.dataSource === "userData" || step.dataSource === "parameters") {
583
+ input = "_" + step.dataKey;
584
+ }
585
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, {"context": ${input}}, this);`;
586
+ codeLines.push(line);
587
+ break;
588
+ case 2:
589
+ comment = `// Double click on ${elementIdentifier ? elementIdentifier : step.label} in the context of ${escapeNonPrintables(step.value)}`;
590
+ codeLines.push(escapeNonPrintables(comment));
591
+ input = `"${escapeNonPrintables(step.value)}"`;
592
+ if (step.dataSource === "userData" || step.dataSource === "parameters") {
593
+ input = "_" + step.dataKey;
594
+ }
595
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, {"context": ${input}, clickCount:2}, this);`;
596
+ codeLines.push(line);
597
+ break;
598
+ default:
599
+ comment = `// Click on ${elementIdentifier ? elementIdentifier : step.label} in the context of ${escapeNonPrintables(step.value)}`;
600
+ codeLines.push(escapeNonPrintables(comment));
601
+ input = `"${escapeNonPrintables(step.value)}"`;
602
+ if (step.dataSource === "userData" || step.dataSource === "parameters") {
603
+ input = "_" + step.dataKey;
604
+ }
605
+ line = `await context.web.click(elements["${elementIdentifier}"], _params, {"context": ${input}}, this);`;
606
+ codeLines.push(line);
607
+ break;
550
608
  }
551
- line = `await context.web.click(elements["${elementIdentifier}"], _params, {"context": ${input}}, this);`;
552
- codeLines.push(line);
553
609
  break;
554
610
  case "popup_close":
555
611
  break;
@@ -8,6 +8,8 @@ const Types = {
8
8
  API: "api",
9
9
  CLICK: "click_element",
10
10
  CLICK_SIMPLE: "click_simple",
11
+ PARAMETERIZED_CLICK: "parameterized_click",
12
+ CONTEXT_CLICK: "context_click",
11
13
  NAVIGATE: "navigate",
12
14
  FILL: "fill_element",
13
15
  FILL_SIMPLE: "fill_simple",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dev-blinq/cucumber_client",
3
- "version": "1.0.1245-dev",
3
+ "version": "1.0.1247-dev",
4
4
  "description": "",
5
5
  "main": "bin/index.js",
6
6
  "types": "bin/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@cucumber/tag-expressions": "^6.1.1",
29
29
  "@dev-blinq/cucumber-js": "1.0.173-dev",
30
30
  "@faker-js/faker": "^8.1.0",
31
- "automation_model": "1.0.744-dev",
31
+ "automation_model": "1.0.745-dev",
32
32
  "axios": "^1.7.4",
33
33
  "chokidar": "^3.6.0",
34
34
  "create-require": "^1.1.1",