@dev-blinq/cucumber_client 1.0.1441-dev → 1.0.1441-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 +73 -73
- package/bin/assets/preload/css_gen.js +10 -10
- package/bin/assets/preload/toolbar.js +27 -29
- package/bin/assets/preload/unique_locators.js +1 -1
- package/bin/assets/preload/yaml.js +288 -275
- package/bin/assets/scripts/aria_snapshot.js +223 -220
- package/bin/assets/scripts/dom_attr.js +329 -329
- package/bin/assets/scripts/dom_parent.js +169 -174
- package/bin/assets/scripts/event_utils.js +94 -94
- package/bin/assets/scripts/pw.js +2050 -1949
- package/bin/assets/scripts/recorder.js +70 -45
- package/bin/assets/scripts/snapshot_capturer.js +147 -147
- package/bin/assets/scripts/unique_locators.js +170 -49
- package/bin/assets/scripts/yaml.js +796 -783
- package/bin/assets/templates/_hooks_template.txt +6 -2
- package/bin/assets/templates/utils_template.txt +16 -16
- package/bin/client/code_cleanup/find_step_definition_references.js +0 -1
- package/bin/client/code_cleanup/utils.js +16 -7
- package/bin/client/code_gen/api_codegen.js +2 -2
- package/bin/client/code_gen/code_inversion.js +119 -2
- package/bin/client/code_gen/duplication_analysis.js +2 -1
- package/bin/client/code_gen/function_signature.js +4 -0
- package/bin/client/code_gen/page_reflection.js +52 -11
- package/bin/client/code_gen/playwright_codeget.js +163 -75
- package/bin/client/cucumber/feature.js +4 -17
- package/bin/client/cucumber/feature_data.js +2 -2
- package/bin/client/cucumber/project_to_document.js +8 -2
- package/bin/client/cucumber/steps_definitions.js +19 -3
- package/bin/client/local_agent.js +3 -2
- package/bin/client/parse_feature_file.js +23 -26
- package/bin/client/playground/projects/env.json +2 -2
- package/bin/client/recorderv3/bvt_init.js +305 -0
- package/bin/client/recorderv3/bvt_recorder.js +1024 -58
- package/bin/client/recorderv3/implemented_steps.js +2 -0
- package/bin/client/recorderv3/index.js +3 -283
- package/bin/client/recorderv3/services.js +818 -142
- package/bin/client/recorderv3/step_runner.js +20 -6
- package/bin/client/recorderv3/step_utils.js +542 -73
- package/bin/client/recorderv3/update_feature.js +87 -39
- package/bin/client/recorderv3/wbr_entry.js +61 -0
- package/bin/client/recording.js +1 -0
- package/bin/client/upload-service.js +4 -2
- package/bin/client/utils/app_dir.js +21 -0
- package/bin/client/utils/socket_logger.js +87 -125
- package/bin/index.js +4 -1
- package/package.json +11 -5
- package/bin/client/recorderv3/app_dir.js +0 -23
- package/bin/client/recorderv3/network.js +0 -299
- package/bin/client/recorderv3/scriptTest.js +0 -5
- package/bin/client/recorderv3/ws_server.js +0 -72
|
@@ -4,7 +4,13 @@ import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherki
|
|
|
4
4
|
import { Feature } from "./feature.js";
|
|
5
5
|
import { StepsDefinitions } from "./steps_definitions.js";
|
|
6
6
|
|
|
7
|
-
export const projectDocument = (
|
|
7
|
+
export const projectDocument = (
|
|
8
|
+
folder,
|
|
9
|
+
featureName = null,
|
|
10
|
+
scenarioName = null,
|
|
11
|
+
supressErrors = false,
|
|
12
|
+
errors = []
|
|
13
|
+
) => {
|
|
8
14
|
const uuidFn = () => (23212).toString(16);
|
|
9
15
|
const builder = new AstBuilder(uuidFn);
|
|
10
16
|
const matcher = new GherkinClassicTokenMatcher();
|
|
@@ -59,4 +65,4 @@ export const projectDocument = (folder, featureName = null, scenarioName = null,
|
|
|
59
65
|
// const documents = projectDocument(projectDir, featureName, scenarioName, true, errors);
|
|
60
66
|
// const args = process.argv.slice(2);
|
|
61
67
|
|
|
62
|
-
// console.log(JSON.stringify(documents));
|
|
68
|
+
// console.log(JSON.stringify(documents));
|
|
@@ -36,6 +36,19 @@ class StepsDefinitions {
|
|
|
36
36
|
// }
|
|
37
37
|
// });
|
|
38
38
|
const { expressions, methods } = codePage;
|
|
39
|
+
|
|
40
|
+
if (codePage.fileContent.includes('from "./utils.mjs"')) {
|
|
41
|
+
const filePath = path.join(
|
|
42
|
+
this.baseFolder,
|
|
43
|
+
this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
|
|
44
|
+
"step_definitions",
|
|
45
|
+
"utils.mjs"
|
|
46
|
+
);
|
|
47
|
+
const utilsCodePage = new CodePage(filePath);
|
|
48
|
+
utilsCodePage.generateModel();
|
|
49
|
+
methods.push(...utilsCodePage.methods);
|
|
50
|
+
}
|
|
51
|
+
|
|
39
52
|
for (let i = 0; i < expressions.length; i++) {
|
|
40
53
|
const expression = expressions[i];
|
|
41
54
|
const pattern = expression.pattern;
|
|
@@ -45,7 +58,10 @@ class StepsDefinitions {
|
|
|
45
58
|
if (method && expression.keyword && pattern && expression.methodName) {
|
|
46
59
|
this.steps[pattern] = {
|
|
47
60
|
// file: path.join(this.isTemp ? "__temp_features" : "features", mjsFile),
|
|
48
|
-
file: path.join(
|
|
61
|
+
file: path.join(
|
|
62
|
+
this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
|
|
63
|
+
mjsFile
|
|
64
|
+
),
|
|
49
65
|
functionName: expression.methodName,
|
|
50
66
|
name: pattern,
|
|
51
67
|
source: this.findKey(method.codePart, "source"),
|
|
@@ -56,7 +72,7 @@ class StepsDefinitions {
|
|
|
56
72
|
}
|
|
57
73
|
load(print = true, supressErrors = false, errors = []) {
|
|
58
74
|
const mjsFiles = findFilesWithExtension(
|
|
59
|
-
path.join(this.baseFolder, this.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features"),
|
|
75
|
+
path.join(this.baseFolder, this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features"),
|
|
60
76
|
"mjs"
|
|
61
77
|
);
|
|
62
78
|
// console.log({ mjsFiles });
|
|
@@ -64,7 +80,7 @@ class StepsDefinitions {
|
|
|
64
80
|
const mjsFile = mjsFiles[i];
|
|
65
81
|
const filePath = path.join(
|
|
66
82
|
this.baseFolder,
|
|
67
|
-
this.isTemp ? process.env.tempFeaturesFolderPath ?? "__temp_features" : "features",
|
|
83
|
+
this.isTemp ? (process.env.tempFeaturesFolderPath ?? "__temp_features") : "features",
|
|
68
84
|
mjsFile
|
|
69
85
|
);
|
|
70
86
|
const codePage = new CodePage(filePath);
|
|
@@ -696,6 +696,7 @@ class LocalAgent {
|
|
|
696
696
|
stepDiff: stepResult,
|
|
697
697
|
});
|
|
698
698
|
page.removeUnusedElements();
|
|
699
|
+
page.mergeSimilarElements();
|
|
699
700
|
agent.scenarioReport.updateLastStep({
|
|
700
701
|
code: {
|
|
701
702
|
cleanFileNames: page.cleanFileNames,
|
|
@@ -809,12 +810,12 @@ class LocalAgent {
|
|
|
809
810
|
} catch (err) {
|
|
810
811
|
logger.error("Error reading memory file: " + err.message);
|
|
811
812
|
}
|
|
812
|
-
const screenshot = await agent.getScreenshot(agent.context);
|
|
813
|
+
//const screenshot = await agent.getScreenshot(agent.context);
|
|
813
814
|
// check if the popup is open
|
|
814
815
|
const popupResult = await agent.context.web.closeUnexpectedPopups(null, null);
|
|
815
816
|
if (nodes) {
|
|
816
817
|
nodes.memory = memory;
|
|
817
|
-
nodes.screenshot = screenshot;
|
|
818
|
+
//nodes.screenshot = screenshot;
|
|
818
819
|
if (popupResult.rerun === true) {
|
|
819
820
|
nodes.rerun = true;
|
|
820
821
|
}
|
|
@@ -1,37 +1,34 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let id =0;
|
|
9
|
-
const uuidFn = () => (++id).toString(16)
|
|
10
|
-
const builder = new AstBuilder(uuidFn)
|
|
11
|
-
const matcher = new GherkinClassicTokenMatcher()
|
|
1
|
+
import { AstBuilder, GherkinClassicTokenMatcher, Parser } from "@cucumber/gherkin";
|
|
2
|
+
import { readFileSync, writeFileSync } from "fs";
|
|
3
|
+
import { loadArgs, showUsage, validateCLIArg } from "./cli_helpers.js";
|
|
4
|
+
let id = 0;
|
|
5
|
+
const uuidFn = () => (++id).toString(16);
|
|
6
|
+
const builder = new AstBuilder(uuidFn);
|
|
7
|
+
const matcher = new GherkinClassicTokenMatcher();
|
|
12
8
|
|
|
13
|
-
const parser = new Parser(builder, matcher)
|
|
9
|
+
const parser = new Parser(builder, matcher);
|
|
14
10
|
|
|
15
11
|
const parseFeatureFile = (featureFilePath) => {
|
|
16
|
-
const source = readFileSync(featureFilePath,
|
|
17
|
-
const gherkinDocument = parser.parse(source)
|
|
18
|
-
return gherkinDocument
|
|
19
|
-
}
|
|
12
|
+
const source = readFileSync(featureFilePath, "utf8");
|
|
13
|
+
const gherkinDocument = parser.parse(source);
|
|
14
|
+
return gherkinDocument;
|
|
15
|
+
};
|
|
20
16
|
|
|
21
|
-
const args = loadArgs()
|
|
22
|
-
const featureFilePath = args[0]
|
|
23
|
-
const outputFilePath = args[1]
|
|
24
|
-
const usage =
|
|
17
|
+
const args = loadArgs();
|
|
18
|
+
const featureFilePath = args[0];
|
|
19
|
+
const outputFilePath = args[1];
|
|
20
|
+
const usage =
|
|
21
|
+
"Usage: node parse_feature_file.js <featureFilePath> [<outputFilePath>] \n\nExample: node parseFeatureFile.js ./features/my.feature ./features/my.feature.json\n\n";
|
|
25
22
|
try {
|
|
26
|
-
validateCLIArg(featureFilePath,
|
|
23
|
+
validateCLIArg(featureFilePath, "featureFilePath");
|
|
27
24
|
} catch (error) {
|
|
28
|
-
showUsage(error, usage)
|
|
25
|
+
showUsage(error, usage);
|
|
29
26
|
}
|
|
30
|
-
const gherkinDocument = parseFeatureFile(featureFilePath)
|
|
27
|
+
const gherkinDocument = parseFeatureFile(featureFilePath);
|
|
31
28
|
if (outputFilePath) {
|
|
32
|
-
writeFileSync(outputFilePath, JSON.stringify(gherkinDocument, null, 2))
|
|
29
|
+
writeFileSync(outputFilePath, JSON.stringify(gherkinDocument, null, 2));
|
|
33
30
|
} else {
|
|
34
|
-
console.log(JSON.stringify(gherkinDocument, null, 2))
|
|
31
|
+
console.log(JSON.stringify(gherkinDocument, null, 2));
|
|
35
32
|
}
|
|
36
33
|
|
|
37
|
-
export { parseFeatureFile }
|
|
34
|
+
export { parseFeatureFile };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
}
|
|
2
|
+
"baseUrl": "https://google.com"
|
|
3
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { io } from "socket.io-client";
|
|
2
|
+
import { BVTRecorder } from "./bvt_recorder.js";
|
|
3
|
+
import { compareWithScenario } from "../code_gen/duplication_analysis.js";
|
|
4
|
+
import { getAppDataDir } from "../utils/app_dir.js";
|
|
5
|
+
import { readdir } from "fs/promises";
|
|
6
|
+
import socketLogger, { getErrorMessage } from "../utils/socket_logger.js";
|
|
7
|
+
|
|
8
|
+
let port = process.env.EDITOR_PORT || 3003;
|
|
9
|
+
const WS_URL = process.env.WORKER_WS_SERVER_URL || "http://localhost:" + port;
|
|
10
|
+
|
|
11
|
+
const responseSize = (response) => {
|
|
12
|
+
try {
|
|
13
|
+
if (typeof response !== "string") {
|
|
14
|
+
return new Blob([JSON.stringify(response)]).size;
|
|
15
|
+
} else {
|
|
16
|
+
return new Blob([response]).size;
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
return -1;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
class PromisifiedSocketServer {
|
|
24
|
+
constructor(socket, routes) {
|
|
25
|
+
this.socket = socket;
|
|
26
|
+
this.routes = routes;
|
|
27
|
+
}
|
|
28
|
+
init() {
|
|
29
|
+
this.socket.on("request", async (data) => {
|
|
30
|
+
const { event, input, id, roomId, socketId } = data;
|
|
31
|
+
if (event !== "recorderWindow.getCurrentChromiumPath") {
|
|
32
|
+
socketLogger.info("Received request", { event, input, id, roomId, socketId });
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
const handler = this.routes[event];
|
|
36
|
+
if (!handler) {
|
|
37
|
+
socketLogger.error(`No handler found for event: ${event}`, undefined, event);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const response = await handler(input);
|
|
41
|
+
if (event !== "recorderWindow.getCurrentChromiumPath") {
|
|
42
|
+
socketLogger.info(`Sending response for ${event}, ${responseSize(response)} bytes`);
|
|
43
|
+
}
|
|
44
|
+
this.socket.emit("response", { id, value: response, roomId, socketId });
|
|
45
|
+
} catch (error) {
|
|
46
|
+
socketLogger.error(
|
|
47
|
+
"Error handling request",
|
|
48
|
+
{
|
|
49
|
+
input,
|
|
50
|
+
id,
|
|
51
|
+
roomId,
|
|
52
|
+
socketId,
|
|
53
|
+
error: error instanceof Error ? `${error.message}\n${error.stack}` : error,
|
|
54
|
+
},
|
|
55
|
+
event
|
|
56
|
+
);
|
|
57
|
+
this.socket.emit("response", {
|
|
58
|
+
id,
|
|
59
|
+
error: {
|
|
60
|
+
message: error?.message,
|
|
61
|
+
code: error?.code,
|
|
62
|
+
info: error?.info,
|
|
63
|
+
stack: error?.stack,
|
|
64
|
+
},
|
|
65
|
+
roomId,
|
|
66
|
+
socketId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const timeOutForFunction = async (promise, timeout = 5000) => {
|
|
74
|
+
const timeoutPromise = new Promise((resolve) => setTimeout(() => resolve(), timeout));
|
|
75
|
+
|
|
76
|
+
try {
|
|
77
|
+
const res = await Promise.race([promise, timeoutPromise]);
|
|
78
|
+
return res;
|
|
79
|
+
} catch (error) {
|
|
80
|
+
socketLogger.error(error, undefined, "timeOutForFunction");
|
|
81
|
+
throw error;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const CLIENT_IDENTIFIER = "cucumber_client/bvt_recorder";
|
|
86
|
+
|
|
87
|
+
async function BVTRecorderInit({ envName, projectDir, roomId, TOKEN, socket = null }) {
|
|
88
|
+
console.log(`Connecting to ${WS_URL}`);
|
|
89
|
+
socket = socket || io(WS_URL);
|
|
90
|
+
socketLogger.init(socket, { context: "BVTRecorder", eventName: "BVTRecorder.log" });
|
|
91
|
+
socket.on("connect", () => {
|
|
92
|
+
socketLogger.info(`${roomId} Connected to BVTRecorder server`);
|
|
93
|
+
});
|
|
94
|
+
socket.on("disconnect", (reason) => {
|
|
95
|
+
socketLogger.info(`${roomId} Disconnected from server: ${reason}`);
|
|
96
|
+
});
|
|
97
|
+
socket.emit("joinRoom", { id: roomId, window: CLIENT_IDENTIFIER });
|
|
98
|
+
const recorder = new BVTRecorder({
|
|
99
|
+
envName,
|
|
100
|
+
projectDir,
|
|
101
|
+
TOKEN,
|
|
102
|
+
sendEvent: (event, data) => {
|
|
103
|
+
socketLogger.info("Sending event", { event, data, roomId });
|
|
104
|
+
socket.emit(event, data, roomId);
|
|
105
|
+
},
|
|
106
|
+
logger: socketLogger,
|
|
107
|
+
});
|
|
108
|
+
// emit connected event for every 50 ms until connection_ack message is recieved
|
|
109
|
+
let connected = false;
|
|
110
|
+
const interval = setInterval(() => {
|
|
111
|
+
if (connected) {
|
|
112
|
+
clearInterval(interval);
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
socket.emit("BVTRecorder.connected", { roomId, window: "cucumber_client/bvt_recorder" }, roomId);
|
|
116
|
+
}, 50);
|
|
117
|
+
|
|
118
|
+
const promisifiedSocketServer = new PromisifiedSocketServer(socket, {
|
|
119
|
+
"recorderWindow.connectionAck": async (input) => {
|
|
120
|
+
connected = true;
|
|
121
|
+
clearInterval(interval);
|
|
122
|
+
},
|
|
123
|
+
"recorderWindow.openBrowser": async (input) => {
|
|
124
|
+
return recorder
|
|
125
|
+
.openBrowser(input)
|
|
126
|
+
.then(() => {
|
|
127
|
+
socketLogger.info("BVTRecorder.browserOpened");
|
|
128
|
+
socket.emit("BVTRecorder.browserOpened", { roomId, window: "cucumber_client/bvt_recorder" });
|
|
129
|
+
})
|
|
130
|
+
.catch((e) => {
|
|
131
|
+
socketLogger.error(`Error opening browser: ${getErrorMessage(e)}`, undefined, "recorderWindow.openBrowser");
|
|
132
|
+
socket.emit("BVTRecorder.browserLaunchFailed", { roomId, window: "cucumber_client/bvt_recorder" });
|
|
133
|
+
});
|
|
134
|
+
},
|
|
135
|
+
"recorderWindow.closeBrowser": async (input) => {
|
|
136
|
+
return recorder.closeBrowser(input);
|
|
137
|
+
},
|
|
138
|
+
"recorderWindow.reOpenBrowser": async (input) => {
|
|
139
|
+
return recorder
|
|
140
|
+
.reOpenBrowser(input)
|
|
141
|
+
.then(() => {
|
|
142
|
+
socketLogger.info("BVTRecorder.browserOpened");
|
|
143
|
+
socket.emit("BVTRecorder.browserOpened", null, roomId);
|
|
144
|
+
})
|
|
145
|
+
.catch((e) => {
|
|
146
|
+
socketLogger.error(
|
|
147
|
+
`Error reopening browser: ${getErrorMessage(e)}`,
|
|
148
|
+
undefined,
|
|
149
|
+
"recorderWindow.reOpenBrowser"
|
|
150
|
+
);
|
|
151
|
+
socket.emit("BVTRecorder.browserLaunchFailed", null, roomId);
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
"recorderWindow.startRecordingInput": async (input) => {
|
|
155
|
+
return timeOutForFunction(recorder.startRecordingInput(input));
|
|
156
|
+
},
|
|
157
|
+
"recorderWindow.stopRecordingInput": async (input) => {
|
|
158
|
+
return timeOutForFunction(recorder.stopRecordingInput(input));
|
|
159
|
+
},
|
|
160
|
+
"recorderWindow.startRecordingText": async (input) => {
|
|
161
|
+
// console.log("--- {{ }} -- : recorderWindow.startRecordingText", input);
|
|
162
|
+
return timeOutForFunction(recorder.startRecordingText(input));
|
|
163
|
+
},
|
|
164
|
+
"recorderWindow.stopRecordingText": async (input) => {
|
|
165
|
+
return timeOutForFunction(recorder.stopRecordingText(input));
|
|
166
|
+
},
|
|
167
|
+
"recorderWindow.startRecordingContext": async (input) => {
|
|
168
|
+
return timeOutForFunction(recorder.startRecordingContext(input));
|
|
169
|
+
},
|
|
170
|
+
"recorderWindow.stopRecordingContext": async (input) => {
|
|
171
|
+
return timeOutForFunction(recorder.stopRecordingContext(input));
|
|
172
|
+
},
|
|
173
|
+
"recorderWindow.runStep": async (input) => {
|
|
174
|
+
return recorder.runStep(input);
|
|
175
|
+
},
|
|
176
|
+
"recorderWindow.saveScenario": async (input) => {
|
|
177
|
+
return recorder.saveScenario(input);
|
|
178
|
+
},
|
|
179
|
+
"recorderWindow.getImplementedSteps": async (input) => {
|
|
180
|
+
return (await recorder.getImplementedSteps(input)).implementedSteps;
|
|
181
|
+
},
|
|
182
|
+
"recorderWindow.getImplementedScenarios": async (input) => {
|
|
183
|
+
return (await recorder.getImplementedSteps(input)).scenarios;
|
|
184
|
+
},
|
|
185
|
+
"recorderWindow.getCurrentChromiumPath": async () => {
|
|
186
|
+
return await recorder.getCurrentChromiumPath();
|
|
187
|
+
},
|
|
188
|
+
"recorderWindow.overwriteTestData": async (input) => {
|
|
189
|
+
return await recorder.overwriteTestData(input);
|
|
190
|
+
},
|
|
191
|
+
"recorderWindow.generateStepName": async (input) => {
|
|
192
|
+
return recorder.generateStepName(input);
|
|
193
|
+
},
|
|
194
|
+
"recorderWindow.getFeatureAndScenario": async (input) => {
|
|
195
|
+
return recorder.generateScenarioAndFeatureNames(input);
|
|
196
|
+
},
|
|
197
|
+
"recorderWindow.generateCommandName": async (input) => {
|
|
198
|
+
return recorder.generateCommandName(input);
|
|
199
|
+
},
|
|
200
|
+
"recorderWindow.loadTestData": async (input) => {
|
|
201
|
+
return recorder.loadTestData(input);
|
|
202
|
+
},
|
|
203
|
+
"recorderWindow.discard": async (input) => {
|
|
204
|
+
return await recorder.discardTestData(input);
|
|
205
|
+
},
|
|
206
|
+
"recorderWindow.addToTestData": async (input) => {
|
|
207
|
+
return await recorder.addToTestData(input);
|
|
208
|
+
},
|
|
209
|
+
"recorderWindow.getScenarios": async () => {
|
|
210
|
+
return recorder.getScenarios();
|
|
211
|
+
},
|
|
212
|
+
"recorderWindow.setShouldTakeScreenshot": async (input) => {
|
|
213
|
+
return recorder.setShouldTakeScreenshot(input);
|
|
214
|
+
},
|
|
215
|
+
"recorderWindow.compareWithScenario": async ({ projectDir, scenario }, roomId) => {
|
|
216
|
+
return await compareWithScenario(getAppDataDir(projectDir), scenario);
|
|
217
|
+
},
|
|
218
|
+
"recorderWindow.getCommandsForImplementedStep": async (input) => {
|
|
219
|
+
return recorder.getCommandsForImplementedStep(input);
|
|
220
|
+
},
|
|
221
|
+
"recorderWindow.getNumberOfOccurrences": async (input) => {
|
|
222
|
+
return recorder.getNumberOfOccurrences(input);
|
|
223
|
+
},
|
|
224
|
+
"recorderWindow.getFakeParams": async ({ parametersMap }) => {
|
|
225
|
+
return recorder.fakeParams(parametersMap);
|
|
226
|
+
},
|
|
227
|
+
"recorderWindow.abortExecution": async (input) => {
|
|
228
|
+
return recorder.abortExecution(input);
|
|
229
|
+
},
|
|
230
|
+
"recorderWindow.pauseExecution": async (input) => {
|
|
231
|
+
return recorder.pauseExecution(input);
|
|
232
|
+
},
|
|
233
|
+
"recorderWindow.resumeExecution": async (input) => {
|
|
234
|
+
return recorder.resumeExecution(input);
|
|
235
|
+
},
|
|
236
|
+
"recorderWindow.loadExistingScenario": async (input) => {
|
|
237
|
+
return recorder.loadExistingScenario(input);
|
|
238
|
+
},
|
|
239
|
+
"recorderWindow.findRelatedTextInAllFrames": async (input) => {
|
|
240
|
+
return recorder.findRelatedTextInAllFrames(input);
|
|
241
|
+
},
|
|
242
|
+
"recorderWindow.getReportFolder": async (input) => {
|
|
243
|
+
return recorder.getReportFolder();
|
|
244
|
+
},
|
|
245
|
+
"recorderWindow.getSnapshotFiles": async (input) => {
|
|
246
|
+
const snapshotFolder = recorder.getSnapshotFolder();
|
|
247
|
+
if (snapshotFolder) {
|
|
248
|
+
const files = await readdir(snapshotFolder);
|
|
249
|
+
const ymlFiles = files.filter((file) => file.endsWith(".yml") || file.endsWith(".yaml"));
|
|
250
|
+
return { folder: snapshotFolder, files: ymlFiles };
|
|
251
|
+
} else return { folder: null, files: [] };
|
|
252
|
+
},
|
|
253
|
+
"recorderWindow.getCurrentPageTitle": async (input) => {
|
|
254
|
+
return await recorder.getCurrentPageTitle();
|
|
255
|
+
},
|
|
256
|
+
"recorderWindow.getCurrentPageUrl": async (input) => {
|
|
257
|
+
return await recorder.getCurrentPageUrl();
|
|
258
|
+
},
|
|
259
|
+
"recorderWindow.sendAriaSnapshot": async (input) => {
|
|
260
|
+
const snapshot = input?.snapshot;
|
|
261
|
+
const deselect = input?.deselect;
|
|
262
|
+
if (deselect === true) {
|
|
263
|
+
return await recorder.deselectAriaElements();
|
|
264
|
+
}
|
|
265
|
+
if (snapshot !== null) {
|
|
266
|
+
return await recorder.processAriaSnapshot(snapshot);
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
"recorderWindow.revertMode": async () => {
|
|
270
|
+
await recorder.revertMode();
|
|
271
|
+
},
|
|
272
|
+
"recorderWindow.setMode": async (input) => {
|
|
273
|
+
const mode = input?.mode;
|
|
274
|
+
return recorder.setMode(mode);
|
|
275
|
+
},
|
|
276
|
+
"recorderWindow.getStepsAndCommandsForScenario": async (input) => {
|
|
277
|
+
return await recorder.getStepsAndCommandsForScenario(input);
|
|
278
|
+
},
|
|
279
|
+
"recorderWindow.getNetworkEvents": async (input) => {
|
|
280
|
+
return await recorder.getNetworkEvents(input);
|
|
281
|
+
},
|
|
282
|
+
"recorderWindow.initExecution": async (input) => {
|
|
283
|
+
return await recorder.initExecution(input);
|
|
284
|
+
},
|
|
285
|
+
"recorderWindow.cleanupExecution": async (input) => {
|
|
286
|
+
return await recorder.cleanupExecution(input);
|
|
287
|
+
},
|
|
288
|
+
"recorderWindow.resetExecution": async (input) => {
|
|
289
|
+
return await recorder.resetExecution(input);
|
|
290
|
+
},
|
|
291
|
+
"recorderWindow.stopRecordingNetwork": async (input) => {
|
|
292
|
+
return recorder.stopRecordingNetwork(input);
|
|
293
|
+
},
|
|
294
|
+
"recorderWindow.cleanup": async (input) => {
|
|
295
|
+
return recorder.cleanup(input);
|
|
296
|
+
},
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
socket.on("targetBrowser.command.event", async (input) => {
|
|
300
|
+
return recorder.onAction(input);
|
|
301
|
+
});
|
|
302
|
+
promisifiedSocketServer.init();
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export { BVTRecorderInit };
|