ff-automationv2 2.2.25 → 2.2.26

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.
Files changed (22) hide show
  1. package/dist/ai/llmcalls/llmAction.js +2 -2
  2. package/dist/automation/actions/executor.d.ts +2 -1
  3. package/dist/automation/actions/executor.js +12 -1
  4. package/dist/automation/actions/interaction/elementlessActions/isAppInstalled.js +1 -1
  5. package/dist/automation/actions/interaction/elementlessActions/openAppWithApkFilePath.js +3 -3
  6. package/dist/automation/actions/interaction/elementlessActions/uninstallAPK.js +1 -1
  7. package/dist/automation/actions/interaction/enterActions/enterInput.js +1 -1
  8. package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOff.js +2 -2
  9. package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOn.js +2 -2
  10. package/dist/automation/actions/interaction/inputlessActions/RestartCurrentDevice.js +1 -1
  11. package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOff.js +1 -1
  12. package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOn.js +1 -1
  13. package/dist/automation/actions/interaction/press/pressHomeKey.js +1 -1
  14. package/dist/automation/actions/interface/InputlessActionnterface.d.ts +5 -0
  15. package/dist/automation/actions/interface/elementlessInterface.d.ts +3 -0
  16. package/dist/automation/actions/interface/interactionActionInterface.d.ts +1 -0
  17. package/dist/automation/actions/interface/pressActionInterface.d.ts +1 -0
  18. package/dist/automation/mobileSession/initiateMobileSession.js +3 -1
  19. package/dist/core/main/actionHandlerFactory.js +2 -2
  20. package/dist/core/main/executionContext.d.ts +1 -0
  21. package/dist/core/main/executionContext.js +1 -0
  22. package/package.json +1 -1
@@ -19,7 +19,7 @@ class llmAction {
19
19
  baseURL: baseURL,
20
20
  });
21
21
  this.visionClient = new openai_1.default({
22
- apiKey: (0, decodeApiKey_js_1.decodeApiKey)(this.visionApiKey),
22
+ apiKey: (0, decodeApiKey_js_1.decodeApiKey)(this.visionApiKey ?? apiKey),
23
23
  });
24
24
  }
