ff-automationv2 2.2.29 → 2.2.30
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 +49 -13
- package/dist/ai/llmcalls/parseLlmOputput.js +5 -5
- package/dist/ai/llmprompts/promptRegistry.js +4 -0
- package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +39 -11
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.js +6 -6
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +32 -0
- package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +17 -8
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.d.ts +1 -0
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +22 -0
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.js +3 -1
- package/dist/ai/llmprompts/systemPrompts/visionPrompt.js +14 -6
- package/dist/ai/llmprompts/systemPrompts/visionPromptMobile.js +3 -0
- package/dist/ai/llmprompts/userPrompts/userPrompt.js +1 -0
- package/dist/automation/actions/executor.d.ts +4 -0
- package/dist/automation/actions/executor.js +20 -0
- package/dist/automation/actions/interaction/clear/clear.js +1 -1
- package/dist/automation/actions/interaction/clear/clearAndEnter.js +1 -1
- package/dist/automation/actions/interaction/click/click.js +10 -3
- package/dist/automation/actions/interaction/click/clickNtimes.js +1 -1
- package/dist/automation/actions/interaction/click/doubleClick.js +1 -1
- package/dist/automation/actions/interaction/click/rightClick.js +1 -1
- package/dist/automation/actions/interaction/elementlessActions/getOtp.d.ts +2 -0
- package/dist/automation/actions/interaction/elementlessActions/getOtp.js +101 -0
- package/dist/automation/actions/interaction/enterActions/enterInput.js +11 -6
- package/dist/automation/actions/interaction/enterActions/enterInputAndPress.js +2 -2
- package/dist/automation/actions/interaction/enterActions/enterusingJs.js +2 -2
- package/dist/automation/actions/interaction/enterActions/waitAndEnter.js +1 -1
- package/dist/automation/actions/interaction/upload/uploadfile.js +1 -1
- package/dist/automation/actions/interaction/verify/VerifyNavigateURL.js +38 -11
- package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +12 -0
- package/dist/automation/actions/interface/FireFlinkResponseSchema.js +19 -3
- package/dist/automation/actions/interface/getOtpInterface.d.ts +15 -0
- package/dist/automation/actions/interface/getOtpInterface.js +2 -0
- package/dist/automation/browserSession/initiateBrowserSession.d.ts +1 -1
- package/dist/automation/browserSession/initiateBrowserSession.js +15 -7
- package/dist/automation/driverState.d.ts +2 -0
- package/dist/automation/driverState.js +4 -0
- package/dist/automation/mobileSession/initiateMobileSession.d.ts +4 -5
- package/dist/automation/mobileSession/initiateMobileSession.js +83 -19
- package/dist/core/constants/allAction.js +5 -1
- package/dist/core/constants/supportedActions.js +5 -2
- package/dist/core/interfaces/actionInterface.d.ts +4 -0
- package/dist/core/interfaces/browserConfigurationInterface.d.ts +0 -4
- package/dist/core/interfaces/browserConfigurationInterface.js +0 -1
- package/dist/core/interfaces/executionDetails.d.ts +6 -3
- package/dist/core/interfaces/fireflinkScriptPayloadInterface.d.ts +22 -16
- package/dist/core/interfaces/llmResponseInterface.d.ts +1 -0
- package/dist/core/interfaces/promptInterface.d.ts +1 -0
- package/dist/core/main/SessionManager.d.ts +9 -0
- package/dist/core/main/SessionManager.js +23 -0
- package/dist/core/main/actionHandlerFactory.js +261 -64
- package/dist/core/main/executionContext.d.ts +7 -1
- package/dist/core/main/executionContext.js +93 -3
- package/dist/core/main/runAutomationScript.d.ts +1 -0
- package/dist/core/main/runAutomationScript.js +912 -304
- package/dist/core/main/stepProcessor.js +7 -2
- package/dist/core/types/browserType.d.ts +3 -3
- package/dist/core/types/browserType.js +2 -2
- package/dist/core/types/messageType.d.ts +13 -0
- package/dist/core/types/messageType.js +15 -0
- package/dist/core/types/promptType.d.ts +2 -1
- package/dist/core/types/promptType.js +1 -0
- package/dist/domAnalysis/searchBest.js +15 -16
- package/dist/domAnalysis/simplifyAndFlatten.js +6 -4
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.d.ts +3 -0
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.js +23 -15
- package/dist/fireflinkData/fireflinkLocators/parser/getElementsFromHTML.d.ts +3 -3
- package/dist/fireflinkData/fireflinkLocators/parser/getElementsFromHTML.js +134 -118
- package/dist/fireflinkData/fireflinkLocators/types/locator.d.ts +11 -1
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.d.ts +1 -1
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.js +35 -9
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.d.ts +10 -10
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.js +56 -59
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.d.ts +1 -1
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.js +53 -29
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.d.ts +8 -8
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.js +113 -190
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.d.ts +17 -26
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.js +314 -786
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.d.ts +68 -70
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.js +498 -517
- package/dist/fireflinkData/fireflinkScript/appendScriptData.d.ts +1 -1
- package/dist/fireflinkData/fireflinkScript/appendScriptData.js +5 -8
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.d.ts +2 -2
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.js +17 -27
- package/dist/llmConfig/llmConfiguration.js +13 -6
- package/dist/service/api/fireflinkApi.service.d.ts +1 -1
- package/dist/service/api/fireflinkApi.service.js +1 -2
- package/dist/service/fireflink.service.d.ts +3 -3
- package/dist/service/fireflink.service.js +23 -21
- package/dist/service/kafka/fireflinkKafka.service.d.ts +1 -2
- package/dist/service/kafka/fireflinkKafka.service.js +6 -4
- package/dist/tests/test12.d.ts +0 -1
- package/dist/tests/test12.js +65 -78
- package/dist/tests/testkaf.d.ts +0 -1
- package/dist/tests/testkaf.js +51 -55
- package/dist/utils/InstancesDetails/getInstancesInfo.js +1 -1
- package/dist/utils/browserCap/capability.d.ts +5 -1
- package/dist/utils/browserCap/capability.js +91 -15
- package/dist/utils/helpers/domSanitizer.d.ts +1 -0
- package/dist/utils/helpers/domSanitizer.js +9 -0
- package/dist/utils/helpers/enterActionHelper.js +23 -4
- package/dist/utils/helpers/xpathcreation.js +2 -2
- package/dist/utils/javascript/jsFindElement.d.ts +1 -1
- package/dist/utils/javascript/jsFindElement.js +2 -2
- package/dist/utils/newTab/newTabTracker.js +18 -6
- package/dist/utils/workers/LocatorWorkerInterface.d.ts +22 -0
- package/dist/utils/workers/LocatorWorkerInterface.js +2 -0
- package/dist/utils/workers/LocatorWorkerPool.d.ts +13 -0
- package/dist/utils/workers/LocatorWorkerPool.js +89 -0
- package/dist/utils/workers/locatorWorker.d.ts +1 -0
- package/dist/utils/workers/locatorWorker.js +44 -0
- package/package.json +3 -1
|
@@ -32,15 +32,16 @@ async function click(args) {
|
|
|
32
32
|
case "web":
|
|
33
33
|
default:
|
|
34
34
|
try {
|
|
35
|
-
|
|
35
|
+
let element = await args.driver.$(args.selector);
|
|
36
36
|
let jsClick = false;
|
|
37
37
|
await args.driver.execute((el) => {
|
|
38
38
|
el.scrollIntoView({
|
|
39
39
|
block: "center",
|
|
40
|
-
inline: "
|
|
40
|
+
inline: "nearest"
|
|
41
41
|
});
|
|
42
42
|
}, element);
|
|
43
43
|
try {
|
|
44
|
+
element = await args.driver.$(args.selector);
|
|
44
45
|
await element.click();
|
|
45
46
|
}
|
|
46
47
|
catch (clickError) {
|
|
@@ -57,7 +58,13 @@ async function click(args) {
|
|
|
57
58
|
}, element);
|
|
58
59
|
}
|
|
59
60
|
catch (innerError) {
|
|
60
|
-
|
|
61
|
+
if (String(jsError?.message || jsError).includes("stale")) {
|
|
62
|
+
logData_js_1.logger.info(`stale element error : ${String(jsError?.message || jsError).slice(0, 50)}`);
|
|
63
|
+
jsClick = false;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
throw new Error("cause", { cause: innerError });
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
}
|
|
63
70
|
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOtpAction = GetOtpAction;
|
|
4
|
+
const logData_js_1 = require("../../../../utils/logger/logData.js");
|
|
5
|
+
const child_process_1 = require("child_process");
|
|
6
|
+
const appendScriptData_js_1 = require("../../../../fireflinkData/fireflinkScript/appendScriptData.js");
|
|
7
|
+
async function GetOtpAction(args) {
|
|
8
|
+
try {
|
|
9
|
+
const udid = args.driver.capabilities["appium:udid"] || args.driver.capabilities.udid;
|
|
10
|
+
const cmdPrefix = udid
|
|
11
|
+
? `${args.adbPath} -s ${udid} shell`
|
|
12
|
+
: `${args.adbPath} shell`;
|
|
13
|
+
const packageName = (0, child_process_1.execSync)(`${cmdPrefix} cmd role get-role-holders android.app.role.SMS`.trim(), { encoding: "utf8" });
|
|
14
|
+
logData_js_1.logger.info("the default app is ", packageName);
|
|
15
|
+
const expectedHeader = args.selector.trim().toLowerCase();
|
|
16
|
+
const getLatestMatchingSms = () => {
|
|
17
|
+
const inboxSms = (0, child_process_1.execSync)(`${cmdPrefix} "content query --uri content://sms/inbox --projection _id:date:address:body --sort 'date DESC'"`, { encoding: "utf8" }).trim();
|
|
18
|
+
const messages = [...inboxSms.matchAll(/(?:^|\r?\n)Row:\s*\d+\s+_id=(\d+),\s*date=(\d+),\s*address=(.*?),\s*body=(.*?)(?=\r?\nRow:|$)/gs)]
|
|
19
|
+
.map((match) => ({
|
|
20
|
+
id: match[1],
|
|
21
|
+
date: Number(match[2]),
|
|
22
|
+
address: match[3].trim(),
|
|
23
|
+
body: match[4].trim()
|
|
24
|
+
})).slice(0, 5);
|
|
25
|
+
return messages.find((message) => message.address.toLowerCase().includes(expectedHeader));
|
|
26
|
+
};
|
|
27
|
+
const existingSms = getLatestMatchingSms();
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
if (existingSms && now - existingSms.date <= (Number(args.timeFrom) * 1000)) {
|
|
30
|
+
const smsBody = existingSms.body;
|
|
31
|
+
logData_js_1.logger.info("SMS body:", smsBody);
|
|
32
|
+
let regex;
|
|
33
|
+
if (args.otpExtractor) {
|
|
34
|
+
const otpResult = await args.otpExtractor(smsBody);
|
|
35
|
+
if (otpResult?.otp && otpResult.regex) {
|
|
36
|
+
regex = otpResult.regex;
|
|
37
|
+
logData_js_1.logger.info("Extracted OTP:", otpResult.otp, "Generated Regex:", otpResult.regex);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
logData_js_1.logger.info("LLM could not find an OTP in the SMS body.");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
(0, appendScriptData_js_1.appendScriptData)({
|
|
44
|
+
scriptDataAppender: args.scriptDataAppender,
|
|
45
|
+
nlpName: "MOB_FetchOtpFromMessages",
|
|
46
|
+
stepInputs: [existingSms.address, args.timeFrom, args.waitTime],
|
|
47
|
+
platform: args.platform
|
|
48
|
+
});
|
|
49
|
+
(0, appendScriptData_js_1.appendScriptData)({
|
|
50
|
+
scriptDataAppender: args.scriptDataAppender,
|
|
51
|
+
nlpName: "StringSubStringUsingRegex",
|
|
52
|
+
stepInputs: [smsBody, regex],
|
|
53
|
+
platform: args.platform
|
|
54
|
+
});
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const baselineId = existingSms?.id;
|
|
58
|
+
const pollingStartedAt = now;
|
|
59
|
+
const pollingDeadline = pollingStartedAt + (Number(args.waitTime) * 1000);
|
|
60
|
+
while (Date.now() < pollingDeadline) {
|
|
61
|
+
const latestSms = getLatestMatchingSms();
|
|
62
|
+
if (latestSms &&
|
|
63
|
+
latestSms.id !== baselineId &&
|
|
64
|
+
latestSms.date >= pollingStartedAt) {
|
|
65
|
+
const smsBody = latestSms.body;
|
|
66
|
+
logData_js_1.logger.info("SMS body:", smsBody);
|
|
67
|
+
let regex;
|
|
68
|
+
if (args.otpExtractor) {
|
|
69
|
+
const otpResult = await args.otpExtractor(smsBody);
|
|
70
|
+
if (otpResult?.otp && otpResult.regex) {
|
|
71
|
+
regex = otpResult.regex;
|
|
72
|
+
regex = regex.replace(/\\+/g, "\\");
|
|
73
|
+
logData_js_1.logger.info("Extracted OTP:", otpResult.otp, "Generated Regex:", otpResult.regex);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
logData_js_1.logger.error("LLM could not find an OTP in the SMS body.");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
(0, appendScriptData_js_1.appendScriptData)({
|
|
80
|
+
scriptDataAppender: args.scriptDataAppender,
|
|
81
|
+
nlpName: "MOB_FetchOtpFromMessages",
|
|
82
|
+
stepInputs: [latestSms.address, args.timeFrom, args.waitTime],
|
|
83
|
+
platform: args.platform
|
|
84
|
+
});
|
|
85
|
+
(0, appendScriptData_js_1.appendScriptData)({
|
|
86
|
+
scriptDataAppender: args.scriptDataAppender,
|
|
87
|
+
nlpName: "StringSubStringUsingRegex",
|
|
88
|
+
stepInputs: [smsBody, regex],
|
|
89
|
+
platform: args.platform
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Timed out waiting up to 60 seconds for an SMS with header: ${args.selector}`);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
args.scriptDataAppender.setErrorNLP("getOtp");
|
|
99
|
+
throw new Error("GettingOtp action failed", { cause: error });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -54,10 +54,15 @@ async function enterInput(args) {
|
|
|
54
54
|
await element.setValue(args.value);
|
|
55
55
|
}
|
|
56
56
|
if (args.platform === "android") {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
try {
|
|
58
|
+
const text = await element.getAttribute("text");
|
|
59
|
+
if (text !== args.value) {
|
|
60
|
+
const { execSync } = await Promise.resolve().then(() => __importStar(require("child_process")));
|
|
61
|
+
execSync(`${args.adbPath} shell input text ${args.value}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
logData_js_1.logger.info("Next step is enter, sending input with newline");
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
const ffElementNumber = `Fire-Flink-${ffNumber}`;
|
|
@@ -87,7 +92,7 @@ async function enterInput(args) {
|
|
|
87
92
|
await args.driver.execute((el) => {
|
|
88
93
|
el.scrollIntoView({
|
|
89
94
|
block: "center",
|
|
90
|
-
inline: "
|
|
95
|
+
inline: "nearest"
|
|
91
96
|
});
|
|
92
97
|
}, element);
|
|
93
98
|
await element.addValue(args.value);
|
|
@@ -101,7 +106,7 @@ async function enterInput(args) {
|
|
|
101
106
|
ffNumber: ffElementNumber,
|
|
102
107
|
elementName: args.elementName,
|
|
103
108
|
elementType: args.elementType,
|
|
104
|
-
selector:
|
|
109
|
+
selector: xpathPath,
|
|
105
110
|
platform: args.platform
|
|
106
111
|
});
|
|
107
112
|
}
|
|
@@ -70,7 +70,7 @@ async function enterInputAndPress(args) {
|
|
|
70
70
|
await args.driver.execute((el) => {
|
|
71
71
|
el.scrollIntoView({
|
|
72
72
|
block: "center",
|
|
73
|
-
inline: "
|
|
73
|
+
inline: "nearest"
|
|
74
74
|
});
|
|
75
75
|
}, element);
|
|
76
76
|
if (inputValue) {
|
|
@@ -104,7 +104,7 @@ async function enterInputAndPress(args) {
|
|
|
104
104
|
ffNumber: ffElementNumber,
|
|
105
105
|
elementName: args.elementName,
|
|
106
106
|
elementType: args.elementType,
|
|
107
|
-
selector:
|
|
107
|
+
selector: xpathPath,
|
|
108
108
|
platform: args.platform
|
|
109
109
|
});
|
|
110
110
|
}
|
|
@@ -12,7 +12,7 @@ async function enterInputUsingJs(args) {
|
|
|
12
12
|
await args.driver.execute((el) => {
|
|
13
13
|
el.scrollIntoView({
|
|
14
14
|
block: "center",
|
|
15
|
-
inline: "
|
|
15
|
+
inline: "nearest"
|
|
16
16
|
});
|
|
17
17
|
}, element);
|
|
18
18
|
await element.addValue(args.value);
|
|
@@ -26,7 +26,7 @@ async function enterInputUsingJs(args) {
|
|
|
26
26
|
ffNumber: ffElementNumber,
|
|
27
27
|
elementName: args.elementName,
|
|
28
28
|
elementType: args.elementType,
|
|
29
|
-
selector:
|
|
29
|
+
selector: xpathPath,
|
|
30
30
|
platform: args.platform
|
|
31
31
|
});
|
|
32
32
|
}
|
|
@@ -3,27 +3,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.verifyNavigateUrl = verifyNavigateUrl;
|
|
4
4
|
const logData_js_1 = require("../../../../utils/logger/logData.js");
|
|
5
5
|
const appendScriptData_js_1 = require("../../../../fireflinkData/fireflinkScript/appendScriptData.js");
|
|
6
|
+
function canonicalize(raw) {
|
|
7
|
+
const url = new URL(raw.includes("://") ? raw : `https://${raw}`);
|
|
8
|
+
const host = url.hostname.toLowerCase().replace(/^www\./, "");
|
|
9
|
+
const pathname = url.pathname.length > 1
|
|
10
|
+
? url.pathname.replace(/\/+$/, "")
|
|
11
|
+
: url.pathname;
|
|
12
|
+
return {
|
|
13
|
+
protocol: url.protocol,
|
|
14
|
+
host,
|
|
15
|
+
pathname,
|
|
16
|
+
search: url.search,
|
|
17
|
+
hash: url.hash,
|
|
18
|
+
port: url.port
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function urlsLookTheSame(expected, actual) {
|
|
22
|
+
const a = canonicalize(expected);
|
|
23
|
+
const b = canonicalize(actual);
|
|
24
|
+
return (a.protocol === b.protocol &&
|
|
25
|
+
a.host === b.host &&
|
|
26
|
+
a.pathname === b.pathname &&
|
|
27
|
+
a.search === b.search &&
|
|
28
|
+
a.port === b.port &&
|
|
29
|
+
a.hash === b.hash);
|
|
30
|
+
}
|
|
6
31
|
async function verifyNavigateUrl(args) {
|
|
7
32
|
try {
|
|
8
33
|
const expectedUrl = args.value.trim();
|
|
9
34
|
const actualUrl = await args.driver.getUrl();
|
|
10
|
-
const isMatched = actualUrl
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
const isMatched = urlsLookTheSame(expectedUrl, actualUrl);
|
|
36
|
+
if (!isMatched) {
|
|
37
|
+
logData_js_1.logger.info("Navigate URL verification result:", {
|
|
38
|
+
isMatched,
|
|
39
|
+
actualUrl,
|
|
40
|
+
expectedUrl
|
|
41
|
+
});
|
|
17
42
|
throw new Error(`Current URL does not match expected. Expected: ${expectedUrl}, Actual: ${actualUrl}`);
|
|
18
43
|
}
|
|
19
44
|
(0, appendScriptData_js_1.appendScriptData)({
|
|
20
45
|
scriptDataAppender: args.scriptDataAppender,
|
|
21
|
-
nlpName: "
|
|
22
|
-
stepInputs: [
|
|
46
|
+
nlpName: "VerifyNavigateURL",
|
|
47
|
+
stepInputs: [actualUrl]
|
|
23
48
|
});
|
|
24
49
|
}
|
|
25
50
|
catch (error) {
|
|
26
|
-
args.scriptDataAppender.setErrorNLP("
|
|
27
|
-
throw new Error(
|
|
51
|
+
args.scriptDataAppender.setErrorNLP("VerifyNavigateURL");
|
|
52
|
+
throw new Error("VerifyNavigateURL action failed", {
|
|
53
|
+
cause: error
|
|
54
|
+
});
|
|
28
55
|
}
|
|
29
56
|
}
|
|
@@ -3,6 +3,7 @@ export declare const KeywordSchema: z.ZodObject<{
|
|
|
3
3
|
keywords: z.ZodArray<z.ZodString>;
|
|
4
4
|
elementName: z.ZodString;
|
|
5
5
|
action: z.ZodString;
|
|
6
|
+
liveLog: z.ZodString;
|
|
6
7
|
}, z.core.$strip>;
|
|
7
8
|
export declare const AlertShema: z.ZodObject<{
|
|
8
9
|
action: z.ZodString;
|
|
@@ -115,6 +116,13 @@ export declare const ClearTextActionSchema: z.ZodObject<{
|
|
|
115
116
|
inputText: z.ZodString;
|
|
116
117
|
elementType: z.ZodString;
|
|
117
118
|
}, z.core.$strip>;
|
|
119
|
+
export declare const GetOtpActionSchema: z.ZodObject<{
|
|
120
|
+
nlpName: z.ZodString;
|
|
121
|
+
inputText: z.ZodString;
|
|
122
|
+
timeFrom: z.ZodString;
|
|
123
|
+
waitTime: z.ZodString;
|
|
124
|
+
activity: z.ZodString;
|
|
125
|
+
}, z.core.$strip>;
|
|
118
126
|
export declare const UploadActionSchema: z.ZodObject<{
|
|
119
127
|
attributeValue: z.ZodString;
|
|
120
128
|
action: z.ZodString;
|
|
@@ -145,4 +153,8 @@ export declare const ErrorDescriptionSchema: z.ZodObject<{
|
|
|
145
153
|
error: z.ZodString;
|
|
146
154
|
errorDescription: z.ZodString;
|
|
147
155
|
}, z.core.$strip>;
|
|
156
|
+
export declare const OtpExtractorSchema: z.ZodObject<{
|
|
157
|
+
otp: z.ZodString;
|
|
158
|
+
regex: z.ZodString;
|
|
159
|
+
}, z.core.$strip>;
|
|
148
160
|
export declare function getSchemaForPrompt(type: string, platform: string, args?: any): any;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ErrorDescriptionSchema = exports.UserStorySchema = exports.VisionSchema = exports.DefaultInteractionSchema = exports.MouseActionSchema = exports.UploadActionSchema = exports.ClearTextActionSchema = exports.EnterActionSchema = exports.TapActionSchema = exports.ClickActionSchema = exports.SwitchActionSchema = exports.MobileScrollSchema = exports.WebScrollSchema = exports.DragDropActionSchema = exports.MobileCombinedSchema = exports.CombinedActionSchema = exports.WaitActionSchema = exports.MobileGetSchema = exports.MobileVerifySchema = exports.WebGetSchema = exports.WebVerifySchema = exports.AlertShema = exports.KeywordSchema = void 0;
|
|
3
|
+
exports.OtpExtractorSchema = exports.ErrorDescriptionSchema = exports.UserStorySchema = exports.VisionSchema = exports.DefaultInteractionSchema = exports.MouseActionSchema = exports.UploadActionSchema = exports.GetOtpActionSchema = exports.ClearTextActionSchema = exports.EnterActionSchema = exports.TapActionSchema = exports.ClickActionSchema = exports.SwitchActionSchema = exports.MobileScrollSchema = exports.WebScrollSchema = exports.DragDropActionSchema = exports.MobileCombinedSchema = exports.CombinedActionSchema = exports.WaitActionSchema = exports.MobileGetSchema = exports.MobileVerifySchema = exports.WebGetSchema = exports.WebVerifySchema = exports.AlertShema = exports.KeywordSchema = void 0;
|
|
4
4
|
exports.getSchemaForPrompt = getSchemaForPrompt;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const promptType_js_1 = require("../../../core/types/promptType.js");
|
|
@@ -8,6 +8,7 @@ exports.KeywordSchema = zod_1.z.object({
|
|
|
8
8
|
keywords: zod_1.z.array(zod_1.z.string()),
|
|
9
9
|
elementName: zod_1.z.string(),
|
|
10
10
|
action: zod_1.z.string(),
|
|
11
|
+
liveLog: zod_1.z.string()
|
|
11
12
|
});
|
|
12
13
|
exports.AlertShema = zod_1.z.object({
|
|
13
14
|
action: zod_1.z.string(),
|
|
@@ -120,6 +121,13 @@ exports.ClearTextActionSchema = zod_1.z.object({
|
|
|
120
121
|
inputText: zod_1.z.string(),
|
|
121
122
|
elementType: zod_1.z.string(),
|
|
122
123
|
});
|
|
124
|
+
exports.GetOtpActionSchema = zod_1.z.object({
|
|
125
|
+
nlpName: zod_1.z.string(),
|
|
126
|
+
inputText: zod_1.z.string(),
|
|
127
|
+
timeFrom: zod_1.z.string(),
|
|
128
|
+
waitTime: zod_1.z.string(),
|
|
129
|
+
activity: zod_1.z.string(),
|
|
130
|
+
});
|
|
123
131
|
exports.UploadActionSchema = zod_1.z.object({
|
|
124
132
|
attributeValue: zod_1.z.string(),
|
|
125
133
|
action: zod_1.z.string(),
|
|
@@ -150,6 +158,10 @@ exports.ErrorDescriptionSchema = zod_1.z.object({
|
|
|
150
158
|
error: zod_1.z.string(),
|
|
151
159
|
errorDescription: zod_1.z.string(),
|
|
152
160
|
});
|
|
161
|
+
exports.OtpExtractorSchema = zod_1.z.object({
|
|
162
|
+
otp: zod_1.z.string(),
|
|
163
|
+
regex: zod_1.z.string()
|
|
164
|
+
});
|
|
153
165
|
const schemaMap = {
|
|
154
166
|
[promptType_js_1.PromptType.KEYWORD_EXTRACTOR]: exports.KeywordSchema,
|
|
155
167
|
[promptType_js_1.PromptType.VISION_PROMPT]: exports.VisionSchema,
|
|
@@ -157,6 +169,7 @@ const schemaMap = {
|
|
|
157
169
|
[promptType_js_1.PromptType.ERROR_DESCRIPTION]: exports.ErrorDescriptionSchema,
|
|
158
170
|
[promptType_js_1.PromptType.WAIT_ACTION_EXTRACTOR_PROMPT]: exports.WaitActionSchema,
|
|
159
171
|
[promptType_js_1.PromptType.COMBINED_ACTION_EXTRACTOR_PROMPT]: exports.CombinedActionSchema,
|
|
172
|
+
[promptType_js_1.PromptType.OTP_EXTRACTOR]: exports.OtpExtractorSchema,
|
|
160
173
|
};
|
|
161
174
|
function getSchemaForPrompt(type, platform, args) {
|
|
162
175
|
let schemaToUse = schemaMap[type];
|
|
@@ -189,8 +202,11 @@ function getSchemaForPrompt(type, platform, args) {
|
|
|
189
202
|
else if (inspectArgs?.stepAction === "tap") {
|
|
190
203
|
schemaToUse = exports.TapActionSchema;
|
|
191
204
|
}
|
|
192
|
-
else if (inspectArgs?.stepAction === "enter") {
|
|
193
|
-
schemaToUse = exports.EnterActionSchema;
|
|
205
|
+
else if (inspectArgs?.stepAction === "enter" || inspectArgs?.stepAction === "enterOtp") {
|
|
206
|
+
schemaToUse = platform === "web" ? exports.EnterActionSchema : exports.TapActionSchema;
|
|
207
|
+
}
|
|
208
|
+
else if (inspectArgs?.stepAction === "getOtp") {
|
|
209
|
+
schemaToUse = exports.GetOtpActionSchema;
|
|
194
210
|
}
|
|
195
211
|
else if (inspectArgs?.stepAction === "cleartext") {
|
|
196
212
|
schemaToUse = exports.ClearTextActionSchema;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ScriptDataAppender } from "../../../fireflinkData/fireflinkScript/scriptGenrationData.js";
|
|
2
|
+
export interface GetOtpInterface {
|
|
3
|
+
driver: WebdriverIO.Browser;
|
|
4
|
+
scriptDataAppender: ScriptDataAppender;
|
|
5
|
+
platform: string;
|
|
6
|
+
adbPath?: string;
|
|
7
|
+
selector: string;
|
|
8
|
+
timeFrom: string;
|
|
9
|
+
waitTime: string;
|
|
10
|
+
activity: string;
|
|
11
|
+
otpExtractor?: (smsBody: string) => Promise<{
|
|
12
|
+
otp: string;
|
|
13
|
+
regex: string;
|
|
14
|
+
} | null>;
|
|
15
|
+
}
|
|
@@ -8,7 +8,7 @@ export declare class BrowserSession {
|
|
|
8
8
|
private isCloud;
|
|
9
9
|
constructor(browserName: BrowserId, isCloud: boolean | undefined, capabilities: Record<string, any> | undefined, pageLoad: number, CloudConfig: CloudConfig | undefined);
|
|
10
10
|
private openBrowser;
|
|
11
|
-
open(path?: string, profile?: string): Promise<void>;
|
|
11
|
+
open(path?: string, profile?: string, customCaps?: string[]): Promise<void>;
|
|
12
12
|
close(): Promise<void>;
|
|
13
13
|
getCurrentDriver(): Promise<WebdriverIO.Browser>;
|
|
14
14
|
}
|
|
@@ -12,10 +12,10 @@ class BrowserSession {
|
|
|
12
12
|
this.isCloud = isCloud;
|
|
13
13
|
this.cloudSessionInstances = new initiateCloudSession_js_1.CloudSession(capabilities, CloudConfig);
|
|
14
14
|
}
|
|
15
|
-
async openBrowser(path, profile) {
|
|
15
|
+
async openBrowser(path, profile, customCaps) {
|
|
16
16
|
try {
|
|
17
17
|
const driver = await (0, webdriverio_1.remote)({
|
|
18
|
-
capabilities: (0, capability_js_1.getCapabilities)(this.browserName, path, profile),
|
|
18
|
+
capabilities: (0, capability_js_1.getCapabilities)(this.browserName, path, profile, customCaps),
|
|
19
19
|
logLevel: "silent"
|
|
20
20
|
});
|
|
21
21
|
driver.setTimeout({ 'pageLoad': this.pageLoad });
|
|
@@ -29,15 +29,23 @@ class BrowserSession {
|
|
|
29
29
|
throw new Error("Browser failed to open", { cause: error });
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
async open(path, profile) {
|
|
32
|
+
async open(path, profile, customCaps) {
|
|
33
33
|
this.driver = this.isCloud
|
|
34
34
|
? await this.cloudSessionInstances.initialize()
|
|
35
|
-
: await this.openBrowser(path, profile);
|
|
35
|
+
: await this.openBrowser(path, profile, customCaps);
|
|
36
36
|
}
|
|
37
37
|
async close() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
try {
|
|
39
|
+
if (this.driver) {
|
|
40
|
+
await this.driver.deleteSession();
|
|
41
|
+
this.driver = null;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
throw new Error("Browser not initialized");
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
throw new Error("Browser failed to close", { cause: error });
|
|
41
49
|
}
|
|
42
50
|
}
|
|
43
51
|
async getCurrentDriver() {
|
|
@@ -23,7 +23,7 @@ export interface IIOSCapabilities {
|
|
|
23
23
|
"appium:deviceName": string;
|
|
24
24
|
"appium:udid": string;
|
|
25
25
|
"appium:automationName": "XCUITest";
|
|
26
|
-
"appium:bundleId"
|
|
26
|
+
"appium:bundleId"?: string;
|
|
27
27
|
"appium:shouldUseCompactResponses"?: boolean;
|
|
28
28
|
"appium:waitForQuiescence"?: boolean;
|
|
29
29
|
"appium:wdaLaunchTimeout"?: number;
|
|
@@ -45,15 +45,14 @@ export declare class MobileSession {
|
|
|
45
45
|
private driver;
|
|
46
46
|
private appiumPort;
|
|
47
47
|
private currentAppPackage;
|
|
48
|
+
private deviceId;
|
|
48
49
|
private cloudSessionInstances;
|
|
49
50
|
private isCloud;
|
|
50
51
|
private adbPath;
|
|
51
52
|
constructor(appiumPort: number, isCloud: boolean | undefined, capabilities: Record<string, string | boolean> | undefined, CloudConfig: CloudConfig | undefined, adbPath: string | undefined);
|
|
52
53
|
private openApp;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
keywords: string[];
|
|
56
|
-
}): Promise<void>;
|
|
54
|
+
createDriver(capabilities: IMobileCapabilities): Promise<void>;
|
|
55
|
+
launchApp(appPackage?: string, appActivity?: string): Promise<void>;
|
|
57
56
|
close(): Promise<void>;
|
|
58
57
|
getCurrentDriver(): Promise<WebdriverIO.Browser>;
|
|
59
58
|
}
|