@dev-blinq/cucumber_client 1.0.1255-dev → 1.0.1255-stage
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.
- package/bin/assets/bundled_scripts/recorder.js +159 -14071
- package/bin/assets/preload/recorderv3.js +4 -2
- package/bin/assets/scripts/dom_parent.js +26 -0
- package/bin/assets/scripts/recorder.js +9 -8
- package/bin/assets/scripts/unique_locators.js +847 -547
- package/bin/assets/templates/_hooks_template.txt +37 -0
- package/bin/assets/templates/page_template.txt +2 -16
- package/bin/assets/templates/utils_template.txt +44 -71
- package/bin/client/apiTest/apiTest.js +6 -0
- package/bin/client/cli_helpers.js +11 -13
- package/bin/client/code_cleanup/utils.js +5 -1
- package/bin/client/code_gen/code_inversion.js +61 -4
- package/bin/client/code_gen/page_reflection.js +10 -3
- package/bin/client/code_gen/playwright_codeget.js +55 -16
- package/bin/client/cucumber/feature.js +89 -27
- package/bin/client/cucumber/project_to_document.js +1 -1
- package/bin/client/cucumber/steps_definitions.js +84 -76
- package/bin/client/cucumber_selector.js +13 -1
- package/bin/client/local_agent.js +3 -3
- package/bin/client/project.js +7 -1
- package/bin/client/recorderv3/bvt_recorder.js +285 -80
- package/bin/client/recorderv3/implemented_steps.js +74 -16
- package/bin/client/recorderv3/index.js +47 -25
- package/bin/client/recorderv3/network.js +299 -0
- package/bin/client/recorderv3/services.js +4 -16
- package/bin/client/recorderv3/step_runner.js +326 -67
- package/bin/client/recorderv3/step_utils.js +152 -5
- package/bin/client/recorderv3/update_feature.js +66 -34
- package/bin/client/recording.js +3 -0
- package/bin/client/run_cucumber.js +5 -1
- package/bin/client/scenario_report.js +0 -5
- package/bin/client/test_scenario.js +0 -1
- package/bin/client/utils/socket_logger.js +132 -0
- package/bin/index.js +1 -0
- package/package.json +15 -12
|
@@ -955,6 +955,7 @@ class BVTRecorder {
|
|
|
955
955
|
// Get all attributes
|
|
956
956
|
if (element.attributes) {
|
|
957
957
|
for (const attr of element.attributes) {
|
|
958
|
+
if (attr.name === "data-blinq-id" || attr.name === "data-input-id") continue;
|
|
958
959
|
unsortedAttributes[attr.name] = attr.value;
|
|
959
960
|
}
|
|
960
961
|
}
|
|
@@ -962,6 +963,7 @@ class BVTRecorder {
|
|
|
962
963
|
// Get dataset properties (data-* attributes)
|
|
963
964
|
if (element.dataset) {
|
|
964
965
|
for (const [key, value] of Object.entries(element.dataset)) {
|
|
966
|
+
if (key === "blinqId" || key === "inputId") continue;
|
|
965
967
|
unsortedDataset[key] = value;
|
|
966
968
|
}
|
|
967
969
|
}
|
|
@@ -989,7 +991,7 @@ class BVTRecorder {
|
|
|
989
991
|
el.__locators = this.getLocatorsObject(el);
|
|
990
992
|
}
|
|
991
993
|
const role = window.getAriaRole(el);
|
|
992
|
-
const label = window.getElementAccessibleName(el, false) || window.getElementAccessibleName(el, true) ||
|
|
994
|
+
const label = window.getElementAccessibleName(el, false) || window.getElementAccessibleName(el, true) || "";
|
|
993
995
|
const result = this.getElementProperties(el);
|
|
994
996
|
return {
|
|
995
997
|
role,
|
|
@@ -1188,7 +1190,7 @@ class BVTRecorder {
|
|
|
1188
1190
|
cssLocators.push(origenCss);
|
|
1189
1191
|
}
|
|
1190
1192
|
const noClasses = CssSelectorGenerator.getCssSelector(el, {
|
|
1191
|
-
blacklist: [/^(?!.*h\d).*?\d.*/, /\[style/, /\[data-input-id
|
|
1193
|
+
blacklist: [/^(?!.*h\d).*?\d.*/, /\[style/, /\[data-input-id/],
|
|
1192
1194
|
combineWithinSelector: true,
|
|
1193
1195
|
combineBetweenSelectors: true,
|
|
1194
1196
|
selectors: ["id", "attribute", "tag", "nthchild", "nthoftype"],
|
|
@@ -6,6 +6,10 @@ class DOM_Parent {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
// TODO: account for slotted elements
|
|
9
|
+
|
|
10
|
+
if (element.assignedSlot) {
|
|
11
|
+
return element.assignedSlot
|
|
12
|
+
}
|
|
9
13
|
// Get the actual parent element, skipping shadow DOM if necessary
|
|
10
14
|
let parent = element.parentElement;
|
|
11
15
|
if (parent) {
|
|
@@ -35,6 +39,28 @@ class DOM_Parent {
|
|
|
35
39
|
|
|
36
40
|
return ancestors;
|
|
37
41
|
}
|
|
42
|
+
getFullAncestorChainToRoot(element, root) {
|
|
43
|
+
if (!element || !(element instanceof Element)) {
|
|
44
|
+
throw new Error('Invalid element provided');
|
|
45
|
+
}
|
|
46
|
+
if (!root || !(root instanceof Element)) {
|
|
47
|
+
throw new Error('Invalid root provided');
|
|
48
|
+
}
|
|
49
|
+
if (!this.containsElementCrossShadow(root, element)) {
|
|
50
|
+
throw new Error('Root does not contain the element');
|
|
51
|
+
}
|
|
52
|
+
const ancestors = [];
|
|
53
|
+
let currentElement = element;
|
|
54
|
+
while (currentElement && currentElement !== root && this.containsElementCrossShadow(root, currentElement)) {
|
|
55
|
+
ancestors.push(currentElement);
|
|
56
|
+
currentElement = this.getActualParent(currentElement);
|
|
57
|
+
|
|
58
|
+
}
|
|
59
|
+
if (currentElement === root) {
|
|
60
|
+
ancestors.push(currentElement);
|
|
61
|
+
}
|
|
62
|
+
return ancestors;
|
|
63
|
+
}
|
|
38
64
|
getClimbCountToParent(element, targetParent) {
|
|
39
65
|
if (!element || !(element instanceof Element)) {
|
|
40
66
|
throw new Error('Invalid element provided');
|
|
@@ -642,6 +642,8 @@ class BVTRecorder {
|
|
|
642
642
|
// Get all attributes
|
|
643
643
|
if (element.attributes) {
|
|
644
644
|
for (const attr of element.attributes) {
|
|
645
|
+
if (attr.name === "data-input-id") continue; // skip input id attribute
|
|
646
|
+
if (attr.name === "data-blinq-id") continue; // skip blinq id attribute{
|
|
645
647
|
unsortedAttributes[attr.name] = attr.value;
|
|
646
648
|
}
|
|
647
649
|
}
|
|
@@ -649,6 +651,8 @@ class BVTRecorder {
|
|
|
649
651
|
// Get dataset properties (data-* attributes)
|
|
650
652
|
if (element.dataset) {
|
|
651
653
|
for (const [key, value] of Object.entries(element.dataset)) {
|
|
654
|
+
if (key === "inputId") continue; // skip input id dataset property
|
|
655
|
+
if (key === "blinqId") continue; // skip blinq id dataset property
|
|
652
656
|
unsortedDataset[key] = value;
|
|
653
657
|
}
|
|
654
658
|
}
|
|
@@ -678,7 +682,6 @@ class BVTRecorder {
|
|
|
678
682
|
const label =
|
|
679
683
|
this.PW.roleUtils.getElementAccessibleName(el, false) ||
|
|
680
684
|
this.PW.roleUtils.getElementAccessibleName(el, true) ||
|
|
681
|
-
role ||
|
|
682
685
|
"";
|
|
683
686
|
const result = this.getElementProperties(el);
|
|
684
687
|
return {
|
|
@@ -687,7 +690,7 @@ class BVTRecorder {
|
|
|
687
690
|
inputID: el.dataset.inputId,
|
|
688
691
|
tagName: el.tagName,
|
|
689
692
|
type: el.type,
|
|
690
|
-
text: this.PW.selectorUtils.elementText(new Map(), el).full,
|
|
693
|
+
text: this.PW.selectorUtils.elementText(new Map(), el).full.trim(),
|
|
691
694
|
parent: `tagname: ${el.parentElement?.tagName}\ninnerText: ${el.parentElement?.innerText}`,
|
|
692
695
|
attrs: {
|
|
693
696
|
placeholder: el.getAttribute("placeholder"),
|
|
@@ -999,7 +1002,7 @@ class BVTTool extends HTMLElement {
|
|
|
999
1002
|
const tooltip = this.#tooltip;
|
|
1000
1003
|
|
|
1001
1004
|
tooltip.style.opacity = "0"; // hide before measuring
|
|
1002
|
-
tooltip.style.left = "0px";
|
|
1005
|
+
tooltip.style.left = "0px"; // reset for accurate width calc
|
|
1003
1006
|
tooltip.style.top = "0px";
|
|
1004
1007
|
tooltip.style.transform = "none"; // remove old transform
|
|
1005
1008
|
|
|
@@ -1019,7 +1022,6 @@ class BVTTool extends HTMLElement {
|
|
|
1019
1022
|
tooltip.style.top = `${rect.bottom + 20}px`;
|
|
1020
1023
|
tooltip.style.opacity = "1";
|
|
1021
1024
|
});
|
|
1022
|
-
|
|
1023
1025
|
}
|
|
1024
1026
|
hideTooltip() {
|
|
1025
1027
|
if (this.#tooltip) {
|
|
@@ -1109,8 +1111,7 @@ class BVTToolBar extends HTMLElement {
|
|
|
1109
1111
|
|
|
1110
1112
|
// document.addEventListener("mousemove", moveHandler);
|
|
1111
1113
|
// document.addEventListener("mouseup", upHandler);
|
|
1112
|
-
}
|
|
1113
|
-
);
|
|
1114
|
+
});
|
|
1114
1115
|
return dragHandler;
|
|
1115
1116
|
}
|
|
1116
1117
|
getHoverTool() {
|
|
@@ -1118,7 +1119,7 @@ class BVTToolBar extends HTMLElement {
|
|
|
1118
1119
|
const hoverTool = document.createElement("x-bvt-tool");
|
|
1119
1120
|
hoverTool.name = "hover";
|
|
1120
1121
|
hoverTool.tooltipText = "Record hover over an element";
|
|
1121
|
-
hoverTool.innerHTML = `<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M13.999 17.175l-3.452.774a.391.391 0 00-.245.172l-1.664 2.6c-.809 1.265-2.743.924-3.072-.541L3.71 10.963C3.38 9.493 4.99 8.36 6.263 9.167l8.271 4.933c1.27.805.933 2.746-.535 3.075z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="stroke: currentColor; fill: none;" /><rect x="11" y="3" width="12" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><rect x="11" y="7" width="9" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><rect x="11" y="11" width="12" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><circle cx="9" cy="4" r="1" fill="currentColor" style="fill: currentColor;"/><circle cx="9" cy="8" r="1" fill="currentColor" style="fill: currentColor;"/></svg
|
|
1122
|
+
hoverTool.innerHTML = `<svg width="24" height="24" fill="none" xmlns="http://www.w3.org/2000/svg"><path clip-rule="evenodd" d="M13.999 17.175l-3.452.774a.391.391 0 00-.245.172l-1.664 2.6c-.809 1.265-2.743.924-3.072-.541L3.71 10.963C3.38 9.493 4.99 8.36 6.263 9.167l8.271 4.933c1.27.805.933 2.746-.535 3.075z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="stroke: currentColor; fill: none;" /><rect x="11" y="3" width="12" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><rect x="11" y="7" width="9" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><rect x="11" y="11" width="12" height="2" rx="1" fill="currentColor" style="fill: currentColor;"/><circle cx="9" cy="4" r="1" fill="currentColor" style="fill: currentColor;"/><circle cx="9" cy="8" r="1" fill="currentColor" style="fill: currentColor;"/></svg>`;
|
|
1122
1123
|
// hoverTool.addEventListener("click", this.onHoverMode);
|
|
1123
1124
|
return hoverTool;
|
|
1124
1125
|
}
|
|
@@ -1143,4 +1144,4 @@ class BVTToolBar extends HTMLElement {
|
|
|
1143
1144
|
}
|
|
1144
1145
|
|
|
1145
1146
|
customElements.define("x-bvt-tool", BVTTool);
|
|
1146
|
-
customElements.define("x-bvt-toolbar", BVTToolBar);
|
|
1147
|
+
customElements.define("x-bvt-toolbar", BVTToolBar);
|