@dev-blinq/cucumber_client 1.0.1366-dev → 1.0.1367-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.
|
@@ -12,6 +12,13 @@ const findElementIdentifier = (node, step, userData, elements) => {
|
|
|
12
12
|
|
|
13
13
|
let elementIdentifier = null;
|
|
14
14
|
const keys = Object.keys(elements);
|
|
15
|
+
|
|
16
|
+
for (let i = 0; i < keys.length; i++) {
|
|
17
|
+
const element_key = keys[i];
|
|
18
|
+
const element = elements[element_key];
|
|
19
|
+
element["element_key"] = element_key;
|
|
20
|
+
}
|
|
21
|
+
|
|
15
22
|
let name = node.name;
|
|
16
23
|
if (!name && step.dataKey) {
|
|
17
24
|
name = step.dataKey;
|
|
@@ -92,7 +99,7 @@ const splitToLocatorsGroups = (locators) => {
|
|
|
92
99
|
const _generateCodeFromCommand = (step, elements, userData) => {
|
|
93
100
|
let elementsChanged = false;
|
|
94
101
|
|
|
95
|
-
let elementIdentifier =
|
|
102
|
+
let elementIdentifier = step.locators?.element_key;
|
|
96
103
|
let locatorObject = step.locators;
|
|
97
104
|
// handle element
|
|
98
105
|
let element_name = null;
|
|
@@ -130,18 +137,20 @@ const _generateCodeFromCommand = (step, elements, userData) => {
|
|
|
130
137
|
let locatorObjectClone = JSON.parse(JSON.stringify(locatorObject));
|
|
131
138
|
element_name = locatorObjectClone.element_name;
|
|
132
139
|
delete locatorObjectClone.element_name;
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
if (!elementIdentifier) {
|
|
141
|
+
keys.forEach((key) => {
|
|
142
|
+
let elementClone = JSON.parse(JSON.stringify(elements[key]));
|
|
143
|
+
delete elementClone.element_name;
|
|
144
|
+
if (JSON.stringify(elementClone) === JSON.stringify(locatorObjectClone)) {
|
|
145
|
+
elementIdentifier = key;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
}
|
|
140
149
|
if (!elementIdentifier) {
|
|
141
150
|
elementIdentifier = findElementIdentifier(node, step, userData, elements);
|
|
142
151
|
}
|
|
143
152
|
const withoutAllStrategyLocators = excludeKey(locatorObject, "allStrategyLocators");
|
|
144
|
-
elements[elementIdentifier] = withoutAllStrategyLocators;
|
|
153
|
+
elements[elementIdentifier] = { ...withoutAllStrategyLocators, element_key: elementIdentifier };
|
|
145
154
|
elementsChanged = true;
|
|
146
155
|
}
|
|
147
156
|
let optionElement = null;
|
|
@@ -215,7 +215,7 @@ export class BVTRecorder {
|
|
|
215
215
|
this.pageSet = new Set();
|
|
216
216
|
this.lastKnownUrlPath = "";
|
|
217
217
|
// TODO: what is world?
|
|
218
|
-
this.world = { attach: () => {} };
|
|
218
|
+
this.world = { attach: () => { } };
|
|
219
219
|
this.shouldTakeScreenshot = true;
|
|
220
220
|
this.watcher = null;
|
|
221
221
|
}
|
|
@@ -323,7 +323,7 @@ export class BVTRecorder {
|
|
|
323
323
|
process.env.CDP_LISTEN_PORT = this.#remoteDebuggerPort;
|
|
324
324
|
|
|
325
325
|
this.stepRunner.setRemoteDebugPort(this.#remoteDebuggerPort);
|
|
326
|
-
this.world = { attach: () => {} };
|
|
326
|
+
this.world = { attach: () => { } };
|
|
327
327
|
|
|
328
328
|
const ai_config_file = path.join(this.projectDir, "ai_config.json");
|
|
329
329
|
let ai_config = {};
|
|
@@ -351,6 +351,7 @@ export class BVTRecorder {
|
|
|
351
351
|
const context = bvtContext.playContext;
|
|
352
352
|
this.context = context;
|
|
353
353
|
this.web = bvtContext.stable || bvtContext.web;
|
|
354
|
+
this.web.tryAllStrategies = true;
|
|
354
355
|
this.page = bvtContext.page;
|
|
355
356
|
|
|
356
357
|
this.pageSet.add(this.page);
|
|
@@ -730,7 +731,7 @@ export class BVTRecorder {
|
|
|
730
731
|
}
|
|
731
732
|
async closeBrowser() {
|
|
732
733
|
delete process.env.TEMP_RUN;
|
|
733
|
-
await this.watcher.close().then(() => {});
|
|
734
|
+
await this.watcher.close().then(() => { });
|
|
734
735
|
this.watcher = null;
|
|
735
736
|
this.previousIndex = null;
|
|
736
737
|
this.previousHistoryLength = null;
|