ff-automationv2 2.2.32-beta.1 → 2.2.32
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.
|
@@ -3,9 +3,12 @@ import { IAutomationRunner } from "../interfaces/automationRunnerInterface.js";
|
|
|
3
3
|
import { AutomationRequest } from "../../core/interfaces/executionDetails.js";
|
|
4
4
|
export declare class AutomationRunner implements IAutomationRunner {
|
|
5
5
|
static sessionTerminationDetails: Record<string, boolean>;
|
|
6
|
+
static sessionNames: Record<string, string>;
|
|
6
7
|
private KafkaPayload;
|
|
7
8
|
static getSessionTerminationInfo(testCaseId: string): boolean;
|
|
8
9
|
static updateSessionTerminationInfo(testCaseId: string): void;
|
|
10
|
+
static sessionName(testCaseId: string, sessionName: string): void;
|
|
11
|
+
static getSessionName(testCaseId: string): string;
|
|
9
12
|
static normalizeScriptType(scriptType?: string): string;
|
|
10
13
|
private cleanup;
|
|
11
14
|
private saveSessionStepData;
|
|
@@ -43,6 +43,12 @@ class AutomationRunner {
|
|
|
43
43
|
static updateSessionTerminationInfo(testCaseId) {
|
|
44
44
|
AutomationRunner.sessionTerminationDetails[testCaseId] = true;
|
|
45
45
|
}
|
|
46
|
+
static sessionName(testCaseId, sessionName) {
|
|
47
|
+
AutomationRunner.sessionNames[testCaseId] = sessionName;
|
|
48
|
+
}
|
|
49
|
+
static getSessionName(testCaseId) {
|
|
50
|
+
return AutomationRunner.sessionNames[testCaseId];
|
|
51
|
+
}
|
|
46
52
|
static normalizeScriptType(scriptType) {
|
|
47
53
|
const rawValue = (scriptType ?? "Web").trim();
|
|
48
54
|
if (!rawValue) {
|
|
@@ -146,12 +152,15 @@ class AutomationRunner {
|
|
|
146
152
|
(0, logData_js_1.initLogger)(request.sessionPath);
|
|
147
153
|
request.type = request.platform;
|
|
148
154
|
request.platform = AutomationRunner.normalizeScriptType(request.platform);
|
|
149
|
-
const isWebMobile = request.type?.toLowerCase().includes("web") &&
|
|
150
|
-
request.type?.toLowerCase().includes("android")
|
|
155
|
+
const isWebMobile = (request.type?.toLowerCase().includes("web") &&
|
|
156
|
+
request.type?.toLowerCase().includes("android")) ||
|
|
157
|
+
(request.type?.toLowerCase() === "android");
|
|
151
158
|
logData_js_1.logger.info("User Given Step", request.userStory);
|
|
152
|
-
const data = JSON.parse(request.scriptName);
|
|
153
|
-
const hasMoreSteps = data
|
|
154
|
-
request.scriptName = data
|
|
159
|
+
const data = request.scriptName ? JSON.parse(request.scriptName) : {};
|
|
160
|
+
const hasMoreSteps = data?.hasMoreSteps ?? false;
|
|
161
|
+
request.scriptName = data?.automationScriptName ?? "automationScriptName";
|
|
162
|
+
if (!request.isTerminate)
|
|
163
|
+
AutomationRunner.sessionName(request.testCaseId, request.scriptName);
|
|
155
164
|
if (request.isTerminate) {
|
|
156
165
|
return AutomationRunner.updateSessionTerminationInfo(request.testCaseId);
|
|
157
166
|
}
|
|
@@ -630,7 +639,7 @@ class AutomationRunner {
|
|
|
630
639
|
}
|
|
631
640
|
logData_js_1.logger.info("execution time->", new Date().getTime() - startTime);
|
|
632
641
|
const payload = {
|
|
633
|
-
scriptName: request.
|
|
642
|
+
scriptName: AutomationRunner.getSessionName(request.testCaseId) ?? "SCRIPT_NAME",
|
|
634
643
|
type: request.type,
|
|
635
644
|
scriptType: request.type,
|
|
636
645
|
projectId: request.projectId,
|
|
@@ -706,3 +715,4 @@ class AutomationRunner {
|
|
|
706
715
|
}
|
|
707
716
|
exports.AutomationRunner = AutomationRunner;
|
|
708
717
|
AutomationRunner.sessionTerminationDetails = {};
|
|
718
|
+
AutomationRunner.sessionNames = {};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeText = normalizeText;
|
|
4
4
|
exports.extractTextFromPdf = extractTextFromPdf;
|
|
5
5
|
const logData_js_1 = require("../logger/logData.js");
|
|
6
|
+
const url_1 = require("url");
|
|
6
7
|
function normalizeText(text) {
|
|
7
8
|
return text.replace(/\s+/g, " ").trim();
|
|
8
9
|
}
|
|
@@ -10,6 +11,10 @@ async function extractTextFromPdf(buffer) {
|
|
|
10
11
|
try {
|
|
11
12
|
const dynamicImport = new Function("modulePath", "return import(modulePath)");
|
|
12
13
|
const pdfjs = await dynamicImport("pdfjs-dist/legacy/build/pdf.mjs").catch(() => dynamicImport("pdfjs-dist"));
|
|
14
|
+
// Required for pdfjs-dist v4+.
|
|
15
|
+
// Assign directly without reading workerSrc first,
|
|
16
|
+
const workerPath = require.resolve("pdfjs-dist/legacy/build/pdf.worker.mjs");
|
|
17
|
+
pdfjs.GlobalWorkerOptions.workerSrc = (0, url_1.pathToFileURL)(workerPath).href;
|
|
13
18
|
const data = new Uint8Array(buffer);
|
|
14
19
|
const loadingTask = pdfjs.getDocument({
|
|
15
20
|
data,
|