@dev-blinq/cucumber_client 1.0.1630-dev → 1.0.1632-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.
|
@@ -390,6 +390,7 @@ class BVTRecorder {
|
|
|
390
390
|
}
|
|
391
391
|
case "input": {
|
|
392
392
|
const target = this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(event));
|
|
393
|
+
|
|
393
394
|
if (target.nodeName === "INPUT" && target.type.toLowerCase() === "file") {
|
|
394
395
|
return {
|
|
395
396
|
details: {
|
|
@@ -434,6 +435,36 @@ class BVTRecorder {
|
|
|
434
435
|
return;
|
|
435
436
|
}
|
|
436
437
|
case "keydown": {
|
|
438
|
+
// override event.preventDefault to capture the value
|
|
439
|
+
|
|
440
|
+
const oldPreventDefault = event.preventDefault.bind(event);
|
|
441
|
+
event.preventDefault = () => {
|
|
442
|
+
if (event.key.length >= 1 && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
443
|
+
const target = this.eventUtils.getNearestInteractiveElement(this.eventUtils.deepEventTarget(event));
|
|
444
|
+
setTimeout(() => {
|
|
445
|
+
if (event.__bvt_recorded !== undefined) return;
|
|
446
|
+
const valueBefore = target.value;
|
|
447
|
+
let newValue = valueBefore;
|
|
448
|
+
|
|
449
|
+
this.recordEvent(
|
|
450
|
+
{
|
|
451
|
+
details: {
|
|
452
|
+
name: "fill",
|
|
453
|
+
text: newValue,
|
|
454
|
+
},
|
|
455
|
+
element: target,
|
|
456
|
+
},
|
|
457
|
+
target,
|
|
458
|
+
"input",
|
|
459
|
+
event
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
event.__bvt_recorded = true;
|
|
463
|
+
}, 20);
|
|
464
|
+
}
|
|
465
|
+
oldPreventDefault();
|
|
466
|
+
};
|
|
467
|
+
|
|
437
468
|
if (!this.eventUtils.shouldGenerateKeyPressFor(event)) return;
|
|
438
469
|
// if (this._actionInProgress(event)) {
|
|
439
470
|
// this._expectProgrammaticKeyUp = true;
|
|
@@ -835,30 +866,7 @@ class BVTRecorder {
|
|
|
835
866
|
}
|
|
836
867
|
|
|
837
868
|
performance.mark("command-send");
|
|
838
|
-
|
|
839
|
-
mode: this.#mode,
|
|
840
|
-
action: action.details,
|
|
841
|
-
element: this.getElementDetails(actionElement, eventName),
|
|
842
|
-
isPopupCloseClick: this.isPopupCloseEvent(e),
|
|
843
|
-
// ...(actionElement.__locators ?? this.getLocatorsObject(actionElement, { maxLocators: 1 })),
|
|
844
|
-
frame: this.getFrameDetails(),
|
|
845
|
-
statistics: {
|
|
846
|
-
time: `${performance.measure("command-received", "command-send").duration.toFixed(2)} ms`,
|
|
847
|
-
},
|
|
848
|
-
};
|
|
849
|
-
const snapshotDetails = {
|
|
850
|
-
id: actionElement.getAttribute("data-blinq-id"),
|
|
851
|
-
contextId: this.contextElement?.getAttribute("data-blinq-context-id"),
|
|
852
|
-
doc: this.snapshotCapturer.createSnapshot({
|
|
853
|
-
excludeSelectors: ["x-bvt-toolbar", "script", "style", "link[rel=stylesheet]"],
|
|
854
|
-
}),
|
|
855
|
-
};
|
|
856
|
-
cmd.snapshotDetails = snapshotDetails;
|
|
857
|
-
// eventQueue.enqueue(async () => {
|
|
858
|
-
// await bvtRecorderBindings.validateLocators(snapshotDetails);
|
|
859
|
-
// });
|
|
860
|
-
// console.log(cmd);
|
|
861
|
-
bvtRecorderBindings.recordCommand(cmd);
|
|
869
|
+
this.recordEvent(action, actionElement, eventName, e);
|
|
862
870
|
this.handleStateTransition(action.element);
|
|
863
871
|
},
|
|
864
872
|
{ capture: true }
|
|
@@ -866,6 +874,33 @@ class BVTRecorder {
|
|
|
866
874
|
});
|
|
867
875
|
}
|
|
868
876
|
|
|
877
|
+
recordEvent(action, actionElement, eventName, e) {
|
|
878
|
+
const cmd = {
|
|
879
|
+
mode: this.#mode,
|
|
880
|
+
action: action.details,
|
|
881
|
+
element: this.getElementDetails(actionElement, eventName),
|
|
882
|
+
isPopupCloseClick: this.isPopupCloseEvent(e),
|
|
883
|
+
// ...(actionElement.__locators ?? this.getLocatorsObject(actionElement, { maxLocators: 1 })),
|
|
884
|
+
frame: this.getFrameDetails(),
|
|
885
|
+
statistics: {
|
|
886
|
+
time: `${performance.measure("command-received", "command-send").duration.toFixed(2)} ms`,
|
|
887
|
+
},
|
|
888
|
+
};
|
|
889
|
+
const snapshotDetails = {
|
|
890
|
+
id: actionElement.getAttribute("data-blinq-id"),
|
|
891
|
+
contextId: this.contextElement?.getAttribute("data-blinq-context-id"),
|
|
892
|
+
doc: this.snapshotCapturer.createSnapshot({
|
|
893
|
+
excludeSelectors: ["x-bvt-toolbar", "script", "style", "link[rel=stylesheet]"],
|
|
894
|
+
}),
|
|
895
|
+
};
|
|
896
|
+
cmd.snapshotDetails = snapshotDetails;
|
|
897
|
+
// eventQueue.enqueue(async () => {
|
|
898
|
+
// await bvtRecorderBindings.validateLocators(snapshotDetails);
|
|
899
|
+
// });
|
|
900
|
+
// console.log(cmd);
|
|
901
|
+
bvtRecorderBindings.recordCommand(cmd);
|
|
902
|
+
}
|
|
903
|
+
|
|
869
904
|
// TODO: implement the corresponding logic for the below methods
|
|
870
905
|
setPopupHandlers(_popopHandlers) {
|
|
871
906
|
this.popupHandlers = _popopHandlers;
|
|
@@ -631,7 +631,7 @@ export class CodePage {
|
|
|
631
631
|
const config = getAiConfig();
|
|
632
632
|
if (config && config.locatorsMetadataDir) {
|
|
633
633
|
console.log("Using locators metadata directory from config:", config.locatorsMetadataDir);
|
|
634
|
-
locatorsMetadataFileName = path.join(
|
|
634
|
+
locatorsMetadataFileName = locatorsMetadataFileName.replace(path.join("features", "step_definitions"), path.join(config.locatorsMetadataDir));
|
|
635
635
|
if (!existsSync(path.dirname(locatorsMetadataFileName))) {
|
|
636
636
|
mkdirSync(path.dirname(locatorsMetadataFileName), { recursive: true });
|
|
637
637
|
}
|