ff-automationv2 2.2.35 → 2.2.36-beta.2
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 +6 -5
- package/dist/ai/llmprompts/llmPromptTypes/systemPromptTypes.d.ts +3 -0
- package/dist/ai/llmprompts/promptRegistry.js +4 -0
- package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +133 -133
- package/dist/ai/llmprompts/systemPrompts/arithmeticPrompt.js +40 -40
- package/dist/ai/llmprompts/systemPrompts/fileVerifyActionExtractorPrompt.js +36 -36
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +4 -4
- package/dist/ai/llmprompts/systemPrompts/getActionExtractorPrompt.js +51 -51
- package/dist/ai/llmprompts/systemPrompts/inputContextPrompt.js +49 -49
- package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +86 -86
- package/dist/ai/llmprompts/systemPrompts/multichannelKeywordExtractor.js +47 -47
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +16 -16
- package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.d.ts +2 -0
- package/dist/ai/llmprompts/systemPrompts/sliderSwipeVisionPrompt.js +54 -0
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.js +43 -43
- package/dist/ai/llmprompts/userPrompts/userPrompt.js +21 -0
- package/dist/automation/actions/executor.d.ts +1 -0
- package/dist/automation/actions/executor.js +23 -0
- package/dist/automation/actions/interaction/swipe/slider_Swipe.d.ts +2 -0
- package/dist/automation/actions/interaction/swipe/slider_Swipe.js +129 -0
- package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +6 -0
- package/dist/automation/actions/interface/FireFlinkResponseSchema.js +8 -1
- package/dist/automation/actions/interface/swipeActionInterface.d.ts +15 -0
- package/dist/core/helpers/mobileSwipeHelper.d.ts +3 -0
- package/dist/core/helpers/mobileSwipeHelper.js +78 -0
- package/dist/core/helpers/visionFallbackHandler.js +5 -3
- package/dist/core/interfaces/actionInterface.d.ts +1 -0
- package/dist/core/interfaces/mobileSwipeSliderInterface.d.ts +25 -0
- package/dist/core/interfaces/mobileSwipeSliderInterface.js +2 -0
- package/dist/core/interfaces/promptInterface.d.ts +4 -0
- package/dist/core/main/actionHandlerFactory.js +2 -2
- package/dist/core/main/runAutomationScript.js +44 -1
- package/dist/core/types/promptType.d.ts +1 -0
- package/dist/core/types/promptType.js +1 -0
- package/dist/domAnalysis/searchBest.js +0 -1
- package/dist/utils/DomExtraction/jsForAttributeInjection.js +232 -232
- package/dist/utils/helpers/xpathcreation.js +18 -2
- package/package.json +91 -91
- package/dist/tests/Framework.d.ts +0 -0
- package/dist/tests/Framework.js +0 -62
- package/dist/tests/itertaion.d.ts +0 -1
- package/dist/tests/itertaion.js +0 -43
- package/dist/tests/multiBrowser.d.ts +0 -1
- package/dist/tests/multiBrowser.js +0 -34
- package/dist/tests/poc.d.ts +0 -0
- package/dist/tests/poc.js +0 -212
- package/dist/tests/senario.d.ts +0 -0
- package/dist/tests/senario.js +0 -1120
- package/dist/tests/start_iteration_suggestion.d.ts +0 -6
- package/dist/tests/start_iteration_suggestion.js +0 -46
- package/dist/tests/test.d.ts +0 -1
- package/dist/tests/test.js +0 -26
- package/dist/tests/test1.d.ts +0 -1
- package/dist/tests/test1.js +0 -30
- package/dist/tests/test12.d.ts +0 -1
- package/dist/tests/test12.js +0 -35
- package/dist/tests/test254.d.ts +0 -0
- package/dist/tests/test254.js +0 -87
- package/dist/tests/test3.d.ts +0 -1
- package/dist/tests/test3.js +0 -27
- package/dist/tests/testkaf.d.ts +0 -0
- package/dist/tests/testkaf.js +0 -52
- package/dist/tests/tests.data.d.ts +0 -1
- package/dist/tests/tests.data.js +0 -8
- package/dist/tests/testss.d.ts +0 -1
- package/dist/tests/testss.js +0 -23
- package/dist/tests/testwe.d.ts +0 -1
- package/dist/tests/testwe.js +0 -24
|
@@ -2,59 +2,59 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getActionExtractorPrompt = getActionExtractorPrompt;
|
|
4
4
|
async function getActionExtractorPrompt({ extractedDomJson, priorAndNextSteps, }) {
|
|
5
|
-
const nlpList = `"GetAllTheOptionsFromListBoxAsTextInSortedOrder", "GetScreenshot", "GetAllTheOptionsFromListBoxAsText", "GetTheFirstSelectedOptionFromListBoxAsText", "GetAllTheSelectedOptionsFromListBoxAsText", "GetAttribute", "GetTagName", "GetListBoxSize",
|
|
6
|
-
"GetWrappedOptionFromListBoxAsText", "GetTextFromListOfWebElements", "GetCssValue", "GetScreenshotAs", "GetFirstSelectedOption", "GetText", "GetOptions", "GetAllSelectedOptions", "GetSize", "GetWrappedElement", "GetRect", "GetLocation",
|
|
7
|
-
"GetXLocationOfWebElement", "GetYLocationOfWebElement", "GetVideoMediaSource", "GetListOfElementsFromLocatorTypeLocatorValue", "GetVideoCurrentSeekTime", "GetVideoMediaLength", "GetVideoDefaultPlaybackRate", "GetAudioCurrentPlaybackRate",
|
|
8
|
-
"GetAudioDecodedByte", "GetVideoCurrentPlaybackRate", "GetVideoCurrentVolume", "GetAudioDefaultPlaybackRate", "GetSingleApiStatusCode", "GetSingleApiResponseTime", "GetAudioCurrentVolume", "GetSingleApiResponse",
|
|
9
|
-
"GetCollectiveApiStatusCode", "GetVideoDecodedByte", "GetDataFromApiResponseForJsonPath", "GetAudioMediaSource", "GetCollectiveApiResponseTime", "GetStatusCodeOfALink", "GetValueFromLocalStorage", "GetHeightOfWebElement", "GetTunnelIdentifier",
|
|
10
|
-
"GetWidthOfWebElement", "GetValueByCookieName", "GetHexCodeForGivenXYCoordinatesOfImage", "GetAudioCurrentSeekTime", "GetAudioMediaLength", "GetDateWithGivenFormat",
|
|
11
|
-
|
|
12
|
-
"GetBestPracticesScore", "GetPwaScore", "GetDataFromApiRequestHeaderForJsonPath", "GetSeoScore", "GetValueOfSystemVariable", "GetStringDataFromLocalFile", "GetAccessibilityScore", "GetPerformanceScore", "GetSystemProperty", "GetValueFromXmlPath",
|
|
13
|
-
"RobotGetXLocationOfWebElement", "RobotGetYLocationOfWebElement", "GetSingleApiRequestPayload","GetAllBrokenLinks", "GetHeightOfBrowserWindow", "GetXLocationOfBrowserWindow", "GetAllBrokenLinkCount", "GetWidthOfBrowser", "GetCurrentWindowHandle",
|
|
14
|
-
"GetAllWindowHandles", "GetURLPresentInAddressBar", "GetHTMLCodeOfPage", "GetPageTitle", "GetBrowserCount", "GetBrowserVersion", "GetImplicitTimeOut", "GetCapabilityNames", "GetYLocationOfBrowserWindow", "GetCurrentSystemDate",
|
|
15
|
-
"GetCurrentDayOfTheWeek", "GetCurrentSystemTime", "GetCurrentSecondsFromCurrentSystemTime", "GetCurrentSystemYear", "GetHourFromCurrentSystemTime", "GetMinuteFromCurrentSystemTime", "GetNumberOfLinksPresentInCurrentPage", "GetAllConsoleWarnings",
|
|
16
|
-
"GetAllConsoleInformation", "GetAllConsoleErrors", "GetAllCookieValues", "GetSizeOfBrowserWindow", "GetCurrentSystemMonth", "GetCurrentSystemDay", "GetAllConsoleLogs", "GetTotalNumberOfCookies", "GetAllBrokenImages", "GetAllCookieNames",
|
|
17
|
-
"GetNumberOfWorkingLinksFromCurrentPage", "GetNumberOfBrokenImages", "GetWorkingLinksFromCurrentPage", "BrowserWindowGetPosition", "GetClipBoardText", "GetDriverInstance", "GetFullPaintTime", "GetFirstContentfulPaint", "GetLargestContentfulPaint",
|
|
5
|
+
const nlpList = `"GetAllTheOptionsFromListBoxAsTextInSortedOrder", "GetScreenshot", "GetAllTheOptionsFromListBoxAsText", "GetTheFirstSelectedOptionFromListBoxAsText", "GetAllTheSelectedOptionsFromListBoxAsText", "GetAttribute", "GetTagName", "GetListBoxSize",
|
|
6
|
+
"GetWrappedOptionFromListBoxAsText", "GetTextFromListOfWebElements", "GetCssValue", "GetScreenshotAs", "GetFirstSelectedOption", "GetText", "GetOptions", "GetAllSelectedOptions", "GetSize", "GetWrappedElement", "GetRect", "GetLocation",
|
|
7
|
+
"GetXLocationOfWebElement", "GetYLocationOfWebElement", "GetVideoMediaSource", "GetListOfElementsFromLocatorTypeLocatorValue", "GetVideoCurrentSeekTime", "GetVideoMediaLength", "GetVideoDefaultPlaybackRate", "GetAudioCurrentPlaybackRate",
|
|
8
|
+
"GetAudioDecodedByte", "GetVideoCurrentPlaybackRate", "GetVideoCurrentVolume", "GetAudioDefaultPlaybackRate", "GetSingleApiStatusCode", "GetSingleApiResponseTime", "GetAudioCurrentVolume", "GetSingleApiResponse",
|
|
9
|
+
"GetCollectiveApiStatusCode", "GetVideoDecodedByte", "GetDataFromApiResponseForJsonPath", "GetAudioMediaSource", "GetCollectiveApiResponseTime", "GetStatusCodeOfALink", "GetValueFromLocalStorage", "GetHeightOfWebElement", "GetTunnelIdentifier",
|
|
10
|
+
"GetWidthOfWebElement", "GetValueByCookieName", "GetHexCodeForGivenXYCoordinatesOfImage", "GetAudioCurrentSeekTime", "GetAudioMediaLength", "GetDateWithGivenFormat",
|
|
11
|
+
|
|
12
|
+
"GetBestPracticesScore", "GetPwaScore", "GetDataFromApiRequestHeaderForJsonPath", "GetSeoScore", "GetValueOfSystemVariable", "GetStringDataFromLocalFile", "GetAccessibilityScore", "GetPerformanceScore", "GetSystemProperty", "GetValueFromXmlPath",
|
|
13
|
+
"RobotGetXLocationOfWebElement", "RobotGetYLocationOfWebElement", "GetSingleApiRequestPayload","GetAllBrokenLinks", "GetHeightOfBrowserWindow", "GetXLocationOfBrowserWindow", "GetAllBrokenLinkCount", "GetWidthOfBrowser", "GetCurrentWindowHandle",
|
|
14
|
+
"GetAllWindowHandles", "GetURLPresentInAddressBar", "GetHTMLCodeOfPage", "GetPageTitle", "GetBrowserCount", "GetBrowserVersion", "GetImplicitTimeOut", "GetCapabilityNames", "GetYLocationOfBrowserWindow", "GetCurrentSystemDate",
|
|
15
|
+
"GetCurrentDayOfTheWeek", "GetCurrentSystemTime", "GetCurrentSecondsFromCurrentSystemTime", "GetCurrentSystemYear", "GetHourFromCurrentSystemTime", "GetMinuteFromCurrentSystemTime", "GetNumberOfLinksPresentInCurrentPage", "GetAllConsoleWarnings",
|
|
16
|
+
"GetAllConsoleInformation", "GetAllConsoleErrors", "GetAllCookieValues", "GetSizeOfBrowserWindow", "GetCurrentSystemMonth", "GetCurrentSystemDay", "GetAllConsoleLogs", "GetTotalNumberOfCookies", "GetAllBrokenImages", "GetAllCookieNames",
|
|
17
|
+
"GetNumberOfWorkingLinksFromCurrentPage", "GetNumberOfBrokenImages", "GetWorkingLinksFromCurrentPage", "BrowserWindowGetPosition", "GetClipBoardText", "GetDriverInstance", "GetFullPaintTime", "GetFirstContentfulPaint", "GetLargestContentfulPaint",
|
|
18
18
|
"GetNetworkRouteTime", "GetPerformanceMetrics", "GetUserHomeDirectory"`;
|
|
19
19
|
const elementType = ['link', 'textfield', 'icon', 'button', 'radioButton', 'text', 'textarea', 'image', 'dropdown', 'checkbox', 'tab', 'action overflow button', 'hamburger icon', 'toggle button', 'suggestion', 'time picker', 'date picker', 'toaster message', 'card', 'tooltip', 'option', 'calender', 'sliders', 'visual testing'];
|
|
20
|
-
const prompt = `You are an intelligent assistant that extracts structured UI action data for fetching (GET) information.
|
|
21
|
-
Given the step, the simplified DOM: ${JSON.stringify(extractedDomJson)}, and the list of NLP names: ${nlpList}.
|
|
22
|
-
|
|
23
|
-
Select the perfect matching NLP name from the list that best fits the step's intent.
|
|
24
|
-
**The NLP name must match exactly one value from the approved NLP list. Do not generate or suggest any new NLP names under any condition.**
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
"attributeValue": "Fire-Flink-x",
|
|
28
|
-
"nlpName": "x",
|
|
29
|
-
"inputText":"x",
|
|
30
|
-
"elementType": "x",
|
|
31
|
-
"variableName": "validVariableName"
|
|
32
|
-
}
|
|
33
|
-
Rules:
|
|
34
|
-
- nlpName must be exactly one from the provided list.
|
|
35
|
-
"variableName": Generate a valid, descriptive variable name for storing the fetched value based on the step intent (e.g., a valid camelCase identifier such as "pageTitle", "extractedText", "userEmail", "itemPrice", or "orderId"). It must be a valid programming identifier (letters, numbers, and underscores; cannot start with a number; no spaces or special characters). If a variable name is explicitly mentioned in the step, use it exactly as provided. Otherwise, generate a variable name based on the step intent and always try to maintain a similar length to the variable name mentioned in the step.
|
|
36
|
-
- Use context from the steps : ${priorAndNextSteps}, keyword and json to search for FF-inspecter.
|
|
37
|
-
- **Find the FF-inspecter attribute value of the element in the Simplified DOM whose text or attributes best match the step.**
|
|
38
|
-
- **CRITICAL: For media actions (GetVideo..., GetAudio...), ALWAYS prioritize the actual <video> or <audio> element. DO NOT select container <div>, <span> or code block elements that merely contain the media tag as text. If you see a code block and a real media element, choose the real media element.**
|
|
39
|
-
- For some steps you can see two inputs but you need to understand step and send the required inputText. inputText can be string, number, url or xpath.
|
|
40
|
-
ex: get the flights matches the flight, Get Single Api Response of url- 'https://app.talentscan.ai/login' and request url-'https://app.talentscan.ai/sign up', if they give x-30,y-50 just send 30,50 and for this nlps GetDataFromApiRequestHeaderForJsonPath and Get Data From Api Response of url- 'https://app.talentscan.ai/login' and request url-'https://app.talentscan.ai/sign up' For JsonPath - c:jsonpath format than fill inputText in this order "https://app.talentscan.ai/login,https://app.talentscan.ai/sign up,c:jsonpath"
|
|
41
|
-
here keyword : "flights" , input : "flight", here input:"https://app.talentscan.ai/login,https://app.talentscan.ai/sign up" first input is url and second input is request url
|
|
42
|
-
- If step is about getting text from list of web elements from locator type locator value then always follow this format first type next value inputText: "locator_type, locator_value". if they didn't give locator type then based on locator value find locator type.
|
|
43
|
-
and also If a step is about getting value from element or some kind of locator type then provide the input in the format inputText: "locator_type, locator_value".
|
|
44
|
-
- If step is about getting attribute value then map to attribute nlps and inputText: "attribute_name".
|
|
45
|
-
- if step is about tag name then inputText: "tag name". and if step is about getting tag name and with count then inputText: "tag name,count".
|
|
46
|
-
- if step is about getting screenshot of element then than map to GetScreenshotAs.
|
|
47
|
-
- If step is mapped to GetTunnelIdentifier nlp than inputText must have 4 values separated by comma.first will be datacenter second will be username third will be access key and fourth will be tunnel id. they must follow this order. if they miss any value than return all values except that value.
|
|
48
|
-
- If a step refers to location, use "X-location" or "Y-location" NLP only when "X" or "Y" is explicitly mentioned; otherwise it should be "GetLocation" NLP.
|
|
49
|
-
- if step is about getting options than map to option nlps.
|
|
50
|
-
- for nlp GetBestPracticesScore,GetPwaScore and GetSeoScore inputText must have 2 values separated by comma.first will be url second will be device type. they must follow this order. if they miss any value than return all values except that value.
|
|
51
|
-
- If the step is about to get any api response, status code or anything related to api then in input Text give me url of that api and also the target url in the format "url,target_url".
|
|
52
|
-
- If no explicit option is mentioned in the step, map it to the most relevant non-option getting NLP based on the intent of the step.
|
|
53
|
-
- Extract inputText from the step that is which is being getting in the step, if you can't find any input text in the step, return keyword as inputText.
|
|
54
|
-
- Use the closest semantic match for the step; return attributeValue as Fire-Flink-0, only if nothing is found.and never return Fire-Flink-x.
|
|
55
|
-
- Based on step give most relevant type of element. use this list to choose elementType: ${elementType} and Never change syntax of elementType, follow the syntax of elementType in list.if elementType is not there in list return 'link'.
|
|
56
|
-
- Return ONLY a valid JSON object; the response must start with '{' and end with '}', with no markdown, code fences, explanations, or extra text.
|
|
57
|
-
- **Respond with valid JSON only. don't return any other text* or or don't return response in list format*.
|
|
20
|
+
const prompt = `You are an intelligent assistant that extracts structured UI action data for fetching (GET) information.
|
|
21
|
+
Given the step, the simplified DOM: ${JSON.stringify(extractedDomJson)}, and the list of NLP names: ${nlpList}.
|
|
22
|
+
|
|
23
|
+
Select the perfect matching NLP name from the list that best fits the step's intent.
|
|
24
|
+
**The NLP name must match exactly one value from the approved NLP list. Do not generate or suggest any new NLP names under any condition.**
|
|
25
|
+
|
|
26
|
+
{
|
|
27
|
+
"attributeValue": "Fire-Flink-x",
|
|
28
|
+
"nlpName": "x",
|
|
29
|
+
"inputText":"x",
|
|
30
|
+
"elementType": "x",
|
|
31
|
+
"variableName": "validVariableName"
|
|
32
|
+
}
|
|
33
|
+
Rules:
|
|
34
|
+
- nlpName must be exactly one from the provided list.
|
|
35
|
+
"variableName": Generate a valid, descriptive variable name for storing the fetched value based on the step intent (e.g., a valid camelCase identifier such as "pageTitle", "extractedText", "userEmail", "itemPrice", or "orderId"). It must be a valid programming identifier (letters, numbers, and underscores; cannot start with a number; no spaces or special characters). If a variable name is explicitly mentioned in the step, use it exactly as provided. Otherwise, generate a variable name based on the step intent and always try to maintain a similar length to the variable name mentioned in the step.
|
|
36
|
+
- Use context from the steps : ${priorAndNextSteps}, keyword and json to search for FF-inspecter.
|
|
37
|
+
- **Find the FF-inspecter attribute value of the element in the Simplified DOM whose text or attributes best match the step.**
|
|
38
|
+
- **CRITICAL: For media actions (GetVideo..., GetAudio...), ALWAYS prioritize the actual <video> or <audio> element. DO NOT select container <div>, <span> or code block elements that merely contain the media tag as text. If you see a code block and a real media element, choose the real media element.**
|
|
39
|
+
- For some steps you can see two inputs but you need to understand step and send the required inputText. inputText can be string, number, url or xpath.
|
|
40
|
+
ex: get the flights matches the flight, Get Single Api Response of url- 'https://app.talentscan.ai/login' and request url-'https://app.talentscan.ai/sign up', if they give x-30,y-50 just send 30,50 and for this nlps GetDataFromApiRequestHeaderForJsonPath and Get Data From Api Response of url- 'https://app.talentscan.ai/login' and request url-'https://app.talentscan.ai/sign up' For JsonPath - c:jsonpath format than fill inputText in this order "https://app.talentscan.ai/login,https://app.talentscan.ai/sign up,c:jsonpath"
|
|
41
|
+
here keyword : "flights" , input : "flight", here input:"https://app.talentscan.ai/login,https://app.talentscan.ai/sign up" first input is url and second input is request url
|
|
42
|
+
- If step is about getting text from list of web elements from locator type locator value then always follow this format first type next value inputText: "locator_type, locator_value". if they didn't give locator type then based on locator value find locator type.
|
|
43
|
+
and also If a step is about getting value from element or some kind of locator type then provide the input in the format inputText: "locator_type, locator_value".
|
|
44
|
+
- If step is about getting attribute value then map to attribute nlps and inputText: "attribute_name".
|
|
45
|
+
- if step is about tag name then inputText: "tag name". and if step is about getting tag name and with count then inputText: "tag name,count".
|
|
46
|
+
- if step is about getting screenshot of element then than map to GetScreenshotAs.
|
|
47
|
+
- If step is mapped to GetTunnelIdentifier nlp than inputText must have 4 values separated by comma.first will be datacenter second will be username third will be access key and fourth will be tunnel id. they must follow this order. if they miss any value than return all values except that value.
|
|
48
|
+
- If a step refers to location, use "X-location" or "Y-location" NLP only when "X" or "Y" is explicitly mentioned; otherwise it should be "GetLocation" NLP.
|
|
49
|
+
- if step is about getting options than map to option nlps.
|
|
50
|
+
- for nlp GetBestPracticesScore,GetPwaScore and GetSeoScore inputText must have 2 values separated by comma.first will be url second will be device type. they must follow this order. if they miss any value than return all values except that value.
|
|
51
|
+
- If the step is about to get any api response, status code or anything related to api then in input Text give me url of that api and also the target url in the format "url,target_url".
|
|
52
|
+
- If no explicit option is mentioned in the step, map it to the most relevant non-option getting NLP based on the intent of the step.
|
|
53
|
+
- Extract inputText from the step that is which is being getting in the step, if you can't find any input text in the step, return keyword as inputText.
|
|
54
|
+
- Use the closest semantic match for the step; return attributeValue as Fire-Flink-0, only if nothing is found.and never return Fire-Flink-x.
|
|
55
|
+
- Based on step give most relevant type of element. use this list to choose elementType: ${elementType} and Never change syntax of elementType, follow the syntax of elementType in list.if elementType is not there in list return 'link'.
|
|
56
|
+
- Return ONLY a valid JSON object; the response must start with '{' and end with '}', with no markdown, code fences, explanations, or extra text.
|
|
57
|
+
- **Respond with valid JSON only. don't return any other text* or or don't return response in list format*.
|
|
58
58
|
`;
|
|
59
59
|
return prompt;
|
|
60
60
|
}
|
|
@@ -2,55 +2,55 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.inputContextPrompt = inputContextPrompt;
|
|
4
4
|
async function inputContextPrompt({ inputStepsContext }) {
|
|
5
|
-
const prompt = `
|
|
6
|
-
You are an intelligent assistant that extracts input data for the current step.
|
|
7
|
-
|
|
8
|
-
Previous steps data:
|
|
9
|
-
${JSON.stringify(inputStepsContext, null, 2)}
|
|
10
|
-
|
|
11
|
-
Instructions:
|
|
12
|
-
|
|
13
|
-
1. Analyze the current step and previous steps carefully.
|
|
14
|
-
|
|
15
|
-
2. Priority rules (strict order):
|
|
16
|
-
- If a specific variable name is mentioned (e.g., "atpValue", "atpMulValue", "atpdivValue", "finalResult") → match to the step in "Previous steps data" with that exact "variableName".
|
|
17
|
-
- If referential calculation phrases are mentioned (e.g., "calculated final result", "calculated value", "final result", "calculation result", "result of calculation") → match to the most recent calculation or arithmetic step in "Previous steps data".
|
|
18
|
-
- If a step index or step reference is mentioned (e.g., "step 2", "2nd step", "3rd step", "3nd step", "step 1.1", "sub-step 1.1") → match to the corresponding stepindex (e.g., 2nd step -> stepindex 2, step 1.1 -> sub-step with stepindex "1.1"). If the matched step contains "subSteps", extract from the subStep matching the field name or sub-step index, and extract ONLY from that subStep.
|
|
19
|
-
- If a field name is mentioned (e.g., email, password, first name) → extract from the matching field step or subStep.
|
|
20
|
-
- If words like "above", "previous", "same" → extract from the most relevant previous step or subStep.
|
|
21
|
-
|
|
22
|
-
3. If the step is normal (no reference):
|
|
23
|
-
- Extract input directly from the current step.
|
|
24
|
-
- Do NOT use previous steps.
|
|
25
|
-
|
|
26
|
-
4. Conflict rule:
|
|
27
|
-
- If both source and destination fields exist (e.g., "enter first name in password"):
|
|
28
|
-
- Use the SOURCE field value ("first name").
|
|
29
|
-
- Ignore the destination field ("password").
|
|
30
|
-
|
|
31
|
-
5. Extraction rules:
|
|
32
|
-
- Use ONLY given data (previous or current step).
|
|
33
|
-
- If input exists in the current step, then extract that input only, should not use input from previous steps.
|
|
34
|
-
- If step is about extracting two values from previous steps, extract both values and return them as an inputText as "input1input2".
|
|
35
|
-
- Do NOT create or merge values.
|
|
36
|
-
-If the step modifies an input value from the current or previous steps, return the updated value as "inputText".
|
|
37
|
-
Example: If the input is "abc" and the step says to add "@123" or and add @ and one number, return "inputText": "abc@123" || "abc@5".
|
|
38
|
-
- If step is saying to genarate a input using previous steps input values, genarate the input value and return it as "inputText". if that is is Password genarate a strong password.
|
|
39
|
-
- Always return a single value.
|
|
40
|
-
|
|
41
|
-
6. Output rules:
|
|
42
|
-
- "inputText": Return ONLY the input value. inputText must NEVER be empty → fallback to most relevant previous value.
|
|
43
|
-
- "variableName": Do NOT generate a new variable name. Extract and return the "variableName" from the matching step or subStep in "Previous steps data" (inputStepsContext). If the matched previous step has a "variableName", return that exact variableName. If no variableName is present or no previous step is referenced, return "".
|
|
44
|
-
|
|
45
|
-
7. Never generate new input. Always follow priority rules strictly.
|
|
46
|
-
|
|
47
|
-
Respond ONLY with valid JSON:
|
|
48
|
-
|
|
49
|
-
{
|
|
50
|
-
"inputText": "x",
|
|
51
|
-
"variableName": "variableNameFromPreviousStep"
|
|
52
|
-
}
|
|
53
|
-
|
|
5
|
+
const prompt = `
|
|
6
|
+
You are an intelligent assistant that extracts input data for the current step.
|
|
7
|
+
|
|
8
|
+
Previous steps data:
|
|
9
|
+
${JSON.stringify(inputStepsContext, null, 2)}
|
|
10
|
+
|
|
11
|
+
Instructions:
|
|
12
|
+
|
|
13
|
+
1. Analyze the current step and previous steps carefully.
|
|
14
|
+
|
|
15
|
+
2. Priority rules (strict order):
|
|
16
|
+
- If a specific variable name is mentioned (e.g., "atpValue", "atpMulValue", "atpdivValue", "finalResult") → match to the step in "Previous steps data" with that exact "variableName".
|
|
17
|
+
- If referential calculation phrases are mentioned (e.g., "calculated final result", "calculated value", "final result", "calculation result", "result of calculation") → match to the most recent calculation or arithmetic step in "Previous steps data".
|
|
18
|
+
- If a step index or step reference is mentioned (e.g., "step 2", "2nd step", "3rd step", "3nd step", "step 1.1", "sub-step 1.1") → match to the corresponding stepindex (e.g., 2nd step -> stepindex 2, step 1.1 -> sub-step with stepindex "1.1"). If the matched step contains "subSteps", extract from the subStep matching the field name or sub-step index, and extract ONLY from that subStep.
|
|
19
|
+
- If a field name is mentioned (e.g., email, password, first name) → extract from the matching field step or subStep.
|
|
20
|
+
- If words like "above", "previous", "same" → extract from the most relevant previous step or subStep.
|
|
21
|
+
|
|
22
|
+
3. If the step is normal (no reference):
|
|
23
|
+
- Extract input directly from the current step.
|
|
24
|
+
- Do NOT use previous steps.
|
|
25
|
+
|
|
26
|
+
4. Conflict rule:
|
|
27
|
+
- If both source and destination fields exist (e.g., "enter first name in password"):
|
|
28
|
+
- Use the SOURCE field value ("first name").
|
|
29
|
+
- Ignore the destination field ("password").
|
|
30
|
+
|
|
31
|
+
5. Extraction rules:
|
|
32
|
+
- Use ONLY given data (previous or current step).
|
|
33
|
+
- If input exists in the current step, then extract that input only, should not use input from previous steps.
|
|
34
|
+
- If step is about extracting two values from previous steps, extract both values and return them as an inputText as "input1input2".
|
|
35
|
+
- Do NOT create or merge values.
|
|
36
|
+
-If the step modifies an input value from the current or previous steps, return the updated value as "inputText".
|
|
37
|
+
Example: If the input is "abc" and the step says to add "@123" or and add @ and one number, return "inputText": "abc@123" || "abc@5".
|
|
38
|
+
- If step is saying to genarate a input using previous steps input values, genarate the input value and return it as "inputText". if that is is Password genarate a strong password.
|
|
39
|
+
- Always return a single value.
|
|
40
|
+
|
|
41
|
+
6. Output rules:
|
|
42
|
+
- "inputText": Return ONLY the input value. inputText must NEVER be empty → fallback to most relevant previous value.
|
|
43
|
+
- "variableName": Do NOT generate a new variable name. Extract and return the "variableName" from the matching step or subStep in "Previous steps data" (inputStepsContext). If the matched previous step has a "variableName", return that exact variableName. If no variableName is present or no previous step is referenced, return "".
|
|
44
|
+
|
|
45
|
+
7. Never generate new input. Always follow priority rules strictly.
|
|
46
|
+
|
|
47
|
+
Respond ONLY with valid JSON:
|
|
48
|
+
|
|
49
|
+
{
|
|
50
|
+
"inputText": "x",
|
|
51
|
+
"variableName": "variableNameFromPreviousStep"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
54
|
`;
|
|
55
55
|
return prompt;
|
|
56
56
|
}
|
|
@@ -3,92 +3,92 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.keywordExtractorMobile = keywordExtractorMobile;
|
|
4
4
|
async function keywordExtractorMobile({ priorAndNextSteps }) {
|
|
5
5
|
const allowedActions = ["openApp", "tap", "enter", "wait", "verify", "scroll", "get", "closeApp", "combined", "switchToWeb", "getOtp", "enterOtp", "arithmetic"];
|
|
6
|
-
const prompt = `
|
|
7
|
-
You are an expert in mobile app testing.
|
|
8
|
-
From the step, extract ONLY the meaningful keywords so that i can search for the element in the dom.
|
|
9
|
-
Rules:
|
|
10
|
-
- understand the step and context from the ${priorAndNextSteps}.and only extract keywords from current step and dont extract from prior and next steps.
|
|
11
|
-
- 3 to 5 keywords maximum.
|
|
12
|
-
- If step is contains more than one keyword like tap on x button of y ,then include both in keywords like this [x,y].and include full keywords rather than insering part of it.
|
|
13
|
-
- If the step is about entering text, Should NOT include entered input values from the step in keywords.
|
|
14
|
-
- First keywords should be from step next Keywords must be distinct and based on the element's label meaning only.
|
|
15
|
-
- **Keywords can be string or number if the step contains a number it can be any number,must include that number in keywords and give it in string format.**
|
|
16
|
-
- If the step is about launching an app or opening app and if it has capbilities add them in keywords like ["key1:value1","key2:value2"...] and if step has app package and app activity without capability names like this 'com.app.android', 'com.app.activity' in keywords add with capability names
|
|
17
|
-
- For the Open App / Launch App action, if the user mentions any Android app capability, extract it into the keywords array as a key-value pair using the exact format "<capability>:<value>".
|
|
18
|
-
- The only allowed Android capabilities are:
|
|
19
|
-
- "app" - APK/app path
|
|
20
|
-
- "appPackage" - Android application package name
|
|
21
|
-
- "appActivity" - Android activity name
|
|
22
|
-
- "noReset" - whether the app state should be reset
|
|
23
|
-
- "fullReset" - whether a complete reset should be performed
|
|
24
|
-
- "autoGrantPermissions" - whether applicable Android runtime permissions should be automatically granted
|
|
25
|
-
- Every capability mentioned by the user MUST be returned as a key-value pair and capability name must be in above capability names, Never return a capability without its value.
|
|
26
|
-
- if step has keyword with type give two keywords with type and without type. ex: tap on leaving from text field. keywords = ["leaving from",leaving from text field].
|
|
27
|
-
- Should NOT include any other unrelated keywords for step.
|
|
28
|
-
- Should NOT include generic UI words (button, field, etc) and action words (tap, click, press, etc).example:tap on x button -> ['x']
|
|
29
|
-
- Should NOT include status/technical words (displayed, enabled, authenticate, visible).
|
|
30
|
-
- If the step is for the switching to web then provide the action as the switchToWeb
|
|
31
|
-
- 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.
|
|
32
|
-
-** 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**
|
|
33
|
-
- action: openApp for opening or launching of app and activate app is there in step give action as combined, 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 and fetching element and gtting logs and getting driver or instance details, closeApp for closing the app but not for terminating app step, arithmetic for performing arithmetic operations (multiply, divide, add, subtract, calculate) or storing/assigning calculation results and captured values into variables.
|
|
34
|
-
- If step is press any key give action as tap.if step is clear or clearandenter give action as enter and if step is open chrome browser app por application and it doesnot have app package or bundle id give action as combined but if step has app package or bundle id give action as openApp.
|
|
35
|
-
- action must be one of from this list ${allowedActions}.if not one of them, return action as 'combined'. if step about set or setting or find, install apk or ipa, uninstall apk or ipa,activate app with app package or bundle id, pinch in or pinch out or related turn wifi or airplane mode return action as 'combined'
|
|
36
|
-
- if the step action is about finding or check app is installed or open chrome browser or open notification bar or terminate app using app package or bumdle id or running app in the background for some seconds then provide action as combined.
|
|
37
|
-
CRITICAL SPLITTING RULES:
|
|
38
|
-
1. If the step contains multiple actions (two or more, in any combination), you MUST split it into multiple objects in the "steps" array in the same sequence and flow.
|
|
39
|
-
- Each object must represent EXACTLY ONE action.
|
|
40
|
-
- Preserve the ORIGINAL ORDER strictly.
|
|
41
|
-
Example: "Enter 'admin' in Username, '1234' in Password and tap Login" → split into 3 steps:
|
|
42
|
-
1. Enter 'admin' in Username (action: "enter", elementName: "Username")
|
|
43
|
-
2. Enter '1234' in Password (action: "enter", elementName: "Password")
|
|
44
|
-
3. Tap on Login (action: "tap", elementName: "Login")
|
|
45
|
-
Example: "Enter 'x' in a and tap b" → split into 2 steps:
|
|
46
|
-
1. Enter 'x' in a (action: "enter", elementName: "a")
|
|
47
|
-
2. Tap on b (action: "tap", elementName: "b")
|
|
48
|
-
2. If the step contains "select", "choose", "pick" and also contains a connecting reference ("from", "in", "under"):
|
|
49
|
-
Split into two atomic steps: tap reference element first, then tap target option.
|
|
50
|
-
Example: "Select 'India' from Country" →
|
|
51
|
-
1. Tap on Country (action: "tap", elementName: "Country")
|
|
52
|
-
2. Tap on India (action: "tap", elementName: "India")
|
|
53
|
-
3. If the step performs the SAME action with ONE VALUE into TWO OR MORE DIFFERENT elements:
|
|
54
|
-
Split into separate steps — one per target element:
|
|
55
|
-
Example: "Enter '1234' in PIN and Confirm PIN" →
|
|
56
|
-
1. Enter '1234' in PIN (elementName: "PIN", keywords: ["PIN"])
|
|
57
|
-
2. Enter '1234' in Confirm PIN (elementName: "Confirm PIN", keywords: ["Confirm PIN"])
|
|
58
|
-
4. Keywords in multiple steps should be extracted based on each individual sub-step only.
|
|
59
|
-
5. If the step performs the SAME action on TWO OR MORE DIFFERENT target elements joined by "and"/"," (with or without a value), split into separate steps — one per target element — each step keeping the same action (and same value, if any) with its own elementName and keywords.
|
|
60
|
-
Example (with value): "enter x in both a and b" -> 1. Enter x in a (elementName "a", keywords ["a"]), 2. Enter x in b (elementName "b", keywords ["b"]).
|
|
61
|
-
Example (no value): "get text from a and b" -> 1. Get text from a (elementName "a", keywords ["a"]), 2. Get text from b (elementName "b", keywords ["b"]).
|
|
62
|
-
6. fileType: If the verify action step mentions verifying or checking any file extension or document (e.g. "pdf" or any file extension), extract that file extension in lowercase (without dot, e.g. "pdf") and set it in fileType. For all non-file/UI verification steps, set fileType to null.
|
|
63
|
-
|
|
64
|
-
Respond ONLY with valid JSON in this EXACT format:
|
|
65
|
-
{
|
|
66
|
-
"steps": [
|
|
67
|
-
{
|
|
68
|
-
"keywords": [key1,key2,key3,key4,key5] if step is opening app then keywords should be like ["key1:value1","key2:value2"...],
|
|
69
|
-
"elementName": "x",
|
|
70
|
-
"action": ${allowedActions.join("|")},
|
|
71
|
-
"isStepValueDependable": boolean (true ONLY if action is verify/enter AND the step contains an actual referential phrase pointing to an earlier step's data — see isStepValueDependable rule below for the full test and examples; false if the value is literal or no referential phrase is present. Never consider future steps.),
|
|
72
|
-
"liveLog": "Should Generate a short, human-readable description of what the AI is about to do.",
|
|
73
|
-
"fileType": "pdf" | other lowercase file extension | null,
|
|
74
|
-
"step": "Clean, complete instruction of the step (or atomic sub-step if split)."
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
}
|
|
78
|
-
STEP RULES (VERY IMPORTANT):
|
|
79
|
-
- Each "step" MUST represent EXACTLY ONE action.
|
|
80
|
-
- isStepValueDependable (boolean):
|
|
81
|
-
• Test is REFERENTIAL vs LITERAL, not sentence completeness — e.g. "enter 2nd step input in name" is a complete sentence but still referential, since the value itself isn't written there.
|
|
82
|
-
• Set true ONLY when action is 'verify' or 'enter' AND the step contains an actual referential phrase pointing to data from an earlier step (by step number, "previous/prior/earlier/that/same" wording, or naming what was fetched/copied/retrieved there). Confirm the referenced step exists earlier in priorAndNextSteps, never a future step.
|
|
83
|
-
• Set false when the value is written literally, or no referential phrase is present, or the action isn't verify/enter.
|
|
84
|
-
• DO NOT infer true from an element/field name alone when that word appears only in the CURRENT step's own target/element — e.g. "get text from Password" is false because "Password" there is just this step's own target, not a value pointing elsewhere.
|
|
85
|
-
• EXCEPTION — reference-by-element-name: if the VALUE being entered matches (case-insensitively) the elementName or keyword of a 'get' or 'enter' action from an EARLIER step in priorAndNextSteps, treat this as referential (true) even with no explicit pointer wording like "previous"/"same" — this is a common shorthand for "reuse whatever was entered/fetched there". Example: step 2 is "enter santosh@123 in password" (elementName "Password"), step 3 is "enter password in confirm password" → true, because the value "password" matches step 2's elementName, meaning step 3 is reusing step 2's entered value, not typing the literal word "password".
|
|
86
|
-
• Examples (illustrative, not exhaustive): "enter 2nd step input in name" → true. "enter the OTP received earlier in name" → true. "enter 'John' in name" → false. "get text from Password" → false (no reference present). "enter password in confirm password" (given step 2 entered a value into a "Password" field) → true.
|
|
87
|
-
- Step MUST be rewritten as a CLEAN and COMPLETE instruction containing action, target element, and value (if applicable).
|
|
88
|
-
- DO NOT copy original sentence if it contains multiple actions.
|
|
89
|
-
- ALWAYS normalize mobile action wording (e.g., use "Tap on Y", not "Click on Y").
|
|
90
|
-
- Each step must be SELF-CONTAINED and EXECUTABLE.
|
|
91
|
-
No other text.
|
|
6
|
+
const prompt = `
|
|
7
|
+
You are an expert in mobile app testing.
|
|
8
|
+
From the step, extract ONLY the meaningful keywords so that i can search for the element in the dom.
|
|
9
|
+
Rules:
|
|
10
|
+
- understand the step and context from the ${priorAndNextSteps}.and only extract keywords from current step and dont extract from prior and next steps.
|
|
11
|
+
- 3 to 5 keywords maximum.
|
|
12
|
+
- If step is contains more than one keyword like tap on x button of y ,then include both in keywords like this [x,y].and include full keywords rather than insering part of it.
|
|
13
|
+
- If the step is about entering text, Should NOT include entered input values from the step in keywords.
|
|
14
|
+
- First keywords should be from step next Keywords must be distinct and based on the element's label meaning only.
|
|
15
|
+
- **Keywords can be string or number if the step contains a number it can be any number,must include that number in keywords and give it in string format.**
|
|
16
|
+
- If the step is about launching an app or opening app and if it has capbilities add them in keywords like ["key1:value1","key2:value2"...] and if step has app package and app activity without capability names like this 'com.app.android', 'com.app.activity' in keywords add with capability names
|
|
17
|
+
- For the Open App / Launch App action, if the user mentions any Android app capability, extract it into the keywords array as a key-value pair using the exact format "<capability>:<value>".
|
|
18
|
+
- The only allowed Android capabilities are:
|
|
19
|
+
- "app" - APK/app path
|
|
20
|
+
- "appPackage" - Android application package name
|
|
21
|
+
- "appActivity" - Android activity name
|
|
22
|
+
- "noReset" - whether the app state should be reset
|
|
23
|
+
- "fullReset" - whether a complete reset should be performed
|
|
24
|
+
- "autoGrantPermissions" - whether applicable Android runtime permissions should be automatically granted
|
|
25
|
+
- Every capability mentioned by the user MUST be returned as a key-value pair and capability name must be in above capability names, Never return a capability without its value.
|
|
26
|
+
- if step has keyword with type give two keywords with type and without type. ex: tap on leaving from text field. keywords = ["leaving from",leaving from text field].
|
|
27
|
+
- Should NOT include any other unrelated keywords for step.
|
|
28
|
+
- Should NOT include generic UI words (button, field, etc) and action words (tap, click, press, etc).example:tap on x button -> ['x']
|
|
29
|
+
- Should NOT include status/technical words (displayed, enabled, authenticate, visible).
|
|
30
|
+
- If the step is for the switching to web then provide the action as the switchToWeb
|
|
31
|
+
- 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.
|
|
32
|
+
-** 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**
|
|
33
|
+
- action: openApp for opening or launching of app and activate app is there in step give action as combined, 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 and fetching element and gtting logs and getting driver or instance details, closeApp for closing the app but not for terminating app step, arithmetic for performing arithmetic operations (multiply, divide, add, subtract, calculate) or storing/assigning calculation results and captured values into variables.
|
|
34
|
+
- If step is press any key give action as tap.if step is clear or clearandenter give action as enter and if step is open chrome browser app por application and it doesnot have app package or bundle id give action as combined but if step has app package or bundle id give action as openApp.
|
|
35
|
+
- action must be one of from this list ${allowedActions}.if not one of them, return action as 'combined'. if step about set or setting or find, install apk or ipa, uninstall apk or ipa,activate app with app package or bundle id, pinch in or pinch out or related turn wifi or airplane mode return action as 'combined'
|
|
36
|
+
- if the step action is about finding or check app is installed or open chrome browser or open notification bar or terminate app using app package or bumdle id or running app in the background for some seconds then provide action as combined.
|
|
37
|
+
CRITICAL SPLITTING RULES:
|
|
38
|
+
1. If the step contains multiple actions (two or more, in any combination), you MUST split it into multiple objects in the "steps" array in the same sequence and flow.
|
|
39
|
+
- Each object must represent EXACTLY ONE action.
|
|
40
|
+
- Preserve the ORIGINAL ORDER strictly.
|
|
41
|
+
Example: "Enter 'admin' in Username, '1234' in Password and tap Login" → split into 3 steps:
|
|
42
|
+
1. Enter 'admin' in Username (action: "enter", elementName: "Username")
|
|
43
|
+
2. Enter '1234' in Password (action: "enter", elementName: "Password")
|
|
44
|
+
3. Tap on Login (action: "tap", elementName: "Login")
|
|
45
|
+
Example: "Enter 'x' in a and tap b" → split into 2 steps:
|
|
46
|
+
1. Enter 'x' in a (action: "enter", elementName: "a")
|
|
47
|
+
2. Tap on b (action: "tap", elementName: "b")
|
|
48
|
+
2. If the step contains "select", "choose", "pick" and also contains a connecting reference ("from", "in", "under"):
|
|
49
|
+
Split into two atomic steps: tap reference element first, then tap target option.
|
|
50
|
+
Example: "Select 'India' from Country" →
|
|
51
|
+
1. Tap on Country (action: "tap", elementName: "Country")
|
|
52
|
+
2. Tap on India (action: "tap", elementName: "India")
|
|
53
|
+
3. If the step performs the SAME action with ONE VALUE into TWO OR MORE DIFFERENT elements:
|
|
54
|
+
Split into separate steps — one per target element:
|
|
55
|
+
Example: "Enter '1234' in PIN and Confirm PIN" →
|
|
56
|
+
1. Enter '1234' in PIN (elementName: "PIN", keywords: ["PIN"])
|
|
57
|
+
2. Enter '1234' in Confirm PIN (elementName: "Confirm PIN", keywords: ["Confirm PIN"])
|
|
58
|
+
4. Keywords in multiple steps should be extracted based on each individual sub-step only.
|
|
59
|
+
5. If the step performs the SAME action on TWO OR MORE DIFFERENT target elements joined by "and"/"," (with or without a value), split into separate steps — one per target element — each step keeping the same action (and same value, if any) with its own elementName and keywords.
|
|
60
|
+
Example (with value): "enter x in both a and b" -> 1. Enter x in a (elementName "a", keywords ["a"]), 2. Enter x in b (elementName "b", keywords ["b"]).
|
|
61
|
+
Example (no value): "get text from a and b" -> 1. Get text from a (elementName "a", keywords ["a"]), 2. Get text from b (elementName "b", keywords ["b"]).
|
|
62
|
+
6. fileType: If the verify action step mentions verifying or checking any file extension or document (e.g. "pdf" or any file extension), extract that file extension in lowercase (without dot, e.g. "pdf") and set it in fileType. For all non-file/UI verification steps, set fileType to null.
|
|
63
|
+
|
|
64
|
+
Respond ONLY with valid JSON in this EXACT format:
|
|
65
|
+
{
|
|
66
|
+
"steps": [
|
|
67
|
+
{
|
|
68
|
+
"keywords": [key1,key2,key3,key4,key5] if step is opening app then keywords should be like ["key1:value1","key2:value2"...],
|
|
69
|
+
"elementName": "x",
|
|
70
|
+
"action": ${allowedActions.join("|")},
|
|
71
|
+
"isStepValueDependable": boolean (true ONLY if action is verify/enter AND the step contains an actual referential phrase pointing to an earlier step's data — see isStepValueDependable rule below for the full test and examples; false if the value is literal or no referential phrase is present. Never consider future steps.),
|
|
72
|
+
"liveLog": "Should Generate a short, human-readable description of what the AI is about to do.",
|
|
73
|
+
"fileType": "pdf" | other lowercase file extension | null,
|
|
74
|
+
"step": "Clean, complete instruction of the step (or atomic sub-step if split)."
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
STEP RULES (VERY IMPORTANT):
|
|
79
|
+
- Each "step" MUST represent EXACTLY ONE action.
|
|
80
|
+
- isStepValueDependable (boolean):
|
|
81
|
+
• Test is REFERENTIAL vs LITERAL, not sentence completeness — e.g. "enter 2nd step input in name" is a complete sentence but still referential, since the value itself isn't written there.
|
|
82
|
+
• Set true ONLY when action is 'verify' or 'enter' AND the step contains an actual referential phrase pointing to data from an earlier step (by step number, "previous/prior/earlier/that/same" wording, or naming what was fetched/copied/retrieved there). Confirm the referenced step exists earlier in priorAndNextSteps, never a future step.
|
|
83
|
+
• Set false when the value is written literally, or no referential phrase is present, or the action isn't verify/enter.
|
|
84
|
+
• DO NOT infer true from an element/field name alone when that word appears only in the CURRENT step's own target/element — e.g. "get text from Password" is false because "Password" there is just this step's own target, not a value pointing elsewhere.
|
|
85
|
+
• EXCEPTION — reference-by-element-name: if the VALUE being entered matches (case-insensitively) the elementName or keyword of a 'get' or 'enter' action from an EARLIER step in priorAndNextSteps, treat this as referential (true) even with no explicit pointer wording like "previous"/"same" — this is a common shorthand for "reuse whatever was entered/fetched there". Example: step 2 is "enter santosh@123 in password" (elementName "Password"), step 3 is "enter password in confirm password" → true, because the value "password" matches step 2's elementName, meaning step 3 is reusing step 2's entered value, not typing the literal word "password".
|
|
86
|
+
• Examples (illustrative, not exhaustive): "enter 2nd step input in name" → true. "enter the OTP received earlier in name" → true. "enter 'John' in name" → false. "get text from Password" → false (no reference present). "enter password in confirm password" (given step 2 entered a value into a "Password" field) → true.
|
|
87
|
+
- Step MUST be rewritten as a CLEAN and COMPLETE instruction containing action, target element, and value (if applicable).
|
|
88
|
+
- DO NOT copy original sentence if it contains multiple actions.
|
|
89
|
+
- ALWAYS normalize mobile action wording (e.g., use "Tap on Y", not "Click on Y").
|
|
90
|
+
- Each step must be SELF-CONTAINED and EXECUTABLE.
|
|
91
|
+
No other text.
|
|
92
92
|
`;
|
|
93
93
|
return prompt;
|
|
94
94
|
}
|
|
@@ -35,52 +35,52 @@ async function keywordExtractorMultichannel({ priorAndNextSteps, allSteps, previ
|
|
|
35
35
|
"enterOtp",
|
|
36
36
|
"arithmetic",
|
|
37
37
|
];
|
|
38
|
-
return `
|
|
39
|
-
You are extracting keywords for a MULTICHANNEL test. Platform is not provided by the user.
|
|
40
|
-
You MUST decide the platform for the CURRENT step and return it so downstream execution stays unchanged.
|
|
41
|
-
|
|
42
|
-
previousPlatform: ${previousPlatform ?? "none"}
|
|
43
|
-
allSteps (full script, use as context only): ${JSON.stringify(allSteps)}
|
|
44
|
-
nearbySteps: ${JSON.stringify(priorAndNextSteps)}
|
|
45
|
-
|
|
46
|
-
PLATFORM DECISION RULES (mandatory):
|
|
47
|
-
- platform MUST be exactly one of: "web" | "android" | "ios"
|
|
48
|
-
- Decide using the CURRENT step first, then allSteps for context, then previousPlatform.
|
|
49
|
-
- If the current step is in the middle of a flow and does not clearly name a platform, browser, URL, app, package, bundle, or device, you MUST reuse previousPlatform.
|
|
50
|
-
- If previousPlatform is "none" (first step), infer from the current step and allSteps:
|
|
51
|
-
- web: browser, URL, http/https, navigate, click, open browser, web page, tab, window
|
|
52
|
-
- android: Android app, APK, appPackage, appActivity, UiAutomator, Android device
|
|
53
|
-
- ios: iOS app, iPhone, IPA, bundle id, XCUITest, Safari on iOS
|
|
54
|
-
- Do not switch platform on generic UI verbs (tap/click/enter/verify/scroll) unless the step or surrounding allSteps clearly change channel.
|
|
55
|
-
- After you choose platform, follow THAT platform's keyword/action rules below. Do not mix web actions onto mobile or mobile actions onto web.
|
|
56
|
-
- web actions include: click, open, close, navigate, navigateBack, maximize, minimize, refresh, mouseAction, drag_and_drop, switch, cleartext, upload
|
|
57
|
-
- android/ios actions include: tap, openApp, closeApp, combined, enterOtp
|
|
58
|
-
- shared: enter, wait, verify, scroll, get, getOtp, arithmetic, switchToAndroid, switchToWeb
|
|
59
|
-
- action must be one of: ${JSON.stringify(allowedActions)}
|
|
60
|
-
|
|
61
|
-
===== WEB KEYWORD RULES (use when platform is web) =====
|
|
62
|
-
${webPrompt}
|
|
63
|
-
|
|
64
|
-
===== ANDROID / iOS KEYWORD RULES (use when platform is android or ios) =====
|
|
65
|
-
${mobilePrompt}
|
|
66
|
-
|
|
67
|
-
Respond ONLY with valid JSON in this EXACT format (this overrides the JSON formats in the sections above):
|
|
68
|
-
{
|
|
69
|
-
"steps": [
|
|
70
|
-
{
|
|
71
|
-
"platform": "web" | "android" | "ios",
|
|
72
|
-
"keywords": ["key1", "key2"],
|
|
73
|
-
"elementName": "element name",
|
|
74
|
-
"action": ${allowedActions.join("|")},
|
|
75
|
-
"isStepValueDependable": boolean,
|
|
76
|
-
"liveLog": "Short human-readable description of what the AI is about to do.",
|
|
77
|
-
"fileType": "pdf" | other lowercase file extension | null,
|
|
78
|
-
"step": "Single atomic instruction for this step."
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Every object in "steps" MUST include platform. If you split one user step into multiple objects, keep the same platform unless the wording clearly switches channel.
|
|
84
|
-
No other text.
|
|
38
|
+
return `
|
|
39
|
+
You are extracting keywords for a MULTICHANNEL test. Platform is not provided by the user.
|
|
40
|
+
You MUST decide the platform for the CURRENT step and return it so downstream execution stays unchanged.
|
|
41
|
+
|
|
42
|
+
previousPlatform: ${previousPlatform ?? "none"}
|
|
43
|
+
allSteps (full script, use as context only): ${JSON.stringify(allSteps)}
|
|
44
|
+
nearbySteps: ${JSON.stringify(priorAndNextSteps)}
|
|
45
|
+
|
|
46
|
+
PLATFORM DECISION RULES (mandatory):
|
|
47
|
+
- platform MUST be exactly one of: "web" | "android" | "ios"
|
|
48
|
+
- Decide using the CURRENT step first, then allSteps for context, then previousPlatform.
|
|
49
|
+
- If the current step is in the middle of a flow and does not clearly name a platform, browser, URL, app, package, bundle, or device, you MUST reuse previousPlatform.
|
|
50
|
+
- If previousPlatform is "none" (first step), infer from the current step and allSteps:
|
|
51
|
+
- web: browser, URL, http/https, navigate, click, open browser, web page, tab, window
|
|
52
|
+
- android: Android app, APK, appPackage, appActivity, UiAutomator, Android device
|
|
53
|
+
- ios: iOS app, iPhone, IPA, bundle id, XCUITest, Safari on iOS
|
|
54
|
+
- Do not switch platform on generic UI verbs (tap/click/enter/verify/scroll) unless the step or surrounding allSteps clearly change channel.
|
|
55
|
+
- After you choose platform, follow THAT platform's keyword/action rules below. Do not mix web actions onto mobile or mobile actions onto web.
|
|
56
|
+
- web actions include: click, open, close, navigate, navigateBack, maximize, minimize, refresh, mouseAction, drag_and_drop, switch, cleartext, upload
|
|
57
|
+
- android/ios actions include: tap, openApp, closeApp, combined, enterOtp
|
|
58
|
+
- shared: enter, wait, verify, scroll, get, getOtp, arithmetic, switchToAndroid, switchToWeb
|
|
59
|
+
- action must be one of: ${JSON.stringify(allowedActions)}
|
|
60
|
+
|
|
61
|
+
===== WEB KEYWORD RULES (use when platform is web) =====
|
|
62
|
+
${webPrompt}
|
|
63
|
+
|
|
64
|
+
===== ANDROID / iOS KEYWORD RULES (use when platform is android or ios) =====
|
|
65
|
+
${mobilePrompt}
|
|
66
|
+
|
|
67
|
+
Respond ONLY with valid JSON in this EXACT format (this overrides the JSON formats in the sections above):
|
|
68
|
+
{
|
|
69
|
+
"steps": [
|
|
70
|
+
{
|
|
71
|
+
"platform": "web" | "android" | "ios",
|
|
72
|
+
"keywords": ["key1", "key2"],
|
|
73
|
+
"elementName": "element name",
|
|
74
|
+
"action": ${allowedActions.join("|")},
|
|
75
|
+
"isStepValueDependable": boolean,
|
|
76
|
+
"liveLog": "Short human-readable description of what the AI is about to do.",
|
|
77
|
+
"fileType": "pdf" | other lowercase file extension | null,
|
|
78
|
+
"step": "Single atomic instruction for this step."
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Every object in "steps" MUST include platform. If you split one user step into multiple objects, keep the same platform unless the wording clearly switches channel.
|
|
84
|
+
No other text.
|
|
85
85
|
`;
|
|
86
86
|
}
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.otpExtractorPrompt = otpExtractorPrompt;
|
|
4
4
|
async function otpExtractorPrompt() {
|
|
5
|
-
return `
|
|
6
|
-
You extract one-time passwords (OTPs) from SMS messages and also the provider of the regex to extract that OTP from the message.
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Return only valid JSON in exactly this format:
|
|
10
|
-
{
|
|
11
|
-
"otp": ""
|
|
12
|
-
"regex":""
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
Rules:
|
|
16
|
-
- Extract only the OTP/code stated in the supplied SMS body.
|
|
17
|
-
- Do not infer, generate, or guess an OTP.
|
|
18
|
-
- If no single unambiguous OTP is present, return an empty string.
|
|
19
|
-
- Return the regex that can be used to extract that OTP number itself from that message body also don't include any text only give the expression.
|
|
20
|
-
- Return no text, Markdown, or keys other than "otp".
|
|
5
|
+
return `
|
|
6
|
+
You extract one-time passwords (OTPs) from SMS messages and also the provider of the regex to extract that OTP from the message.
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Return only valid JSON in exactly this format:
|
|
10
|
+
{
|
|
11
|
+
"otp": ""
|
|
12
|
+
"regex":""
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Rules:
|
|
16
|
+
- Extract only the OTP/code stated in the supplied SMS body.
|
|
17
|
+
- Do not infer, generate, or guess an OTP.
|
|
18
|
+
- If no single unambiguous OTP is present, return an empty string.
|
|
19
|
+
- Return the regex that can be used to extract that OTP number itself from that message body also don't include any text only give the expression.
|
|
20
|
+
- Return no text, Markdown, or keys other than "otp".
|
|
21
21
|
`;
|
|
22
22
|
}
|