@dev-blinq/cucumber_client 1.0.1712-dev → 1.0.1713-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.
|
@@ -168,7 +168,7 @@ async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN, socket = nu
|
|
|
168
168
|
return (await recorder.getImplementedSteps(input)).scenarios;
|
|
169
169
|
},
|
|
170
170
|
"recorderWindow.getCurrentChromiumPath": async () => {
|
|
171
|
-
return
|
|
171
|
+
return recorder.getCurrentChromiumPath();
|
|
172
172
|
},
|
|
173
173
|
"recorderWindow.overwriteTestData": async (input) => {
|
|
174
174
|
return await recorder.overwriteTestData(input);
|
|
@@ -241,7 +241,7 @@ async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN, socket = nu
|
|
|
241
241
|
return await recorder.getCurrentPageTitle();
|
|
242
242
|
},
|
|
243
243
|
"recorderWindow.getCurrentPageUrl": async () => {
|
|
244
|
-
return
|
|
244
|
+
return recorder.getCurrentPageUrl();
|
|
245
245
|
},
|
|
246
246
|
"recorderWindow.sendAriaSnapshot": async (input) => {
|
|
247
247
|
const snapshot = input?.snapshot;
|
|
@@ -196,7 +196,13 @@ export class BVTRecorder {
|
|
|
196
196
|
workspaceService;
|
|
197
197
|
pageSet = new Set();
|
|
198
198
|
lastKnownUrlPath = "";
|
|
199
|
-
world = {
|
|
199
|
+
world = {
|
|
200
|
+
attach: async () => { },
|
|
201
|
+
parameters: {},
|
|
202
|
+
log: (message) => {
|
|
203
|
+
socketLogger.log.call(socketLogger, "info", message, undefined, "Cucumber.JS World");
|
|
204
|
+
},
|
|
205
|
+
};
|
|
200
206
|
shouldTakeScreenshot = true;
|
|
201
207
|
watcher = null;
|
|
202
208
|
networkEventsFolder;
|
|
@@ -348,7 +354,6 @@ export class BVTRecorder {
|
|
|
348
354
|
this.#remoteDebuggerPort = Number(process.env.CDP_LISTEN_PORT);
|
|
349
355
|
}
|
|
350
356
|
// this.stepRunner.setRemoteDebugPort(this.#remoteDebuggerPort);
|
|
351
|
-
this.world = { attach: () => { } };
|
|
352
357
|
const ai_config_file = path.join(this.projectDir, "ai_config.json");
|
|
353
358
|
let ai_config = {};
|
|
354
359
|
if (existsSync(ai_config_file)) {
|
|
@@ -367,7 +372,8 @@ export class BVTRecorder {
|
|
|
367
372
|
`\ndelete Object.getPrototypeOf(navigator).webdriver;${process.env.WINDOW_DEBUGGER ? "window.debug=true;\n" : ""}`,
|
|
368
373
|
],
|
|
369
374
|
};
|
|
370
|
-
const
|
|
375
|
+
const scenario = { pickle: this.scenarioDoc };
|
|
376
|
+
const bvtContext = await initContext(url, false, false, this.world, 450, initScripts, this.envName, scenario);
|
|
371
377
|
this.bvtContext = bvtContext;
|
|
372
378
|
this.stepRunner = new BVTStepRunner({
|
|
373
379
|
projectDir: this.projectDir,
|
|
@@ -421,7 +427,7 @@ export class BVTRecorder {
|
|
|
421
427
|
}
|
|
422
428
|
async onClosePopup() {
|
|
423
429
|
// console.log("close popups");
|
|
424
|
-
await this.bvtContext.web
|
|
430
|
+
await this.bvtContext.web?.closeUnexpectedPopups(null, null);
|
|
425
431
|
}
|
|
426
432
|
async evaluateInAllFrames(context, script) {
|
|
427
433
|
// retry 3 times
|
|
@@ -650,17 +656,17 @@ export class BVTRecorder {
|
|
|
650
656
|
async getCurrentPageTitle() {
|
|
651
657
|
let title = "";
|
|
652
658
|
try {
|
|
653
|
-
title = await this.bvtContext
|
|
659
|
+
title = await this.bvtContext?.page?.title();
|
|
654
660
|
}
|
|
655
661
|
catch (e) {
|
|
656
662
|
this.logger.error(`Error getting page title: ${getErrorMessage(e)}`);
|
|
657
663
|
}
|
|
658
664
|
return title;
|
|
659
665
|
}
|
|
660
|
-
|
|
666
|
+
getCurrentPageUrl() {
|
|
661
667
|
let url = "";
|
|
662
668
|
try {
|
|
663
|
-
url =
|
|
669
|
+
url = this.bvtContext?.page?.url();
|
|
664
670
|
}
|
|
665
671
|
catch (e) {
|
|
666
672
|
this.logger.error(`Error getting page url: ${getErrorMessage(e)}`);
|
|
@@ -840,8 +846,8 @@ export class BVTRecorder {
|
|
|
840
846
|
}
|
|
841
847
|
_updateUrlPath() {
|
|
842
848
|
try {
|
|
843
|
-
const url = this.bvtContext
|
|
844
|
-
if (url !== "about:blank") {
|
|
849
|
+
const url = this.bvtContext?.web?.page.url();
|
|
850
|
+
if (url && url !== "about:blank") {
|
|
845
851
|
this.lastKnownUrlPath = new URL(url).pathname;
|
|
846
852
|
}
|
|
847
853
|
}
|
|
@@ -947,7 +953,7 @@ export class BVTRecorder {
|
|
|
947
953
|
const envVars = {
|
|
948
954
|
TOKEN: this.TOKEN,
|
|
949
955
|
TEMP_RUN: "true",
|
|
950
|
-
REPORT_FOLDER: this.bvtContext
|
|
956
|
+
REPORT_FOLDER: this.bvtContext?.reportFolder,
|
|
951
957
|
BLINQ_ENV: this.envName,
|
|
952
958
|
DEBUG: "blinq:route",
|
|
953
959
|
};
|
|
@@ -1035,12 +1041,6 @@ export class BVTRecorder {
|
|
|
1035
1041
|
}
|
|
1036
1042
|
}
|
|
1037
1043
|
return steps;
|
|
1038
|
-
// return getStepsAndCommandsForScenario({
|
|
1039
|
-
// name,
|
|
1040
|
-
// featureName,
|
|
1041
|
-
// projectDir: this.projectDir,
|
|
1042
|
-
// map: this.scenariosStepsMap,
|
|
1043
|
-
// });
|
|
1044
1044
|
}
|
|
1045
1045
|
async generateStepName({ commands, stepsNames, parameters, map, }) {
|
|
1046
1046
|
return await this.namesService.generateStepName({ commands, stepsNames, parameters, map });
|
|
@@ -1051,11 +1051,15 @@ export class BVTRecorder {
|
|
|
1051
1051
|
async generateCommandName({ command }) {
|
|
1052
1052
|
return await this.namesService.generateCommandName({ command });
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1055
|
-
const currentURL = await this.bvtContext.web.page.url();
|
|
1054
|
+
getCurrentChromiumPath() {
|
|
1056
1055
|
const env = JSON.parse(readFileSync(this.envName, "utf8"));
|
|
1057
1056
|
const baseURL = env.baseUrl;
|
|
1058
|
-
|
|
1057
|
+
let currentURL = null;
|
|
1058
|
+
currentURL = this.bvtContext?.web?.page?.url();
|
|
1059
|
+
let relativeURL = undefined;
|
|
1060
|
+
if (typeof currentURL == "string") {
|
|
1061
|
+
relativeURL = currentURL.startsWith(baseURL) ? currentURL.replace(baseURL, "/") : undefined;
|
|
1062
|
+
}
|
|
1059
1063
|
return {
|
|
1060
1064
|
relativeURL,
|
|
1061
1065
|
baseURL,
|
|
@@ -1580,9 +1584,20 @@ export class BVTRecorder {
|
|
|
1580
1584
|
return;
|
|
1581
1585
|
}
|
|
1582
1586
|
try {
|
|
1583
|
-
|
|
1587
|
+
const value = params[key].substring(2, params[key].length - 2).trim();
|
|
1588
|
+
const faking = value.split("(")[0].split(".");
|
|
1589
|
+
let argument = value.substring(value.indexOf("(") + 1, value.lastIndexOf(")"));
|
|
1590
|
+
argument = isNaN(Number(argument)) || argument === "" ? argument : Number(argument);
|
|
1591
|
+
let fakeFunc = faker;
|
|
1592
|
+
faking.forEach((f) => {
|
|
1593
|
+
//@ts-expect-error Trying to support both old and new faker versions
|
|
1594
|
+
fakeFunc = fakeFunc[f];
|
|
1595
|
+
});
|
|
1596
|
+
//@ts-expect-error Trying to support both old and new faker versions
|
|
1597
|
+
const newValue = fakeFunc(argument);
|
|
1598
|
+
newFakeParams[key] = newValue;
|
|
1584
1599
|
}
|
|
1585
|
-
catch {
|
|
1600
|
+
catch (error) {
|
|
1586
1601
|
newFakeParams[key] = rawValue;
|
|
1587
1602
|
}
|
|
1588
1603
|
});
|