@dev-blinq/cucumber_client 1.0.1221-dev → 1.0.1223-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.
|
@@ -459,7 +459,7 @@ class BVTRecorder {
|
|
|
459
459
|
getAction: (e) => {
|
|
460
460
|
consumeEvent(e);
|
|
461
461
|
},
|
|
462
|
-
getInterestedElement: () => {},
|
|
462
|
+
getInterestedElement: () => { },
|
|
463
463
|
hoverOutlineStyle: "",
|
|
464
464
|
});
|
|
465
465
|
|
|
@@ -474,7 +474,7 @@ class BVTRecorder {
|
|
|
474
474
|
};
|
|
475
475
|
},
|
|
476
476
|
getAction: () => null,
|
|
477
|
-
getInterestedElement: () => {},
|
|
477
|
+
getInterestedElement: () => { },
|
|
478
478
|
hoverOutlineStyle: "",
|
|
479
479
|
});
|
|
480
480
|
|
|
@@ -489,7 +489,7 @@ class BVTRecorder {
|
|
|
489
489
|
};
|
|
490
490
|
},
|
|
491
491
|
getAction: () => null,
|
|
492
|
-
getInterestedElement: () => {},
|
|
492
|
+
getInterestedElement: () => { },
|
|
493
493
|
hoverOutlineStyle: "",
|
|
494
494
|
});
|
|
495
495
|
|
|
@@ -928,6 +928,8 @@ class BVTRecorder {
|
|
|
928
928
|
// }
|
|
929
929
|
|
|
930
930
|
lastInputId = el.dataset.inputId;
|
|
931
|
+
|
|
932
|
+
el.__locators = this.getLocatorsObject(el);
|
|
931
933
|
}
|
|
932
934
|
const role = window.getAriaRole(el);
|
|
933
935
|
const label = window.getElementAccessibleName(el, false) || window.getElementAccessibleName(el, true) || role || "";
|
|
@@ -1218,7 +1220,8 @@ class BVTRecorder {
|
|
|
1218
1220
|
action: action.details,
|
|
1219
1221
|
element: this.getElementDetails(actionElement, eventName),
|
|
1220
1222
|
isPopupCloseClick: this.isPopupCloseEvent(e),
|
|
1221
|
-
...this.getLocatorsObject(actionElement),
|
|
1223
|
+
// ...this.getLocatorsObject(actionElement),
|
|
1224
|
+
...(actionElement.__locators ?? this.getLocatorsObject(actionElement)),
|
|
1222
1225
|
frame: this.getFrameDetails(),
|
|
1223
1226
|
statistics: {
|
|
1224
1227
|
time: `${performance.measure("command-received", "command-send").duration.toFixed(2)} ms`,
|
|
@@ -29,6 +29,8 @@ const getMatchingElements = (selector, options = {}) => {
|
|
|
29
29
|
return window.__injectedScript.querySelectorAll(window.__injectedScript.parseSelector(selector), root);
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
+
window.getMatchingElements = getMatchingElements;
|
|
33
|
+
|
|
32
34
|
const getPWSelectors = (element, options = {}) => {
|
|
33
35
|
const selectors = [];
|
|
34
36
|
const exludeText = options?.excludeText || false;
|
|
@@ -147,7 +149,25 @@ const getElementLocators = (element, options) => {
|
|
|
147
149
|
.map((item) => {
|
|
148
150
|
return item;
|
|
149
151
|
});
|
|
150
|
-
|
|
152
|
+
if (result.nonUnique.length === 0) {
|
|
153
|
+
// find slector with min score
|
|
154
|
+
let minScore = Infinity;
|
|
155
|
+
let minSelector = null;
|
|
156
|
+
for (const locator of pw_locators) {
|
|
157
|
+
if (locator.score < minScore) {
|
|
158
|
+
minScore = locator.score;
|
|
159
|
+
minSelector = locator.selector;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
if (minSelector) {
|
|
163
|
+
result.nonUnique.push({
|
|
164
|
+
css: minSelector,
|
|
165
|
+
priority: 2,
|
|
166
|
+
elements: getMatchingElements(minSelector, options),
|
|
167
|
+
score: minScore,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
}
|
|
151
171
|
return result;
|
|
152
172
|
};
|
|
153
173
|
|
|
@@ -384,7 +384,6 @@ const invertStableCommand = (call, elements, stepParams) => {
|
|
|
384
384
|
}
|
|
385
385
|
break;
|
|
386
386
|
}
|
|
387
|
-
|
|
388
387
|
case "snapshotValidation": {
|
|
389
388
|
step.type = Types.VERIFY_PAGE_SNAPSHOT;
|
|
390
389
|
const inputParam = parseDataSource(call.arguments[1], stepParams);
|
|
@@ -394,6 +393,30 @@ const invertStableCommand = (call, elements, stepParams) => {
|
|
|
394
393
|
step.selectors = call.arguments[0].value;
|
|
395
394
|
break;
|
|
396
395
|
}
|
|
396
|
+
case "verifyPageTitle": {
|
|
397
|
+
step.type = Types.VERIFY_PAGE_TITLE;
|
|
398
|
+
const text = parseDataSource(call.arguments[0], stepParams);
|
|
399
|
+
if (text.type === "literal") {
|
|
400
|
+
step.parameters = [text.value];
|
|
401
|
+
} else {
|
|
402
|
+
step.dataSource = text.dataSource;
|
|
403
|
+
step.dataKey = text.dataKey;
|
|
404
|
+
step.parameters = [toVariableName(text.dataKey)];
|
|
405
|
+
}
|
|
406
|
+
break;
|
|
407
|
+
}
|
|
408
|
+
case "verifyPagePath": {
|
|
409
|
+
step.type = Types.VERIFY_PAGE_PATH;
|
|
410
|
+
const path = parseDataSource(call.arguments[0], stepParams);
|
|
411
|
+
if (path.type === "literal") {
|
|
412
|
+
step.parameters = [path.value];
|
|
413
|
+
} else {
|
|
414
|
+
step.dataSource = path.dataSource;
|
|
415
|
+
step.dataKey = path.dataKey;
|
|
416
|
+
step.parameters = [toVariableName(path.dataKey)];
|
|
417
|
+
}
|
|
418
|
+
break;
|
|
419
|
+
}
|
|
397
420
|
default:
|
|
398
421
|
return; // Skip if no matching method
|
|
399
422
|
}
|
|
@@ -198,6 +198,7 @@ export class BVTRecorder {
|
|
|
198
198
|
this.logger = logger;
|
|
199
199
|
this.screenshotMap = new Map();
|
|
200
200
|
this.snapshotMap = new Map();
|
|
201
|
+
this.scenariosStepsMap = new Map();
|
|
201
202
|
this.namesService = new NamesService({
|
|
202
203
|
screenshotMap: this.screenshotMap,
|
|
203
204
|
TOKEN: this.TOKEN,
|
|
@@ -751,10 +752,26 @@ export class BVTRecorder {
|
|
|
751
752
|
await this.cleanup();
|
|
752
753
|
}
|
|
753
754
|
async getImplementedSteps() {
|
|
754
|
-
|
|
755
|
+
const stepsAndScenarios = await getImplementedSteps(this.projectDir);
|
|
756
|
+
const implementedSteps = stepsAndScenarios.implementedSteps;
|
|
757
|
+
const scenarios = stepsAndScenarios.scenarios;
|
|
758
|
+
for (const scenario of scenarios) {
|
|
759
|
+
this.scenariosStepsMap.set(scenario.name, scenario.steps);
|
|
760
|
+
delete scenario.steps;
|
|
761
|
+
}
|
|
762
|
+
return {
|
|
763
|
+
implementedSteps,
|
|
764
|
+
scenarios,
|
|
765
|
+
};
|
|
755
766
|
}
|
|
756
767
|
async getStepsAndCommandsForScenario({ name, featureName }) {
|
|
757
|
-
return
|
|
768
|
+
return this.scenariosStepsMap.get(name) || [];
|
|
769
|
+
// return getStepsAndCommandsForScenario({
|
|
770
|
+
// name,
|
|
771
|
+
// featureName,
|
|
772
|
+
// projectDir: this.projectDir,
|
|
773
|
+
// map: this.scenariosStepsMap,
|
|
774
|
+
// });
|
|
758
775
|
}
|
|
759
776
|
async generateStepName({ commands, stepsNames, parameters, map }) {
|
|
760
777
|
return await this.namesService.generateStepName({ commands, stepsNames, parameters, map });
|
|
@@ -233,7 +233,6 @@ export const getImplementedSteps = async (projectDir) => {
|
|
|
233
233
|
delete scenario.featureText;
|
|
234
234
|
delete scenario.scenarioDocument;
|
|
235
235
|
delete scenario.examples;
|
|
236
|
-
delete scenario.steps;
|
|
237
236
|
for (const tag of scenario.tags) {
|
|
238
237
|
delete tag.location;
|
|
239
238
|
}
|
|
@@ -253,7 +252,7 @@ export const getImplementedSteps = async (projectDir) => {
|
|
|
253
252
|
return { implementedSteps, scenarios };
|
|
254
253
|
};
|
|
255
254
|
|
|
256
|
-
export const getStepsAndCommandsForScenario = ({ name, featureName, projectDir }) => {
|
|
255
|
+
export const getStepsAndCommandsForScenario = ({ name, featureName, projectDir, map }) => {
|
|
257
256
|
const stepsDefinitions = new StepsDefinitions(projectDir);
|
|
258
257
|
const step_definitions = loadStepDefinitions(projectDir);
|
|
259
258
|
stepsDefinitions.load();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-blinq/cucumber_client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1223-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.172-dev",
|
|
30
30
|
"@faker-js/faker": "^8.1.0",
|
|
31
|
-
"automation_model": "1.0.
|
|
31
|
+
"automation_model": "1.0.735-dev",
|
|
32
32
|
"axios": "^1.7.4",
|
|
33
33
|
"chokidar": "^3.6.0",
|
|
34
34
|
"create-require": "^1.1.1",
|