ff-automationv2 2.2.34-beta.4 → 2.2.35

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.
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uploadFileShadowElement = uploadFileShadowElement;
4
+ const uploadPathHelper_js_1 = require("../../../../utils/helpers/uploadPathHelper.js");
4
5
  const appendScriptData_js_1 = require("../../../../fireflinkData/fireflinkScript/appendScriptData.js");
5
6
  const generateJsPath_js_1 = require("../../../../utils/JsPathGenerator/generateJsPath.js");
6
7
  const logData_js_1 = require("../../../../utils/logger/logData.js");
@@ -64,12 +65,16 @@ async function uploadFileShadowElement(args) {
64
65
  if (!fileInput) {
65
66
  throw new Error(`Shadow DOM file input not found. Selector: "${args.selector}"`);
66
67
  }
67
- const remoteFilePath = await args.driver.uploadFile(args.value);
68
+ let remoteFilePath;
68
69
  try {
70
+ remoteFilePath = await args.driver.uploadFile((0, uploadPathHelper_js_1.resolveUploadPath)(args.value));
69
71
  await fileInput.setValue(remoteFilePath);
70
72
  }
71
73
  catch (err) {
72
74
  logData_js_1.logger.info(`setValue failed on shadow file input, trying addValue: ${err.message}`);
75
+ if (!remoteFilePath) {
76
+ throw err;
77
+ }
73
78
  await fileInput.addValue(remoteFilePath);
74
79
  }
75
80
  //Dispatch change and input events so custom UI components update their state
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uploadFilePathUsingRobot = uploadFilePathUsingRobot;
4
+ const uploadPathHelper_js_1 = require("../../../../utils/helpers/uploadPathHelper.js");
4
5
  const enterActionHelper_js_1 = require("../../../../utils/helpers/enterActionHelper.js");
5
6
  const logData_js_1 = require("../../../../utils/logger/logData.js");
6
7
  const appendScriptData_js_1 = require("../../../../fireflinkData/fireflinkScript/appendScriptData.js");
@@ -8,11 +9,15 @@ async function uploadFilePathUsingRobot(args) {
8
9
  try {
9
10
  const { ffNumber, xpathPath } = (0, enterActionHelper_js_1.enterActionHelper)(args.pageDOM, args.fireflinkIndex);
10
11
  const fileInput = await args.driver.$(xpathPath);
11
- const remoteFilePath = await args.driver.uploadFile(args.value);
12
+ let remoteFilePath;
12
13
  try {
14
+ remoteFilePath = await args.driver.uploadFile((0, uploadPathHelper_js_1.resolveUploadPath)(args.value));
13
15
  await fileInput.setValue(remoteFilePath);
14
16
  }
15
17
  catch (error) {
18
+ if (!remoteFilePath) {
19
+ throw error;
20
+ }
16
21
  logData_js_1.logger.info(`Error in setValue, using addValue instead: ${error.message}`);
17
22
  await fileInput.addValue(remoteFilePath);
18
23
  }
@@ -110,12 +110,17 @@ class AutomationRunner {
110
110
  if (context?.mobileSession) {
111
111
  const mobileDriver = await context.mobileSession.getCurrentDriver().catch(() => null);
112
112
  if (mobileDriver?.sessionId) {
113
- if (currentPlatform === "ios") {
114
- logData_js_1.logger.info("iOS session is not deleted");
113
+ if (request.isCloud) {
114
+ if (currentPlatform === "ios") {
115
+ logData_js_1.logger.info("iOS session is not deleted");
116
+ }
117
+ else {
118
+ await mobileDriver.deleteSession();
119
+ logData_js_1.logger.info("Mobile session deleted successfully");
120
+ }
115
121
  }
116
122
  else {
117
- await mobileDriver.deleteSession();
118
- logData_js_1.logger.info("Mobile session deleted successfully");
123
+ logData_js_1.logger.info("Local mobile session kept alive.");
119
124
  }
120
125
  }
121
126
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,34 +1,35 @@
1
1
  "use strict";
2
- // // import { verify } from "node:crypto";
3
- // import { AutomationRunner } from "../index.js"
4
- // import { Kafka, Producer } from "kafkajs";
5
- // import path from "path";
6
- // import fs from "fs";
7
- // const certPath = path.join(
8
- // "D:", "Bitbucket", "ai-chat-backend", "Certificates", "V3keystore.jks"
9
- // );
10
- // const ssl = {
11
- // ca: [fs.readFileSync(certPath, "utf-8")],
12
- // rejectUnauthorized: false,
13
- // }
14
- // const runner = new AutomationRunner();
15
- // runner.run({
16
- // // hasMoreSteps: false,
17
- // userStory: [
18
- // ["Launch the browser"],
19
- // ["navigate to url https://www.indiamart.com"],
20
- // ["wait for 20 seconds"],
21
- // ["get otp from INDMRT message within 60 seconds and wait for 60 seconds"],
22
- // ["Enter OTP into enter otp boxes"],
23
- // ["wait for 10 seconds"],
24
- // ["Close the browser"]
25
- // ],
26
- // scenario: false,
27
- // sslConfig: ssl,
28
- // scriptType: "android",
29
- // broker: ["test3.fireflink.com:9092"], "scriptName": "script", "type": "Web & Mobile", "projectId": "PJT1006", "testCaseId": "SCR1806", kafkaMessageKey: 'lohit',
30
- // "promptId": "a8fba64a-4d91-422c-bdfd-a7609576a63e", "generatedBy": "", "webSocketId": "", "licenseType": "C-Professional", "licenseId": "LIC2026980", "userId": "USR26860", "projectType": "Web", "serverData": "https://performance.fireflink.com", "pageDetails": { "Web": { "pageId": "PAG3e09350f-4917-4c80-8ce5-a08e97fe314e", "pageName": "ai-Page" } }, "userName": "jai", isTerminate: false, "appiumPort": 4723, "realDeviceId": "", "browserName": "Google Chrome", "token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIUlpZV2NoTURZWXVQaDF3TDkxb3drS3Q1OUtuNC1sOFRJcXF3a2RBV2pjIn0.eyJleHAiOjE3ODA1NzkwNzEsImlhdCI6MTc4MDQ5MjY3MSwianRpIjoib25ydHJvOmYxYzJiNjg2LTJiZGMtNGIxOS04ZGVhLTMwMjhhNDkxZDY5NCIsImlzcyI6Imh0dHA6Ly8xNDguNzIuMTY4LjE2OjMwMTA3L3JlYWxtcy9GaXJlRmxpbmstdGVzdDEiLCJhdWQiOiJ0YXJnZXQtY2xpZW50Iiwic3ViIjoiZjo4ODkyOWIwMC03M2I4LTQ3NGYtYmJiYy1kYjJlMWEzZTA3OTg6amFpYWthc2hAeW9wbWFpbC5jb20iLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJmbGluay1zZXJ2aWNlIiwic2lkIjoiZWRiMDgwZDctNzhiYi00NzU5LTgyM2EtMTM1ZDUzYTM5NmQzIiwiYWNyIjoiMSIsImFsbG93ZWQtb3JpZ2lucyI6WyIiXSwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iXX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsImN1cnJlbnRMaWNlbnNlSWQiOiJMSUMzOTIyIiwiZW1haWxfdmVyaWZpZWQiOmZhbHNlLCJjdXJyZW50UHJpdmlsZWdlIjoiQWRtaW4iLCJmdWxsTmFtZSI6ImphaSIsImFjdGl2YXRpb25TdGF0dXMiOiJBQ1RJVkUiLCJwcml2aWxlZ2UiOiJBZG1pbiIsImxpY2Vuc2VOYW1lIjoiRmlyZUZsaW5rIC0gTElDMzkyMnciLCJwcmVmZXJyZWRfdXNlcm5hbWUiOiJqYWkiLCJ1c2VyTmFtZSI6ImphaWFrYXNoQHlvcG1haWwuY29tIiwiYmlsbGluZ0N5Y2xlIjoiWWVhcmx5IiwiaWQiOiJVU1IyNjc1MiIsImxpY2Vuc2VJZCI6IkxJQzM5MjIiLCJlbWFpbCI6ImphaWFrYXNoQHlvcG1haWwuY29tIn0.LPBCnEKBi8Yi4Qktpd_oW46-P7s0iQ0AejZeXRMIa8aUwfwY8gNl3McIrKLBVqPL4NKYe_05aMaiepvjkolu7RWh120mX90ZdNJuMUjg0WuRaM90xNjmy1YK94mBt0mphKK04u1K4trvhvgW2hTt4rvGRq_oEvH2E_2YqYw310TuP-guqxuZqTv_IJ6HFtvMJkV9L3A579juICZfGdS53-KuZwqn7jA-73nJZBzPJyMucaPz42s36RWpDmfs7MX0-Fcv8LH7FvCjCs63GvCC-tdGoh5m0MRCiElJocWlw9jabsPHymEt5-nemnXIZIon2675wYbxVx99mHA1VBPD2w", "sessionPath": "session", "platform": "android", "platformVersion": "", "env": "test1",
31
- // "serverHost": "https://sg-app.fireflink.com", "adbPath": "C:\\FireFlinkClient\\resources\\bin\\win\\android-sdk\\platform-tools\\adb.exe",
32
- // topic: "test-topic",
33
- // aiExecutionAction: ""
34
- // });
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // import { verify } from "node:crypto";
7
+ const index_js_1 = require("../index.js");
8
+ const path_1 = __importDefault(require("path"));
9
+ const fs_1 = __importDefault(require("fs"));
10
+ const certPath = path_1.default.join("D:", "Bitbucket", "ai-chat-backend", "Certificates", "V3keystore.jks");
11
+ const ssl = {
12
+ ca: [fs_1.default.readFileSync(certPath, "utf-8")],
13
+ rejectUnauthorized: false,
14
+ };
15
+ const runner = new index_js_1.AutomationRunner();
16
+ runner.run({
17
+ hasMoreSteps: false,
18
+ userStory: [
19
+ ["Launch the browser"],
20
+ ["navigate to url https://www.indiamart.com"],
21
+ ["wait for 20 seconds"],
22
+ ["get otp from INDMRT message within 60 seconds and wait for 60 seconds"],
23
+ ["Enter OTP into enter otp boxes"],
24
+ ["wait for 10 seconds"],
25
+ ["Close the browser"]
26
+ ],
27
+ scenario: false,
28
+ sslConfig: ssl,
29
+ scriptType: "android",
30
+ broker: ["test3.fireflink.com:9092"], "scriptName": "script", "type": "Web & Mobile", "projectId": "PJT1006", "testCaseId": "SCR1806", kafkaMessageKey: 'lohit',
31
+ "promptId": "a8fba64a-4d91-422c-bdfd-a7609576a63e", "generatedBy": "", "webSocketId": "", "licenseType": "C-Professional", "licenseId": "LIC2026980", "userId": "USR26860", "projectType": "Web", "serverData": "https://performance.fireflink.com", "pageDetails": { "Web": { "pageId": "PAG3e09350f-4917-4c80-8ce5-a08e97fe314e", "pageName": "ai-Page" } }, "userName": "jai", isTerminate: false, "appiumPort": 4723, "realDeviceId": "", "browserName": "Google Chrome", "token": "eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJIUlpZV2NoTURZWXVQaDF3TDkxb3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WwuY29tIn0.LPBCnEKBi8Yi4Qktpd_oW46-P7s0iQ0AejZeXRMIa8aUwfwY8gNl3McIrKLBVqPL4NKYe_05aMaiepvjkolu7RWh120mX90ZdNJuMUjg0WuRaM90xNjmy1YK94mBt0mphKK04u1K4trvhvgW2hTt4rvGRq_oEvH2E_2YqYw310TuP-guqxuZqTv_IJ6HFtvMJkV9L3A579juICZfGdS53-KuZwqn7jA-73nJZBzPJyMucaPz42s36RWpDmfs7MX0-Fcv8LH7FvCjCs63GvCC-tdGoh5m0MRCiElJocWlw9jabsPHymEt5-nemnXIZIon2675wYbxVx99mHA1VBPD2w", "sessionPath": "session", "platform": "android", "platformVersion": "", "env": "test1",
32
+ "serverHost": "https://sg-app.fireflink.com", "adbPath": "C:\\FireFlinkClient\\resources\\bin\\win\\android-sdk\\platform-tools\\adb.exe",
33
+ topic: "test-topic",
34
+ aiExecutionAction: ""
35
+ });
@@ -0,0 +1 @@
1
+ export declare const resolveUploadPath: (rawPath: string) => string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.resolveUploadPath = void 0;
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const resolveUploadPath = (rawPath) => {
10
+ const filePath = node_path_1.default.normalize(rawPath.trim().replace(/^["']|["']$/g, ""));
11
+ if (!node_fs_1.default.existsSync(filePath)) {
12
+ throw new Error(`Upload file not found: "${filePath}"`);
13
+ }
14
+ if (!node_fs_1.default.statSync(filePath).isFile()) {
15
+ throw new Error(`Upload path is not a file: "${filePath}"`);
16
+ }
17
+ return filePath;
18
+ };
19
+ exports.resolveUploadPath = resolveUploadPath;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-automationv2",
3
- "version": "2.2.34-beta.4",
3
+ "version": "2.2.35",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "This lib is used to automate the manual testcase",