@dev-blinq/cucumber_client 1.0.1253-dev → 1.0.1255-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.
- package/bin/assets/bundled_scripts/recorder.js +14132 -0
- package/bin/assets/scripts/aria_snapshot.js +235 -0
- package/bin/assets/scripts/dom_attr.js +372 -0
- package/bin/assets/scripts/dom_element.js +0 -0
- package/bin/assets/scripts/dom_parent.js +159 -0
- package/bin/assets/scripts/event_utils.js +105 -0
- package/bin/assets/scripts/pw.js +7886 -0
- package/bin/assets/scripts/recorder.js +1146 -0
- package/bin/assets/scripts/snapshot_capturer.js +155 -0
- package/bin/assets/scripts/unique_locators.js +552 -0
- package/bin/assets/scripts/yaml.js +4770 -0
- package/bin/client/recorderv3/bvt_recorder.js +23 -53
- package/package.json +8 -3
|
@@ -3,7 +3,6 @@ import { closeContext, initContext, _getDataFile, resetTestData } from "automati
|
|
|
3
3
|
import { existsSync, readdirSync, readFileSync, rmSync } from "fs";
|
|
4
4
|
import path from "path";
|
|
5
5
|
import url from "url";
|
|
6
|
-
import pkg from "../../min/injectedScript.min.cjs";
|
|
7
6
|
import { getImplementedSteps, getStepsAndCommandsForScenario } from "./implemented_steps.js";
|
|
8
7
|
import { NamesService } from "./services.js";
|
|
9
8
|
import { BVTStepRunner } from "./step_runner.js";
|
|
@@ -16,41 +15,19 @@ import chokidar from "chokidar";
|
|
|
16
15
|
import logger from "../../logger.js";
|
|
17
16
|
import { unEscapeNonPrintables } from "../cucumber/utils.js";
|
|
18
17
|
import { findAvailablePort } from "../utils/index.js";
|
|
19
|
-
import { getAiConfig } from "../code_gen/page_reflection.js";
|
|
20
|
-
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
21
|
-
const { source: injectedScriptSource } = pkg;
|
|
22
|
-
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
23
|
-
export function getInitScript(config) {
|
|
24
|
-
const popupHandlers = config?.popupHandlers ?? [];
|
|
25
18
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
const disableMultipleLocators = config?.disableMultipleLocators ?? false;
|
|
19
|
+
const __dirname = path.dirname(url.fileURLToPath(import.meta.url));
|
|
29
20
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
window.
|
|
21
|
+
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
22
|
+
export function getInitScript(config, options) {
|
|
23
|
+
const preScript = `
|
|
24
|
+
window.__bvt_Recorder_config = ${JSON.stringify(config ?? null)};
|
|
25
|
+
window.__PW_options = ${JSON.stringify(options ?? null)};
|
|
26
|
+
`;
|
|
27
|
+
const recorderScript = readFileSync(path.join(__dirname, "..", "..", "assets", "bundled_scripts", "recorder.js"), "utf8")
|
|
34
28
|
return (
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
path.join(__dirname, "..", "..", "assets", "preload", "dom-utils.js"),
|
|
38
|
-
path.join(__dirname, "..", "..", "assets", "preload", "generateSelector.js"),
|
|
39
|
-
path.join(__dirname, "..", "..", "assets", "preload", "locators.js"),
|
|
40
|
-
path.join(__dirname, "..", "..", "assets", "preload", "unique_locators.js"),
|
|
41
|
-
// path.join(__dirname, "..", "..", "assets", "preload", "pw_locators.js"),
|
|
42
|
-
path.join(__dirname, "..", "..", "assets", "preload", "climb.js"),
|
|
43
|
-
path.join(__dirname, "..", "..", "assets", "preload", "text-locator.js"),
|
|
44
|
-
path.join(__dirname, "..", "..", "assets", "preload", "toolbar.js"),
|
|
45
|
-
path.join(__dirname, "..", "..", "assets", "preload", "recording-tool.js"),
|
|
46
|
-
path.join(__dirname, "..", "..", "assets", "preload", "find_context.js"),
|
|
47
|
-
path.join(__dirname, "..", "..", "assets", "preload", "recorderv3.js"),
|
|
48
|
-
path.join(__dirname, "..", "..", "assets", "preload", "findElementText.js"),
|
|
49
|
-
path.join(__dirname, "..", "..", "assets", "preload", "css_gen.js"),
|
|
50
|
-
path.join(__dirname, "..", "..", "assets", "preload", "yaml.js"),
|
|
51
|
-
]
|
|
52
|
-
.map((filePath) => readFileSync(filePath, "utf8"))
|
|
53
|
-
.join("\n") + popupScript
|
|
29
|
+
preScript +
|
|
30
|
+
recorderScript
|
|
54
31
|
);
|
|
55
32
|
}
|
|
56
33
|
|
|
@@ -213,7 +190,7 @@ export class BVTRecorder {
|
|
|
213
190
|
|
|
214
191
|
this.lastKnownUrlPath = "";
|
|
215
192
|
// TODO: what is world?
|
|
216
|
-
this.world = { attach: () => {} };
|
|
193
|
+
this.world = { attach: () => { } };
|
|
217
194
|
this.shouldTakeScreenshot = true;
|
|
218
195
|
this.watcher = null;
|
|
219
196
|
}
|
|
@@ -301,22 +278,15 @@ export class BVTRecorder {
|
|
|
301
278
|
return result;
|
|
302
279
|
}
|
|
303
280
|
getInitScripts(config) {
|
|
304
|
-
return getInitScript(config
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
// const inlineScript = `
|
|
314
|
-
// window.__bvt_Recorder.setPopupHandlers(${JSON.stringify(popupHandlers)});
|
|
315
|
-
// window.__bvt_Recorder.setDisableHighlight(${JSON.stringify(disableHighlight)});
|
|
316
|
-
// window.__bvt_Recorder.setImproviseLocators(${JSON.stringify(!disableMultipleLocators)});
|
|
317
|
-
// `
|
|
318
|
-
// scripts.push(inlineScript);
|
|
319
|
-
// return scripts;
|
|
281
|
+
return getInitScript(config, {
|
|
282
|
+
sdkLanguage: "javascript",
|
|
283
|
+
testIdAttributeName: "blinq-test-id",
|
|
284
|
+
stableRafCount: 0,
|
|
285
|
+
browserName: this.browser?.browserType().name(),
|
|
286
|
+
inputFileRoleTextbox: false,
|
|
287
|
+
customEngines: [],
|
|
288
|
+
isUnderTest: true,
|
|
289
|
+
});
|
|
320
290
|
}
|
|
321
291
|
|
|
322
292
|
async _initBrowser({ url }) {
|
|
@@ -324,7 +294,7 @@ export class BVTRecorder {
|
|
|
324
294
|
process.env.CDP_LISTEN_PORT = this.#remoteDebuggerPort;
|
|
325
295
|
|
|
326
296
|
this.stepRunner.setRemoteDebugPort(this.#remoteDebuggerPort);
|
|
327
|
-
this.world = { attach: () => {} };
|
|
297
|
+
this.world = { attach: () => { } };
|
|
328
298
|
|
|
329
299
|
const ai_config_file = path.join(this.projectDir, "ai_config.json");
|
|
330
300
|
let ai_config = {};
|
|
@@ -336,7 +306,7 @@ export class BVTRecorder {
|
|
|
336
306
|
}
|
|
337
307
|
}
|
|
338
308
|
const initScripts = {
|
|
339
|
-
recorderCjs: injectedScriptSource,
|
|
309
|
+
// recorderCjs: injectedScriptSource,
|
|
340
310
|
scripts: [
|
|
341
311
|
this.getInitScripts(ai_config),
|
|
342
312
|
`\ndelete Object.getPrototypeOf(navigator).webdriver;${process.env.WINDOW_DEBUGGER ? "window.debug=true;\n" : ""}`,
|
|
@@ -626,7 +596,7 @@ export class BVTRecorder {
|
|
|
626
596
|
}
|
|
627
597
|
async closeBrowser() {
|
|
628
598
|
delete process.env.TEMP_RUN;
|
|
629
|
-
await this.watcher.close().then(() => {});
|
|
599
|
+
await this.watcher.close().then(() => { });
|
|
630
600
|
this.watcher = null;
|
|
631
601
|
await closeContext();
|
|
632
602
|
this.pageSet.clear();
|
package/package.json
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dev-blinq/cucumber_client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1255-dev",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"types": "bin/index.d.ts",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"pack": "mkdir build && mkdir build/bin && cp -R ./src/* ./build/bin && cp ./package.json ./build",
|
|
9
|
+
"pack": "npm run bundle && mkdir build && mkdir build/bin && cp -R ./src/* ./build/bin && cp ./package.json ./build",
|
|
10
10
|
"test": "node ./test/test.js",
|
|
11
11
|
"tests_prod": "rm -rf results.json && cross-env NODE_ENV_BLINQ=prod TOKEN=xxx npx mocha --parallel --jobs=10 ./tests",
|
|
12
12
|
"tests": "node ./multi_test_runner.js",
|
|
13
13
|
"lint": "eslint ./src/**/*.js",
|
|
14
14
|
"clean": "rm -rf ./build",
|
|
15
15
|
"build": "npm run clean && npm run pack",
|
|
16
|
+
"build:watch": "npx nodemon --watch src --exec 'npm run build'",
|
|
16
17
|
"update_logic": "rm -rf ../logic/node_modules/@dev-blinq && mkdir ../logic/node_modules/@dev-blinq && mkdir ../logic/node_modules/@dev-blinq/cucumber_client && mkdir ../logic/node_modules/@dev-blinq/cucumber_client/bin && mkdir ../logic/node_modules/@dev-blinq/cucumber_client/node_modules && cp -R ./build/* ../logic/node_modules/@dev-blinq/cucumber_client/bin && cp -R ./node_modules/* ../logic/node_modules/@dev-blinq/cucumber_client/node_modules && cp ./package.json ../logic/node_modules/@dev-blinq/cucumber_client/",
|
|
17
18
|
"version-bump": "npm version prepatch --preid=dev",
|
|
18
19
|
"scripts_regression": "cross-env HEADLESS=true npx mocha --bail --parallel --jobs=12 ./scripts_regression/ --timeout 120000",
|
|
19
|
-
"runtime_reg": "cross-env HEADLESS=true npx mocha --bail --parallel --jobs=12 ./runtime_regression/ --timeout 4800000"
|
|
20
|
+
"runtime_reg": "cross-env HEADLESS=true npx mocha --bail --parallel --jobs=12 ./runtime_regression/ --timeout 4800000",
|
|
21
|
+
"bundle": "npx tsup",
|
|
22
|
+
"bundle:watch": "npx tsup --watch"
|
|
20
23
|
},
|
|
21
24
|
"author": "",
|
|
22
25
|
"license": "ISC",
|
|
@@ -46,7 +49,9 @@
|
|
|
46
49
|
"pureimage": "0.4.9",
|
|
47
50
|
"socket.io": "^4.7.5",
|
|
48
51
|
"socket.io-client": "^4.7.5",
|
|
52
|
+
"tsup": "^8.5.0",
|
|
49
53
|
"tunnel": "^0.0.6",
|
|
54
|
+
"typescript": "^5.8.3",
|
|
50
55
|
"unzipper": "^0.12.3",
|
|
51
56
|
"win-ca": "^3.5.1",
|
|
52
57
|
"winston": "^3.10.0",
|