ff-automationv2 2.2.25 → 2.2.27
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/dist/ai/llmcalls/llmAction.js +2 -2
- package/dist/ai/llmcalls/parseLlmOputput.js +3 -0
- package/dist/ai/llmprompts/systemPrompts/getActionExtractorPromptMob.js +2 -1
- package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +1 -1
- package/dist/automation/actions/executor.d.ts +2 -1
- package/dist/automation/actions/executor.js +18 -1
- package/dist/automation/actions/interaction/elementlessActions/isAppInstalled.js +1 -1
- package/dist/automation/actions/interaction/elementlessActions/openAppWithApkFilePath.js +3 -3
- package/dist/automation/actions/interaction/elementlessActions/uninstallAPK.js +1 -1
- package/dist/automation/actions/interaction/enterActions/enterInput.js +1 -1
- package/dist/automation/actions/interaction/enterActions/waitAndEnter.js +1 -1
- package/dist/automation/actions/interaction/get/getScreenshotAs.js +1 -1
- package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOff.js +2 -2
- package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOn.js +2 -2
- package/dist/automation/actions/interaction/inputlessActions/RestartCurrentDevice.js +1 -1
- package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOff.js +1 -1
- package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOn.js +1 -1
- package/dist/automation/actions/interaction/press/pressHomeKey.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyAllOptionsAreDeSelected.js +0 -6
- package/dist/automation/actions/interaction/verify/VerifyAttributeValue.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyPartialAttributeValue.js +1 -1
- package/dist/automation/actions/interaction/verify/checkIfElementIsDisplayed.js +1 -1
- package/dist/automation/actions/interaction/wait/MOB_WaitTillAttributeOfElementContainsString.js +1 -1
- package/dist/automation/actions/interaction/wait/waitTillAttributeOfElementIsString.js +1 -1
- package/dist/automation/actions/interaction/wait/waitTillElementContainsText.js +1 -1
- package/dist/automation/actions/interaction/wait/waitTillElementHasText.js +1 -1
- package/dist/automation/actions/interaction/wait/waitTillElementIsClickable.js +1 -1
- package/dist/automation/actions/interface/InputlessActionnterface.d.ts +5 -0
- package/dist/automation/actions/interface/elementlessInterface.d.ts +3 -0
- package/dist/automation/actions/interface/interactionActionInterface.d.ts +1 -0
- package/dist/automation/actions/interface/pressActionInterface.d.ts +1 -0
- package/dist/automation/mobileSession/initiateMobileSession.js +2 -1
- package/dist/core/interfaces/fireflinkScriptPayloadInterface.d.ts +1 -1
- package/dist/core/main/actionHandlerFactory.js +7 -7
- package/dist/core/main/executionContext.d.ts +1 -0
- package/dist/core/main/executionContext.js +1 -0
- package/dist/core/main/runAutomationScript.js +13 -4
- package/dist/utils/helpers/sameActionsHelper.js +1 -1
- 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 ?? "c2stcHJvai1HVTVlZGt4UDJEQXVBa29IbzB0MXdsTWFrWjljNnlQQjEtdUdGLXloZmhIclhEYnZubHo0M0l4QUoyME5Pc0hGYUw2OUFkdG5kOVQzQmxia0ZKQzUxTFJZX09aQzNzRHBOYjN5XzM5SUY4UXpBZElSU2ZBQ21wZjRtZG1OUzBlWXRhUjhudGhWdUktb2djeVBSMW1PdVpEdU83UUE="),
|
|
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}
|
|
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;
|
|
@@ -15,6 +15,9 @@ class LLMResultParser {
|
|
|
15
15
|
return JSON.parse(match[0]);
|
|
16
16
|
}
|
|
17
17
|
async fetchResult(llmOutput) {
|
|
18
|
+
if (typeof llmOutput?.error === "string" && llmOutput.error.includes("429")) {
|
|
19
|
+
throw llmOutput;
|
|
20
|
+
}
|
|
18
21
|
try {
|
|
19
22
|
const content = llmOutput?.choices?.[0]?.message?.content;
|
|
20
23
|
if (!content) {
|
|
@@ -10,7 +10,7 @@ async function getActionExtractorPromptMob({ extractedDomJson, priorAndNextSteps
|
|
|
10
10
|
"MOB_GetBatteryStatus","MOB_GetCurrentActivity","MOB_GetDeviceOsVersion","MOB_GetDeviceUdid","MOB_GetDeviceName","MOB_GetImplicitTimeOut",
|
|
11
11
|
"MOB_GetDriverInstance","MOB_GetCurrentWindowHandle","MOB_GetCurrentSessionId","MOB_GetHeightOfScreen","MOB_GetCurrentDeviceSystemBars",
|
|
12
12
|
"MOB_GetAttributeValueFromListOfWebElements","MOB_GetTagName","MOB_GetListOfElementsFromLocatorTypeLocatorValue","MOB_GetScreenshot","MOB_GetTextFromElementAndSetToClipBoard",
|
|
13
|
-
"MOB_GetHeightOfElement","MOB_GetTextFromListOfWebElements","MOB_GetHexCodeForGivenXYCoordinatesOfImage","MOB_GetADBLogsForGivenAppPackage","
|
|
13
|
+
"MOB_GetHeightOfElement","MOB_GetTextFromListOfWebElements","MOB_GetHexCodeForGivenXYCoordinatesOfImage","MOB_GetADBLogsForGivenAppPackage","MOB_GetScreenshotOfElement","MOB_GetWidthOfElement",
|
|
14
14
|
"MOB_GetX", "MOB_GetLocation","MOB_GetY","MOB_GetPerformanceData","MOB_GetRect","MOB_GetText","GetSize","MOB_GetAttribute"`;
|
|
15
15
|
const elementType = ["link", "textfield", "icon", "button", "radiobutton", "checkbox", "tab", "action overflow button", "hamburger menu", "toggle button", "steppers", "sliders"];
|
|
16
16
|
const prompt = `You are an intelligent assistant that extracts structured UI action data.
|
|
@@ -36,6 +36,7 @@ Rules:
|
|
|
36
36
|
- Extract input_text from the step, if you can't find any input text in the step, return keyword as input_text.
|
|
37
37
|
ex:Fetch the ADB logs for the abhibus
|
|
38
38
|
here input: abhibus
|
|
39
|
+
- if step is get screenshot of element map it to MOB_GetScreenshotOfElement nlp.
|
|
39
40
|
- Extract keyword from the step, if the step contains any keyword.
|
|
40
41
|
- Use the closest semantic match for the step; return attribute_value as Fire-Flink-0, only if nothing is found.
|
|
41
42
|
- if step is get location of device or get device location then map to MOB_GetDeviceLocation nlp.
|
|
@@ -21,7 +21,7 @@ If they mention package:com.app.android and activity:com.app.activity remove var
|
|
|
21
21
|
- Do NOT include status/technical words (displayed, enabled, authenticate, visible).
|
|
22
22
|
- If an element label contains multiple words (e.g., "Sign In", "Add to Cart"), keep them together as ONE keyword and do not split them and also for keywords you generated, do not split them.
|
|
23
23
|
-** element_name: extract name of the element that mentioned in the step not from keywords or other steps.(eg:tap on x -> element_name:x). always try to retuen short and meaning full element name from step**
|
|
24
|
-
- action: openApp for opening or launching of app, tap for taping or selecting or clicking or pressing, enter for entering input, wait for waiting or sleeping, verify for verifying or checking,scroll for scrolling and swiping, get for getting,fetching element, closeApp for closing the app.
|
|
24
|
+
- action: openApp for opening or launching of app, tap for taping or selecting or clicking or pressing, enter for entering input, wait for waiting or sleeping, verify for verifying or checking, scroll for scrolling and swiping, get for getting,fetching element, closeApp for closing the app.
|
|
25
25
|
- If step is press any key give action as tap.
|
|
26
26
|
- action must be one of from this list ${allowedActions}.if not one of them, return action as 'combined'. if step about set or find or open chrome browser or open app with apk path or install apk or uninstall apk or activate or terminate action pinch in or pinch out and running app in the backgroundaction return action as 'combined'
|
|
27
27
|
- if the step action is about finding then provide action as combined.
|
|
@@ -7,7 +7,8 @@ export declare class ActionExecutor implements IActionExecutor {
|
|
|
7
7
|
private scriptDataAppender;
|
|
8
8
|
private elementGetter;
|
|
9
9
|
private platform;
|
|
10
|
-
|
|
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,18 @@ 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;
|
|
363
|
+
if (this.platform.toLowerCase() == "web") {
|
|
364
|
+
this.platform = "Web";
|
|
365
|
+
}
|
|
366
|
+
else if (this.platform.toLowerCase() == "android") {
|
|
367
|
+
this.platform = "Android";
|
|
368
|
+
}
|
|
362
369
|
}
|
|
363
370
|
async navigate(url) {
|
|
364
371
|
try {
|
|
@@ -550,6 +557,7 @@ class ActionExecutor {
|
|
|
550
557
|
driver: this.driver,
|
|
551
558
|
selector: selector,
|
|
552
559
|
value,
|
|
560
|
+
adbPath: this.adbPath,
|
|
553
561
|
scriptDataAppender: this.scriptDataAppender,
|
|
554
562
|
elementGetter: this.elementGetter,
|
|
555
563
|
fireflinkIndex,
|
|
@@ -4487,6 +4495,7 @@ class ActionExecutor {
|
|
|
4487
4495
|
try {
|
|
4488
4496
|
await (0, AirplaneModeSwitchOff_js_1.AirplaneModeSwitchOff)({
|
|
4489
4497
|
driver: this.driver,
|
|
4498
|
+
adbPath: this.adbPath,
|
|
4490
4499
|
scriptDataAppender: this.scriptDataAppender,
|
|
4491
4500
|
platform: this.platform
|
|
4492
4501
|
});
|
|
@@ -4500,6 +4509,7 @@ class ActionExecutor {
|
|
|
4500
4509
|
try {
|
|
4501
4510
|
await (0, AirplaneModeSwitchOn_js_1.AirplaneModeSwitchOn)({
|
|
4502
4511
|
driver: this.driver,
|
|
4512
|
+
adbPath: this.adbPath,
|
|
4503
4513
|
scriptDataAppender: this.scriptDataAppender,
|
|
4504
4514
|
platform: this.platform
|
|
4505
4515
|
});
|
|
@@ -4617,6 +4627,7 @@ class ActionExecutor {
|
|
|
4617
4627
|
try {
|
|
4618
4628
|
await (0, RestartCurrentDevice_js_1.RestartCurrentDevice)({
|
|
4619
4629
|
driver: this.driver,
|
|
4630
|
+
adbPath: this.adbPath,
|
|
4620
4631
|
scriptDataAppender: this.scriptDataAppender,
|
|
4621
4632
|
platform: this.platform
|
|
4622
4633
|
});
|
|
@@ -4656,6 +4667,7 @@ class ActionExecutor {
|
|
|
4656
4667
|
try {
|
|
4657
4668
|
await (0, SetEmulatorPowerStateOff_js_1.SetEmulatorPowerStateOff)({
|
|
4658
4669
|
driver: this.driver,
|
|
4670
|
+
adbPath: this.adbPath,
|
|
4659
4671
|
scriptDataAppender: this.scriptDataAppender,
|
|
4660
4672
|
platform: this.platform
|
|
4661
4673
|
});
|
|
@@ -4669,6 +4681,7 @@ class ActionExecutor {
|
|
|
4669
4681
|
try {
|
|
4670
4682
|
await (0, SetEmulatorPowerStateOn_js_1.SetEmulatorPowerStateOn)({
|
|
4671
4683
|
driver: this.driver,
|
|
4684
|
+
adbPath: this.adbPath,
|
|
4672
4685
|
scriptDataAppender: this.scriptDataAppender,
|
|
4673
4686
|
platform: this.platform
|
|
4674
4687
|
});
|
|
@@ -4708,6 +4721,7 @@ class ActionExecutor {
|
|
|
4708
4721
|
try {
|
|
4709
4722
|
await (0, pressHomeKey_js_1.PressHomeKey)({
|
|
4710
4723
|
driver: this.driver,
|
|
4724
|
+
adbPath: this.adbPath,
|
|
4711
4725
|
scriptDataAppender: this.scriptDataAppender,
|
|
4712
4726
|
platform: this.platform
|
|
4713
4727
|
});
|
|
@@ -4750,6 +4764,7 @@ class ActionExecutor {
|
|
|
4750
4764
|
await (0, isAppInstalled_js_1.IsAppInstalled)({
|
|
4751
4765
|
driver: this.driver,
|
|
4752
4766
|
value,
|
|
4767
|
+
adbPath: this.adbPath,
|
|
4753
4768
|
scriptDataAppender: this.scriptDataAppender,
|
|
4754
4769
|
platform: this.platform
|
|
4755
4770
|
});
|
|
@@ -4778,6 +4793,7 @@ class ActionExecutor {
|
|
|
4778
4793
|
await (0, uninstallAPK_js_1.UninstallAPK)({
|
|
4779
4794
|
driver: this.driver,
|
|
4780
4795
|
value,
|
|
4796
|
+
adbPath: this.adbPath,
|
|
4781
4797
|
scriptDataAppender: this.scriptDataAppender,
|
|
4782
4798
|
platform: this.platform
|
|
4783
4799
|
});
|
|
@@ -4820,6 +4836,7 @@ class ActionExecutor {
|
|
|
4820
4836
|
await (0, openAppWithApkFilePath_js_1.OpenAppWithApkFilePath)({
|
|
4821
4837
|
driver: this.driver,
|
|
4822
4838
|
value,
|
|
4839
|
+
adbPath: this.adbPath,
|
|
4823
4840
|
scriptDataAppender: this.scriptDataAppender,
|
|
4824
4841
|
platform: this.platform
|
|
4825
4842
|
});
|
|
@@ -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 ?
|
|
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)(
|
|
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 ?
|
|
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(
|
|
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
|
-
?
|
|
11
|
-
:
|
|
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
|
-
?
|
|
12
|
-
:
|
|
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)(
|
|
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 ?
|
|
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 ?
|
|
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 ?
|
|
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 () => ({
|
|
@@ -15,12 +15,6 @@ async function verifyAllOptionsAreDeselected(args) {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
logData_js_1.logger.info("All options are deselected.");
|
|
18
|
-
logData_js_1.logger.info("All options deselection verification result:", {
|
|
19
|
-
pagedom: args.pageDOM,
|
|
20
|
-
fireflinkIndex: args.fireflinkIndex,
|
|
21
|
-
elementName: args.elementName,
|
|
22
|
-
xpath: args.selector
|
|
23
|
-
});
|
|
24
18
|
if (result === false) {
|
|
25
19
|
throw new Error("Not all options are deselected.");
|
|
26
20
|
}
|
|
@@ -60,7 +60,7 @@ async function verifyPartialAttributeValue(args) {
|
|
|
60
60
|
elementsData: [{
|
|
61
61
|
name: args.elementName,
|
|
62
62
|
type: args.elementType,
|
|
63
|
-
locators: [{ xpath: args.selector }],
|
|
63
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
64
64
|
platform: args.platform
|
|
65
65
|
}]
|
|
66
66
|
}));
|
|
@@ -21,7 +21,7 @@ async function checkIfElementIsDisplayed(args) {
|
|
|
21
21
|
elementsData: [{
|
|
22
22
|
name: args.elementName,
|
|
23
23
|
type: args.elementType,
|
|
24
|
-
locators: [{ xpath: args.selector }],
|
|
24
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
25
25
|
platform: args.platform
|
|
26
26
|
}]
|
|
27
27
|
}));
|
package/dist/automation/actions/interaction/wait/MOB_WaitTillAttributeOfElementContainsString.js
CHANGED
|
@@ -17,7 +17,7 @@ const MOB_WaitTillAttributeOfElementContainsString = async (args) => {
|
|
|
17
17
|
elementsData: [{
|
|
18
18
|
name: args.elementName,
|
|
19
19
|
type: args.elementType,
|
|
20
|
-
locators: [{ name: "xpath", value: args.selector }],
|
|
20
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
21
21
|
platform: args.platform
|
|
22
22
|
}]
|
|
23
23
|
};
|
|
@@ -23,7 +23,7 @@ async function waitTillAttributeOfElementIsString(args) {
|
|
|
23
23
|
elementsData: [{
|
|
24
24
|
name: args.elementName,
|
|
25
25
|
type: args.elementType,
|
|
26
|
-
locators: [{ xpath: args.selector }],
|
|
26
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
27
27
|
platform: args.platform
|
|
28
28
|
}]
|
|
29
29
|
};
|
|
@@ -20,7 +20,7 @@ async function waitTillElementContainsText(args) {
|
|
|
20
20
|
elementsData: [{
|
|
21
21
|
name: args.elementName,
|
|
22
22
|
type: args.elementType,
|
|
23
|
-
locators: [{ xpath: args.selector }],
|
|
23
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
24
24
|
platform: args.platform
|
|
25
25
|
}]
|
|
26
26
|
};
|
|
@@ -21,7 +21,7 @@ async function waitTillElementIsClickable(args) {
|
|
|
21
21
|
elementsData: [{
|
|
22
22
|
name: args.elementName,
|
|
23
23
|
type: args.elementType,
|
|
24
|
-
locators: [{ xpath: args.selector }],
|
|
24
|
+
locators: [{ "name": "xpath", "value": args.selector }],
|
|
25
25
|
platform: args.platform
|
|
26
26
|
}]
|
|
27
27
|
};
|
|
@@ -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;
|
|
@@ -56,9 +56,10 @@ class MobileSession {
|
|
|
56
56
|
}
|
|
57
57
|
throw new Error(`ADB execution failed: ${output}`, { cause: error });
|
|
58
58
|
}
|
|
59
|
+
const startTime = Date.now();
|
|
59
60
|
this.driver = this.isCloud
|
|
60
61
|
? await this.cloudSessionInstances.initialize() : await this.openApp({ capabilities: arg.capabilities });
|
|
61
|
-
logData_js_1.logger.info(`Application
|
|
62
|
+
logData_js_1.logger.info(`Application started total time taken: ${Date.now() - startTime} ms`);
|
|
62
63
|
}
|
|
63
64
|
async close() {
|
|
64
65
|
if (this.driver) {
|
|
@@ -21,7 +21,7 @@ export interface IPayload {
|
|
|
21
21
|
userId: string;
|
|
22
22
|
projectType: string;
|
|
23
23
|
tokensConsumed?: number;
|
|
24
|
-
|
|
24
|
+
error?: IErrorInfo;
|
|
25
25
|
}
|
|
26
26
|
export interface IFireFlinkApiService {
|
|
27
27
|
getInstancesDetailsApi(headers: Record<string, string>, url: string): Promise<any>;
|
|
@@ -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: [],
|
|
@@ -50,15 +50,15 @@ function createActionHandlers(context) {
|
|
|
50
50
|
"appium:ignoreUnimportantViews": false,
|
|
51
51
|
"appium:disableAndroidWatcher": true,
|
|
52
52
|
"appium:disableWindowAnimation": true,
|
|
53
|
-
"appium:uiautomator2ServerLaunchTimeout":
|
|
54
|
-
"appium:uiautomator2ServerReadTimeout":
|
|
55
|
-
"appium:waitForIdleTimeout":
|
|
56
|
-
"appium:waitForIdlePollingInterval":
|
|
57
|
-
"appium:waitForSelectorTimeout":
|
|
53
|
+
"appium:uiautomator2ServerLaunchTimeout": 5000,
|
|
54
|
+
"appium:uiautomator2ServerReadTimeout": 5000,
|
|
55
|
+
"appium:waitForIdleTimeout": 5000,
|
|
56
|
+
"appium:waitForIdlePollingInterval": 5000,
|
|
57
|
+
"appium:waitForSelectorTimeout": 5000,
|
|
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: [],
|
|
@@ -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;
|
|
@@ -529,11 +529,18 @@ class AutomationRunner {
|
|
|
529
529
|
}
|
|
530
530
|
catch (error) {
|
|
531
531
|
logData_js_1.logger.error(`Error executing step "${step}":`, error);
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
errorInfo.error
|
|
532
|
+
if (error.error === "Context Length Exceeded (400)" ||
|
|
533
|
+
error.error === "Rate Limit Exceeded (429)") {
|
|
534
|
+
errorInfo.error = error.error;
|
|
535
|
+
errorInfo.errorDescription = error.errorDescription;
|
|
536
|
+
if (context.scriptAppender.getErrorNLP()) {
|
|
537
|
+
errorInfo.nlp = context.scriptAppender.getErrorNLP();
|
|
538
|
+
}
|
|
539
|
+
errorInfo.erroredManualStep = step;
|
|
540
|
+
errorInfo.rawError = logData_js_1.logger.getError(error);
|
|
535
541
|
break;
|
|
536
542
|
}
|
|
543
|
+
errorInfo = (await stepProcessor.getLLMResponse({ platform: platform, type: promptType_js_1.PromptType.ERROR_DESCRIPTION, args: {}, input: { error: logData_js_1.logger.getError(error) } })).response;
|
|
537
544
|
if (context.scriptAppender.getErrorNLP()) {
|
|
538
545
|
errorInfo.nlp = context.scriptAppender.getErrorNLP();
|
|
539
546
|
}
|
|
@@ -559,7 +566,9 @@ class AutomationRunner {
|
|
|
559
566
|
userId: request.userId,
|
|
560
567
|
projectType: request.projectType,
|
|
561
568
|
tokensConsumed: (await stepProcessor.getResultTokenUsage()).totalTokens,
|
|
562
|
-
...(errorInfo && Object.keys(errorInfo).length > 0
|
|
569
|
+
...(errorInfo && Object.keys(errorInfo).length > 0
|
|
570
|
+
? { error: errorInfo }
|
|
571
|
+
: {})
|
|
563
572
|
};
|
|
564
573
|
try {
|
|
565
574
|
await context.scriptAppender.waitForAllSteps();
|
|
@@ -22,7 +22,7 @@ exports.sameActionHelper = {
|
|
|
22
22
|
MOB_GetDriverInstance: "GetDriverInstance",
|
|
23
23
|
MOB_GetCurrentWindowHandle: "GetCurrentWindowHandle",
|
|
24
24
|
MOB_GetTagName: "GetTagName",
|
|
25
|
-
|
|
25
|
+
MOB_GetScreenshotOfElement: "GetScreenshotAs",
|
|
26
26
|
MOB_GetX: "GetXLocationOfWebElement",
|
|
27
27
|
MOB_GetLocation: "GetLocation",
|
|
28
28
|
MOB_GetY: "GetYLocationOfWebElement",
|