25
25
  async getLLMResponse(platform, type, args, userInput) {
@@ -92,7 +92,7 @@ class llmAction {
92
92
  return response;
93
93
  }
94
94
  catch (error) {
95
- logData_js_1.logger.error(`Vision LLM Error Attempt ${attempt}:`, error);
95
+ logData_js_1.logger.error(`Vision LLM Error Attempt ${attempt}:`);
96
96
  const structuredError = this.handleKnownErrors(error);
97
97
  if (structuredError)
98
98
  return structuredError;
@@ -7,7 +7,8 @@ export declare class ActionExecutor implements IActionExecutor {
7
7
  private scriptDataAppender;
8
8
  private elementGetter;
9
9
  private platform;
10
- constructor(driver: WebdriverIO.Browser, scriptDataAppender: ScriptDataAppender, elementGetter: ElementGetter, platform: string);
10
+ private adbPath;
11
+ constructor(driver: WebdriverIO.Browser, scriptDataAppender: ScriptDataAppender, elementGetter: ElementGetter, platform: string, adbPath: string);
11
12
  navigate(url: string): Promise<void>;
12
13
  goBack(): Promise<void>;
13
14
  refresh(): Promise<void>;
@@ -354,11 +354,12 @@ const mobPressBackSpaceKey_js_1 = require("./interaction/press/mobPressBackSpace
354
354
  const mobPressSpaceKey_js_1 = require("./interaction/press/mobPressSpaceKey.js");
355
355
  const MOB_FindElement_js_1 = require("./interaction/find/MOB_FindElement.js");
356
356
  class ActionExecutor {
357
- constructor(driver, scriptDataAppender, elementGetter, platform) {
357
+ constructor(driver, scriptDataAppender, elementGetter, platform, adbPath) {
358
358
  this.driver = driver;
359
359
  this.scriptDataAppender = scriptDataAppender;
360
360
  this.elementGetter = elementGetter;
361
361
  this.platform = platform;
362
+ this.adbPath = adbPath;
362
363
  }
363
364
  async navigate(url) {
364
365
  try {
@@ -550,6 +551,7 @@ class ActionExecutor {
550
551
  driver: this.driver,
551
552
  selector: selector,
552
553
  value,
554
+ adbPath: this.adbPath,
553
555
  scriptDataAppender: this.scriptDataAppender,
554
556
  elementGetter: this.elementGetter,
555
557
  fireflinkIndex,
@@ -4487,6 +4489,7 @@ class ActionExecutor {
4487
4489
  try {
4488
4490
  await (0, AirplaneModeSwitchOff_js_1.AirplaneModeSwitchOff)({
4489
4491
  driver: this.driver,
4492
+ adbPath: this.adbPath,
4490
4493
  scriptDataAppender: this.scriptDataAppender,
4491
4494
  platform: this.platform
4492
4495
  });
@@ -4500,6 +4503,7 @@ class ActionExecutor {
4500
4503
  try {
4501
4504
  await (0, AirplaneModeSwitchOn_js_1.AirplaneModeSwitchOn)({
4502
4505
  driver: this.driver,
4506
+ adbPath: this.adbPath,
4503
4507
  scriptDataAppender: this.scriptDataAppender,
4504
4508
  platform: this.platform
4505
4509
  });
@@ -4617,6 +4621,7 @@ class ActionExecutor {
4617
4621
  try {
4618
4622
  await (0, RestartCurrentDevice_js_1.RestartCurrentDevice)({
4619
4623
  driver: this.driver,
4624
+ adbPath: this.adbPath,
4620
4625
  scriptDataAppender: this.scriptDataAppender,
4621
4626
  platform: this.platform
4622
4627
  });
@@ -4656,6 +4661,7 @@ class ActionExecutor {
4656
4661
  try {
4657
4662
  await (0, SetEmulatorPowerStateOff_js_1.SetEmulatorPowerStateOff)({
4658
4663
  driver: this.driver,
4664
+ adbPath: this.adbPath,
4659
4665
  scriptDataAppender: this.scriptDataAppender,
4660
4666
  platform: this.platform
4661
4667
  });
@@ -4669,6 +4675,7 @@ class ActionExecutor {
4669
4675
  try {
4670
4676
  await (0, SetEmulatorPowerStateOn_js_1.SetEmulatorPowerStateOn)({
4671
4677
  driver: this.driver,
4678
+ adbPath: this.adbPath,
4672
4679
  scriptDataAppender: this.scriptDataAppender,
4673
4680
  platform: this.platform
4674
4681
  });
@@ -4708,6 +4715,7 @@ class ActionExecutor {
4708
4715
  try {
4709
4716
  await (0, pressHomeKey_js_1.PressHomeKey)({
4710
4717
  driver: this.driver,
4718
+ adbPath: this.adbPath,
4711
4719
  scriptDataAppender: this.scriptDataAppender,
4712
4720
  platform: this.platform
4713
4721
  });
@@ -4750,6 +4758,7 @@ class ActionExecutor {
4750
4758
  await (0, isAppInstalled_js_1.IsAppInstalled)({
4751
4759
  driver: this.driver,
4752
4760
  value,
4761
+ adbPath: this.adbPath,
4753
4762
  scriptDataAppender: this.scriptDataAppender,
4754
4763
  platform: this.platform
4755
4764
  });
@@ -4778,6 +4787,7 @@ class ActionExecutor {
4778
4787
  await (0, uninstallAPK_js_1.UninstallAPK)({
4779
4788
  driver: this.driver,
4780
4789
  value,
4790
+ adbPath: this.adbPath,
4781
4791
  scriptDataAppender: this.scriptDataAppender,
4782
4792
  platform: this.platform
4783
4793
  });
@@ -4820,6 +4830,7 @@ class ActionExecutor {
4820
4830
  await (0, openAppWithApkFilePath_js_1.OpenAppWithApkFilePath)({
4821
4831
  driver: this.driver,
4822
4832
  value,
4833
+ adbPath: this.adbPath,
4823
4834
  scriptDataAppender: this.scriptDataAppender,
4824
4835
  platform: this.platform
4825
4836
  });
@@ -16,7 +16,7 @@ async function IsAppInstalled(args) {
16
16
  }
17
17
  if (!isInstalled) {
18
18
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
19
- const cmdPrefix = udid ? `adb -s ${udid} shell` : `adb shell`;
19
+ const cmdPrefix = udid ? `${args.adbPath} -s ${udid} shell` : `${args.adbPath} shell`;
20
20
  const result = (0, child_process_1.execSync)(`${cmdPrefix} pm list packages`).toString().toLowerCase();
21
21
  if (result.includes(target.toLowerCase())) {
22
22
  isInstalled = true;
@@ -8,7 +8,7 @@ const logData_js_1 = require("../../../../utils/logger/logData.js");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const child_process_1 = require("child_process");
10
10
  const path_1 = __importDefault(require("path"));
11
- function getLatestInstalledPackage(apkPath) {
11
+ function getLatestInstalledPackage(apkPath, adbPath) {
12
12
  // ✅ Step 1: Extract APK name
13
13
  const apkName = path_1.default.basename(apkPath, ".apk").toLowerCase();
14
14
  // Example:
@@ -16,7 +16,7 @@ function getLatestInstalledPackage(apkPath) {
16
16
  // Normalize name (remove special chars)
17
17
  const normalizedApkName = apkName.replace(/[^a-z0-9]/g, "");
18
18
  // ✅ Step 2: Get installed packages (3rd party only)
19
- const output = (0, child_process_1.execSync)(`adb shell pm list packages -3`, {
19
+ const output = (0, child_process_1.execSync)(`${adbPath} shell pm list packages -3`, {
20
20
  maxBuffer: 1024 * 1024 * 5
21
21
  }).toString();
22
22
  const packages = output
@@ -80,7 +80,7 @@ async function OpenAppWithApkFilePath(args) {
80
80
  throw new Error(`Could not find or install APK: ${apkPath}`);
81
81
  }
82
82
  // ✅ Step 5: Launch app
83
- const appPackage = await getLatestInstalledPackage(apkPath);
83
+ const appPackage = await getLatestInstalledPackage(apkPath, args.adbPath);
84
84
  logData_js_1.logger.info(`Launching app: ${appPackage}`);
85
85
  await args.driver.activateApp(appPackage);
86
86
  // ✅ Script logging
@@ -19,7 +19,7 @@ async function UninstallAPK(args) {
19
19
  }
20
20
  if (!uninstalled) {
21
21
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
22
- const cmdPrefix = udid ? `adb -s ${udid} shell` : `adb shell`;
22
+ const cmdPrefix = udid ? `${args.adbPath} -s ${udid} shell` : `${args.adbPath} shell`;
23
23
  const packagesResult = (0, child_process_1.execSync)(`${cmdPrefix} pm list packages`).toString().toLowerCase();
24
24
  for (const line of packagesResult.split(/\r?\n/)) {
25
25
  if (line.includes(target.toLowerCase())) {
@@ -45,7 +45,7 @@ async function enterInput(args) {
45
45
  const text = await element.getAttribute("text");
46
46
  if (text !== args.value) {
47
47
  const { execSync } = await Promise.resolve().then(() => __importStar(require("child_process")));
48
- execSync(`adb shell input text ${args.value}`);
48
+ execSync(`${args.adbPath} shell input text ${args.value}`);
49
49
  }
50
50
  args.scriptDataAppender.add(async () => {
51
51
  return {
@@ -7,8 +7,8 @@ async function AirplaneModeSwitchOff(args) {
7
7
  try {
8
8
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
9
9
  const cmdPrefix = udid
10
- ? `adb -s ${udid} shell`
11
- : `adb shell`;
10
+ ? `${args.adbPath} -s ${udid} shell`
11
+ : `${args.adbPath} shell`;
12
12
  logData_js_1.logger.info("Attempting ADB fallback for AIRPLANE MODE OFF...");
13
13
  // Android 10+
14
14
  (0, child_process_1.execSync)(`${cmdPrefix} cmd connectivity airplane-mode disable`);
@@ -8,8 +8,8 @@ async function AirplaneModeSwitchOn(args) {
8
8
  // ADB fallback
9
9
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
10
10
  const cmdPrefix = udid
11
- ? `adb -s ${udid} shell`
12
- : `adb shell`;
11
+ ? `${args.adbPath} -s ${udid} shell`
12
+ : `${args.adbPath} shell`;
13
13
  logData_js_1.logger.info("Attempting ADB fallback for AIRPLANE MODE ON...");
14
14
  // Android 10+
15
15
  (0, child_process_1.execSync)(`${cmdPrefix} cmd connectivity airplane-mode enable`);
@@ -8,7 +8,7 @@ async function RestartCurrentDevice(args) {
8
8
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
9
9
  logData_js_1.logger.info(`Attempting ADB reboot on ${udid || 'default device'}...`);
10
10
  try {
11
- (0, child_process_1.execSync)(`adb -s ${udid} reboot`);
11
+ (0, child_process_1.execSync)(`${args.adbPath} -s ${udid} reboot`);
12
12
  }
13
13
  catch (e) {
14
14
  logData_js_1.logger.info("ADB reboot is going", e);
@@ -13,7 +13,7 @@ async function SetEmulatorPowerStateOff(args) {
13
13
  catch (error) {
14
14
  logData_js_1.logger.info("mobile: setPowerState failed, attempting ADB fallback for real device...", error);
15
15
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
16
- const cmdPrefix = udid ? `adb -s ${udid} shell` : `adb shell`;
16
+ const cmdPrefix = udid ? `${args.adbPath} -s ${udid} shell` : `${args.adbPath} shell`;
17
17
  // KEYCODE_SLEEP = 223
18
18
  (0, child_process_1.execSync)(`${cmdPrefix} input keyevent 223`);
19
19
  }
@@ -13,7 +13,7 @@ async function SetEmulatorPowerStateOn(args) {
13
13
  catch (error) {
14
14
  logData_js_1.logger.info("mobile: setPowerState failed, attempting ADB fallback for real device...", error);
15
15
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
16
- const cmdPrefix = udid ? `adb -s ${udid} shell` : `adb shell`;
16
+ const cmdPrefix = udid ? `${args.adbPath} -s ${udid} shell` : `${args.adbPath} shell`;
17
17
  // KEYCODE_WAKEUP = 224
18
18
  (0, child_process_1.execSync)(`${cmdPrefix} input keyevent 224`);
19
19
  }
@@ -7,7 +7,7 @@ async function PressHomeKey(args) {
7
7
  try {
8
8
  logData_js_1.logger.info("Pressing HOME key...");
9
9
  const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
10
- const cmdPrefix = udid ? `adb -s ${udid} shell` : `adb shell`;
10
+ const cmdPrefix = udid ? `${args.adbPath} -s ${udid} shell` : `${args.adbPath} shell`;
11
11
  // Android HOME keyevent is 3
12
12
  (0, child_process_1.execSync)(`${cmdPrefix} input keyevent 3`);
13
13
  args.scriptDataAppender.add(async () => ({
@@ -18,6 +18,7 @@ export interface MOB_SetEmulatorPowerStateOffInterface {
18
18
  driver: WebdriverIO.Browser;
19
19
  scriptDataAppender: ScriptDataAppender;
20
20
  platform: string;
21
+ adbPath?: string;
21
22
  }
22
23
  export interface MOB_OpenChromeBrowserInterface {
23
24
  driver: WebdriverIO.Browser;
@@ -38,11 +39,13 @@ export interface MOB_SetEmulatorPowerStateOnInterface {
38
39
  driver: WebdriverIO.Browser;
39
40
  scriptDataAppender: ScriptDataAppender;
40
41
  platform: string;
42
+ adbPath?: string;
41
43
  }
42
44
  export interface MOB_AirplaneModeSwitchOnInterface {
43
45
  driver: WebdriverIO.Browser;
44
46
  scriptDataAppender: ScriptDataAppender;
45
47
  platform: string;
48
+ adbPath?: string;
46
49
  }
47
50
  export interface MOB_LockDeviceInterface {
48
51
  driver: WebdriverIO.Browser;
@@ -78,11 +81,13 @@ export interface MOB_RestartCurrentDeviceInterface {
78
81
  driver: WebdriverIO.Browser;
79
82
  scriptDataAppender: ScriptDataAppender;
80
83
  platform: string;
84
+ adbPath?: string;
81
85
  }
82
86
  export interface MOB_AirplaneModeSwitchOffInterface {
83
87
  driver: WebdriverIO.Browser;
84
88
  scriptDataAppender: ScriptDataAppender;
85
89
  platform: string;
90
+ adbPath?: string;
86
91
  }
87
92
  export interface BreakInterface {
88
93
  driver: WebdriverIO.Browser;
@@ -16,6 +16,7 @@ export interface MOB_IsAppInstalledInterface {
16
16
  scriptDataAppender: ScriptDataAppender;
17
17
  platform: string;
18
18
  value: string;
19
+ adbPath?: string;
19
20
  }
20
21
  export interface MOB_ReceiveMessageOnEmulatorInterface {
21
22
  driver: WebdriverIO.Browser;
@@ -28,6 +29,7 @@ export interface MOB_UninstallAPKInterface {
28
29
  scriptDataAppender: ScriptDataAppender;
29
30
  platform: string;
30
31
  value: string;
32
+ adbPath?: string;
31
33
  }
32
34
  export interface MOB_InstallAPKInterface {
33
35
  driver: WebdriverIO.Browser;
@@ -46,6 +48,7 @@ export interface MOB_OpenAppWithApkFilePathInterface {
46
48
  scriptDataAppender: ScriptDataAppender;
47
49
  platform: string;
48
50
  value: string;
51
+ adbPath?: string;
49
52
  }
50
53
  export interface MOB_ActivateAppUsingAppPackageInterface {
51
54
  driver: WebdriverIO.Browser;
@@ -4,6 +4,7 @@ export interface EnterInputInterface {
4
4
  driver: WebdriverIO.Browser;
5
5
  selector: string;
6
6
  value: string;
7
+ adbPath?: string;
7
8
  scriptDataAppender: ScriptDataAppender;
8
9
  elementGetter: ElementGetter;
9
10
  fireflinkIndex: string;
@@ -23,6 +23,7 @@ export interface PressEnterKeyInterface {
23
23
  }
24
24
  export interface MOB_PressHomeKeyInterface {
25
25
  driver: WebdriverIO.Browser;
26
+ adbPath?: string;
26
27
  scriptDataAppender: ScriptDataAppender;
27
28
  platform: string;
28
29
  }
@@ -43,6 +43,7 @@ class MobileSession {
43
43
  throw new Error("Appium server is not running or unreachable.", { cause: error });
44
44
  }
45
45
  try {
46
+ logData_js_1.logger.info(this.adbPath);
46
47
  await (0, child_process_1.execSync)(`${this.adbPath} -s ${arg.capabilities["appium:udid"]} shell pm clear ${appPackage}`).toString();
47
48
  await (0, child_process_1.execSync)(`${this.adbPath} -s ${arg.capabilities["appium:udid"]} shell am start -n ${appPackage}/${appActivity}`).toString();
48
49
  }
@@ -56,9 +57,10 @@ class MobileSession {
56
57
  }
57
58
  throw new Error(`ADB execution failed: ${output}`, { cause: error });
58
59
  }
60
+ const startTime = Date.now();
59
61
  this.driver = this.isCloud
60
62
  ? await this.cloudSessionInstances.initialize() : await this.openApp({ capabilities: arg.capabilities });
61
- logData_js_1.logger.info(`Application launched`);
63
+ logData_js_1.logger.info(`Application started ',total time taken: ${Date.now() - startTime} ms`);
62
64
  }
63
65
  async close() {
64
66
  if (this.driver) {
@@ -24,7 +24,7 @@ function createActionHandlers(context) {
24
24
  open: async () => {
25
25
  try {
26
26
  await context.session.open();
27
- context.executor = new executor_js_1.ActionExecutor(await context.session.getCurrentDriver(), context.scriptAppender, context.locator, context.request.platform);
27
+ context.executor = new executor_js_1.ActionExecutor(await context.session.getCurrentDriver(), context.scriptAppender, context.locator, context.request.platform, context.adbPath);
28
28
  context.scriptAppender.add(async () => ({
29
29
  nlpName: "OpenBrowser",
30
30
  elementsData: [],
@@ -58,7 +58,7 @@ function createActionHandlers(context) {
58
58
  },
59
59
  keywords: result.keywords
60
60
  });
61
- context.executor = new executor_js_1.ActionExecutor(await context.androidSession.getCurrentDriver(), context.scriptAppender, context.locator, context.request.platform);
61
+ context.executor = new executor_js_1.ActionExecutor(await context.androidSession.getCurrentDriver(), context.scriptAppender, context.locator, context.request.platform, context.request.adbPath || "");
62
62
  context.scriptAppender.add(async () => ({
63
63
  nlpName: "Open Android App",
64
64
  elementsData: [],
@@ -11,5 +11,6 @@ export declare class ExecutionContext {
11
11
  executor: ActionExecutor | null;
12
12
  locator: ElementGetter;
13
13
  scriptAppender: ScriptDataAppender;
14
+ adbPath: string;
14
15
  constructor(request: AutomationRequest);
15
16
  }
@@ -15,6 +15,7 @@ class ExecutionContext {
15
15
  this.locator = new getListOfLocators_js_1.ElementGetter();
16
16
  this.scriptAppender = new scriptGenrationData_js_1.ScriptDataAppender();
17
17
  this.androidSession = new initiateMobileSession_js_1.MobileSession(request.appiumPort, request.isCloud, request.capabilities, request.cloudConfig, request.adbPath);
18
+ this.adbPath = request.adbPath || "";
18
19
  }
19
20
  }
20
21
  exports.ExecutionContext = ExecutionContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-automationv2",
3
- "version": "2.2.25",
3
+ "version": "2.2.26",
4
4
  "private": false,
5
5
  "type": "commonjs",
6
6
  "description": "This lib is used to automate the manual testcase",