ff-automationv2 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (362) hide show
  1. package/.env +1 -0
  2. package/.husky/pre-commit +5 -0
  3. package/ARCHITECTURE.md +6 -3
  4. package/Note.md +7 -0
  5. package/RELEASE_GUIDE.md +1 -1
  6. package/bitbucket-pipelines.yml +4 -25
  7. package/eslint.config.ts +4 -0
  8. package/package.json +21 -9
  9. package/src/ai/llmcalls/decodeApiKey.ts +1 -1
  10. package/src/ai/llmcalls/llmAction.ts +154 -47
  11. package/src/ai/llmprompts/llmPromptTypes/systemPromptTypes.ts +45 -0
  12. package/src/ai/llmprompts/promptRegistry.ts +34 -8
  13. package/src/ai/llmprompts/systemPrompts/actionExtractorPrompt.ts +4 -7
  14. package/src/ai/llmprompts/systemPrompts/combinedActionExtractorPrompt.ts +41 -0
  15. package/src/ai/llmprompts/systemPrompts/combinedActionExtractorPromptMob.ts +53 -0
  16. package/src/ai/llmprompts/systemPrompts/errorDescriptionPrompt.ts +43 -14
  17. package/src/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.ts +111 -36
  18. package/src/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.ts +53 -0
  19. package/src/ai/llmprompts/systemPrompts/getActionExtractorPrompt.ts +62 -0
  20. package/src/ai/llmprompts/systemPrompts/getActionExtractorPromptMob.ts +54 -0
  21. package/src/ai/llmprompts/systemPrompts/mobileKeywordExtractor.ts +39 -0
  22. package/src/ai/llmprompts/systemPrompts/userStoryToListPrompt.ts +48 -11
  23. package/src/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.ts +82 -0
  24. package/src/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.ts +58 -0
  25. package/src/ai/llmprompts/systemPrompts/visionPrompt.ts +8 -14
  26. package/src/ai/llmprompts/systemPrompts/visionPromptMobile.ts +25 -0
  27. package/src/ai/llmprompts/systemPrompts/waitActionExtractorPrompt.ts +65 -0
  28. package/src/ai/llmprompts/systemPrompts/waitActionExtractorPromptMob.ts +45 -0
  29. package/src/ai/llmprompts/userPrompts/userPrompt.ts +28 -4
  30. package/src/automation/actions/executor.ts +4478 -48
  31. package/src/automation/actions/interaction/alert/clickCancelOnAlertPopup.ts +21 -0
  32. package/src/automation/actions/interaction/alert/clickOkOnAlertPopup.ts +20 -0
  33. package/src/automation/actions/interaction/alert/enterDataToAlert.ts +20 -0
  34. package/src/automation/actions/interaction/alert/getTextPresentOnAlertPopup.ts +19 -0
  35. package/src/automation/actions/interaction/alert/verifyAlertPopUpMessageContainsString.ts +32 -0
  36. package/src/automation/actions/interaction/alert/verifyAlertPopupIsDisplayed.ts +19 -0
  37. package/src/automation/actions/interaction/alert/verifyTextPresentOnAlertPopup.ts +33 -0
  38. package/src/automation/actions/interaction/alert/waitTillAlertIsPresent.ts +25 -0
  39. package/src/automation/actions/interaction/clear/clear.ts +61 -0
  40. package/src/automation/actions/interaction/clear/clearAndEnter.ts +58 -0
  41. package/src/automation/actions/interaction/click/click.ts +61 -0
  42. package/src/automation/actions/interaction/click/clickNtimes.ts +67 -0
  43. package/src/automation/actions/interaction/click/clickUsingJs.ts +33 -0
  44. package/src/automation/actions/interaction/click/doubleClick.ts +66 -0
  45. package/src/automation/actions/interaction/click/rightClick.ts +29 -0
  46. package/src/automation/actions/interaction/click/waitAndClick.ts +83 -0
  47. package/src/automation/actions/interaction/dragAndDrop/dragAndDrop.ts +46 -0
  48. package/src/automation/actions/interaction/enterActions/enterInput.ts +81 -0
  49. package/src/automation/actions/interaction/enterActions/enterInputAndPress.ts +134 -0
  50. package/src/automation/actions/interaction/enterActions/enterUrl.ts +52 -0
  51. package/src/automation/actions/interaction/enterActions/enterusingJs.ts +41 -0
  52. package/src/automation/actions/interaction/enterActions/waitAndEnter.ts +106 -0
  53. package/src/automation/actions/interaction/find/findElements.ts +57 -0
  54. package/src/automation/actions/interaction/get/browserWindowGetPosition.ts +15 -0
  55. package/src/automation/actions/interaction/get/getAllBrokenImages.ts +16 -0
  56. package/src/automation/actions/interaction/get/getAllBrokenLinkCount.ts +17 -0
  57. package/src/automation/actions/interaction/get/getAllBrokenLinks.ts +16 -0
  58. package/src/automation/actions/interaction/get/getAllConsoleErrors.ts +16 -0
  59. package/src/automation/actions/interaction/get/getAllConsoleInformation.ts +16 -0
  60. package/src/automation/actions/interaction/get/getAllConsoleLogs.ts +16 -0
  61. package/src/automation/actions/interaction/get/getAllConsoleWarnings.ts +18 -0
  62. package/src/automation/actions/interaction/get/getAllCookieNames.ts +16 -0
  63. package/src/automation/actions/interaction/get/getAllCookieValues.ts +16 -0
  64. package/src/automation/actions/interaction/get/getAllSelectedOptions.ts +43 -0
  65. package/src/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsText.ts +46 -0
  66. package/src/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsTextInSortedOrder.ts +54 -0
  67. package/src/automation/actions/interaction/get/getAllTheSelectedOptionsFromListBoxAsText.ts +43 -0
  68. package/src/automation/actions/interaction/get/getAllWindowHandles.ts +18 -0
  69. package/src/automation/actions/interaction/get/getAttribute.ts +83 -0
  70. package/src/automation/actions/interaction/get/getAudioCurrentPlaybackRate.ts +35 -0
  71. package/src/automation/actions/interaction/get/getAudioCurrentSeekTime.ts +36 -0
  72. package/src/automation/actions/interaction/get/getAudioCurrentVolume.ts +36 -0
  73. package/src/automation/actions/interaction/get/getAudioDecodedByte.ts +43 -0
  74. package/src/automation/actions/interaction/get/getAudioDefaultPlaybackRate.ts +36 -0
  75. package/src/automation/actions/interaction/get/getAudioDimension.ts +43 -0
  76. package/src/automation/actions/interaction/get/getAudioHeight.ts +38 -0
  77. package/src/automation/actions/interaction/get/getAudioMediaLength.ts +34 -0
  78. package/src/automation/actions/interaction/get/getAudioMediaSource.ts +44 -0
  79. package/src/automation/actions/interaction/get/getAudioWidth.ts +38 -0
  80. package/src/automation/actions/interaction/get/getBestPracticesScore.ts +20 -0
  81. package/src/automation/actions/interaction/get/getBrowserCount.ts +17 -0
  82. package/src/automation/actions/interaction/get/getBrowserVersion.ts +16 -0
  83. package/src/automation/actions/interaction/get/getCapabilityNames.ts +18 -0
  84. package/src/automation/actions/interaction/get/getClipBoardText.ts +16 -0
  85. package/src/automation/actions/interaction/get/getCollectiveApiResponseTime.ts +27 -0
  86. package/src/automation/actions/interaction/get/getCollectiveApiStatusCode.ts +29 -0
  87. package/src/automation/actions/interaction/get/getCssValue.ts +38 -0
  88. package/src/automation/actions/interaction/get/getCurrentDayOfTheWeek.ts +18 -0
  89. package/src/automation/actions/interaction/get/getCurrentSecondsFromCurrentSystemTime.ts +19 -0
  90. package/src/automation/actions/interaction/get/getCurrentSystemDate.ts +18 -0
  91. package/src/automation/actions/interaction/get/getCurrentSystemDay.ts +16 -0
  92. package/src/automation/actions/interaction/get/getCurrentSystemMonth.ts +16 -0
  93. package/src/automation/actions/interaction/get/getCurrentSystemTime.ts +18 -0
  94. package/src/automation/actions/interaction/get/getCurrentSystemYear.ts +18 -0
  95. package/src/automation/actions/interaction/get/getCurrentWindowHandle.ts +36 -0
  96. package/src/automation/actions/interaction/get/getDataFromApiRequestHeaderForJsonPath.ts +21 -0
  97. package/src/automation/actions/interaction/get/getDataFromApiResponseForJsonPath.ts +21 -0
  98. package/src/automation/actions/interaction/get/getDateWithGivenFormat.ts +35 -0
  99. package/src/automation/actions/interaction/get/getDriverInstance.ts +35 -0
  100. package/src/automation/actions/interaction/get/getFirstContentfulPaint.ts +16 -0
  101. package/src/automation/actions/interaction/get/getFirstSelectedOption.ts +44 -0
  102. package/src/automation/actions/interaction/get/getFullPaintTime.ts +16 -0
  103. package/src/automation/actions/interaction/get/getHTMLCodeOfPage.ts +18 -0
  104. package/src/automation/actions/interaction/get/getHeightOfBrowserWindow.ts +18 -0
  105. package/src/automation/actions/interaction/get/getHeightOfWebElement.ts +36 -0
  106. package/src/automation/actions/interaction/get/getHourFromCurrentSystemTime.ts +18 -0
  107. package/src/automation/actions/interaction/get/getImplicitTimeOut.ts +36 -0
  108. package/src/automation/actions/interaction/get/getLargestContentfulPaint.ts +16 -0
  109. package/src/automation/actions/interaction/get/getListBoxSize.ts +41 -0
  110. package/src/automation/actions/interaction/get/getListOfElementsFromLocatorTypeLocatorValue.ts +63 -0
  111. package/src/automation/actions/interaction/get/getLocation.ts +68 -0
  112. package/src/automation/actions/interaction/get/getMinuteFromCurrentSystemTime.ts +18 -0
  113. package/src/automation/actions/interaction/get/getNetworkRouteTime.ts +16 -0
  114. package/src/automation/actions/interaction/get/getNumberOfBrokenImages.ts +16 -0
  115. package/src/automation/actions/interaction/get/getNumberOfLinksPresentInCurrentPage.ts +18 -0
  116. package/src/automation/actions/interaction/get/getNumberOfWorkingLinksFromCurrentPage.ts +15 -0
  117. package/src/automation/actions/interaction/get/getOptions.ts +35 -0
  118. package/src/automation/actions/interaction/get/getPageTitle.ts +18 -0
  119. package/src/automation/actions/interaction/get/getPerformanceMetrics.ts +15 -0
  120. package/src/automation/actions/interaction/get/getPwaScore.ts +20 -0
  121. package/src/automation/actions/interaction/get/getRect.ts +87 -0
  122. package/src/automation/actions/interaction/get/getScreenshot.ts +41 -0
  123. package/src/automation/actions/interaction/get/getScreenshotAs.ts +64 -0
  124. package/src/automation/actions/interaction/get/getSeoScore.ts +20 -0
  125. package/src/automation/actions/interaction/get/getSingleApiRequestPayload.ts +22 -0
  126. package/src/automation/actions/interaction/get/getSingleApiResponse.ts +30 -0
  127. package/src/automation/actions/interaction/get/getSingleApiResponseTime.ts +28 -0
  128. package/src/automation/actions/interaction/get/getSingleApiStatusCode.ts +32 -0
  129. package/src/automation/actions/interaction/get/getSize.ts +68 -0
  130. package/src/automation/actions/interaction/get/getSizeOfBrowserWindow.ts +17 -0
  131. package/src/automation/actions/interaction/get/getStringDataFromLocalFile.ts +25 -0
  132. package/src/automation/actions/interaction/get/getSystemProperty.ts +46 -0
  133. package/src/automation/actions/interaction/get/getTagName.ts +67 -0
  134. package/src/automation/actions/interaction/get/getText.ts +68 -0
  135. package/src/automation/actions/interaction/get/getTheFirstSelectedOptionFromListBoxAsText.ts +44 -0
  136. package/src/automation/actions/interaction/get/getTotalNumberOfCookies.ts +16 -0
  137. package/src/automation/actions/interaction/get/getTunnelIdentifier.ts +25 -0
  138. package/src/automation/actions/interaction/get/getURLPresentInAddressBar.ts +18 -0
  139. package/src/automation/actions/interaction/get/getUserHomeDirectory.ts +16 -0
  140. package/src/automation/actions/interaction/get/getValueByCookieName.ts +27 -0
  141. package/src/automation/actions/interaction/get/getValueFromLocalStorage.ts +26 -0
  142. package/src/automation/actions/interaction/get/getValueOfSystemVariable.ts +20 -0
  143. package/src/automation/actions/interaction/get/getVideoCurrentPlaybackRate.ts +36 -0
  144. package/src/automation/actions/interaction/get/getVideoCurrentSeekTime.ts +36 -0
  145. package/src/automation/actions/interaction/get/getVideoCurrentVolume.ts +36 -0
  146. package/src/automation/actions/interaction/get/getVideoDecodedByte.ts +52 -0
  147. package/src/automation/actions/interaction/get/getVideoDefaultPlaybackRate.ts +36 -0
  148. package/src/automation/actions/interaction/get/getVideoDimension.ts +40 -0
  149. package/src/automation/actions/interaction/get/getVideoHeight.ts +36 -0
  150. package/src/automation/actions/interaction/get/getVideoMediaLength.ts +36 -0
  151. package/src/automation/actions/interaction/get/getVideoMediaSource.ts +46 -0
  152. package/src/automation/actions/interaction/get/getVideoWidth.ts +36 -0
  153. package/src/automation/actions/interaction/get/getWidthOfBrowser.ts +18 -0
  154. package/src/automation/actions/interaction/get/getWidthOfWebElement.ts +36 -0
  155. package/src/automation/actions/interaction/get/getWorkingLinksFromCurrentPage.ts +16 -0
  156. package/src/automation/actions/interaction/get/getWrappedElement.ts +36 -0
  157. package/src/automation/actions/interaction/get/getWrappedOptionFromListBoxAsText.ts +47 -0
  158. package/src/automation/actions/interaction/get/getXLocationOfBrowserWindow.ts +18 -0
  159. package/src/automation/actions/interaction/get/getXLocationOfWebElement.ts +71 -0
  160. package/src/automation/actions/interaction/get/getYLocationOfBrowserWindow.ts +18 -0
  161. package/src/automation/actions/interaction/get/getYLocationOfWebElement.ts +70 -0
  162. package/src/automation/actions/interaction/iframe/switchToDefaultContent.ts +15 -0
  163. package/src/automation/actions/interaction/maximize/maximize.ts +15 -0
  164. package/src/automation/actions/interaction/maximize/minimize.ts +17 -0
  165. package/src/automation/actions/interaction/navigation/goBack.ts +14 -0
  166. package/src/automation/actions/interaction/navigation/navigate.ts +16 -0
  167. package/src/automation/actions/interaction/navigation/refresh.ts +14 -0
  168. package/src/automation/actions/interaction/press/mobPressBackKey.ts +19 -0
  169. package/src/automation/actions/interaction/press/pressAnyKey.ts +89 -0
  170. package/src/automation/actions/interaction/press/pressAnyKeyNTimes.ts +100 -0
  171. package/src/automation/actions/interaction/press/pressEnterKey.ts +45 -0
  172. package/src/automation/actions/interaction/scroll/scrollHorizontallyTillElementIsVisible.ts +29 -0
  173. package/src/automation/actions/interaction/scroll/scrollPageToSpecificLocation.ts +37 -0
  174. package/src/automation/actions/interaction/scroll/scrollToElement.ts +28 -0
  175. package/src/automation/actions/interaction/scroll/scrollVerticallyTillElementIsVisible.ts +29 -0
  176. package/src/automation/actions/interaction/set/setClipBoardText.ts +46 -0
  177. package/src/automation/actions/interaction/shadowDom/shadowDomClick.ts +25 -0
  178. package/src/automation/actions/interaction/shadowDom/shadowDomEnter.ts +27 -0
  179. package/src/automation/actions/interaction/shadowDom/shadowDomGetText.ts +28 -0
  180. package/src/automation/actions/interaction/shadowDom/shadowDomUpload.ts +37 -0
  181. package/src/automation/actions/interaction/shadowDom/shadowDomVerifyPartialText.ts +29 -0
  182. package/src/automation/actions/interaction/shadowDom/shadowDomVerifyText.ts +22 -0
  183. package/src/automation/actions/interaction/switch/switchToNewTabBasedOnTitle.ts +16 -0
  184. package/src/automation/actions/interaction/switch/switchToNewWindowBasedOnTitle.ts +16 -0
  185. package/src/automation/actions/interaction/switch/switchToParentWindow.ts +19 -0
  186. package/src/automation/actions/interaction/switch/switchToTabBasedOnUrl.ts +16 -0
  187. package/src/automation/actions/interaction/switch/switchToWindowBasedOnURL.ts +16 -0
  188. package/src/automation/actions/interaction/switch/switchToWindowIfTitleContainsString.ts +18 -0
  189. package/src/automation/actions/interaction/switch/switchToWindowIfUrlContainsString.ts +18 -0
  190. package/src/automation/actions/interaction/upload/uploadfile.ts +41 -0
  191. package/src/automation/actions/interaction/verify/VerifyAccessibilityScore.ts +90 -0
  192. package/src/automation/actions/interaction/verify/VerifyAllBrokenImages.ts +54 -0
  193. package/src/automation/actions/interaction/verify/VerifyAllBrowserWindowsClosed.ts +27 -0
  194. package/src/automation/actions/interaction/verify/VerifyAllOptionsAreDeSelected.ts +55 -0
  195. package/src/automation/actions/interaction/verify/VerifyAllOptionsAreSelected.ts +66 -0
  196. package/src/automation/actions/interaction/verify/VerifyAttributeValue.ts +96 -0
  197. package/src/automation/actions/interaction/verify/VerifyBestPracticesScore.ts +87 -0
  198. package/src/automation/actions/interaction/verify/VerifyBrowserHtmlCodeContainsString.ts +35 -0
  199. package/src/automation/actions/interaction/verify/VerifyBrowserWindowHeight.ts +35 -0
  200. package/src/automation/actions/interaction/verify/VerifyBrowserWindowTitleContainsString.ts +31 -0
  201. package/src/automation/actions/interaction/verify/VerifyBrowserWindowTitleIsString.ts +30 -0
  202. package/src/automation/actions/interaction/verify/VerifyBrowserWindowUrlContainsExpectedUrl.ts +30 -0
  203. package/src/automation/actions/interaction/verify/VerifyBrowserWindowUrlIsString.ts +30 -0
  204. package/src/automation/actions/interaction/verify/VerifyBrowserWindowWidth.ts +35 -0
  205. package/src/automation/actions/interaction/verify/VerifyBrowserWindowXLocation.ts +36 -0
  206. package/src/automation/actions/interaction/verify/VerifyBrowserWindowYLocation.ts +35 -0
  207. package/src/automation/actions/interaction/verify/VerifyCheckBoxIsNotSelected.ts +46 -0
  208. package/src/automation/actions/interaction/verify/VerifyCheckBoxIsSelected.ts +43 -0
  209. package/src/automation/actions/interaction/verify/VerifyCssAttributeValue.ts +62 -0
  210. package/src/automation/actions/interaction/verify/VerifyElementIsClickable.ts +86 -0
  211. package/src/automation/actions/interaction/verify/VerifyElementIsDisabled.ts +91 -0
  212. package/src/automation/actions/interaction/verify/VerifyElementIsDisplayed.ts +87 -0
  213. package/src/automation/actions/interaction/verify/VerifyElementIsEnabled.ts +87 -0
  214. package/src/automation/actions/interaction/verify/VerifyElementIsNotDisplayed.ts +45 -0
  215. package/src/automation/actions/interaction/verify/VerifyElementIsSelected.ts +83 -0
  216. package/src/automation/actions/interaction/verify/VerifyElementNotContainsText.ts +129 -0
  217. package/src/automation/actions/interaction/verify/VerifyHeightOfWebElement.ts +101 -0
  218. package/src/automation/actions/interaction/verify/VerifyHexCodeForGivenXYCoordinates.ts +51 -0
  219. package/src/automation/actions/interaction/verify/VerifyIfAllCookiesAreDeleted.ts +27 -0
  220. package/src/automation/actions/interaction/verify/VerifyIfAudioEnded.ts +48 -0
  221. package/src/automation/actions/interaction/verify/VerifyIfAudioIsMuted.ts +48 -0
  222. package/src/automation/actions/interaction/verify/VerifyIfAudioIsPaused.ts +48 -0
  223. package/src/automation/actions/interaction/verify/VerifyIfAudioIsPlaying.ts +57 -0
  224. package/src/automation/actions/interaction/verify/VerifyIfBrowserWindowIsClosed.ts +27 -0
  225. package/src/automation/actions/interaction/verify/VerifyIfCookieNameIsAdded.ts +38 -0
  226. package/src/automation/actions/interaction/verify/VerifyIfCookieNameIsDeleted.ts +33 -0
  227. package/src/automation/actions/interaction/verify/VerifyIfCookieObjectIsPresent.ts +49 -0
  228. package/src/automation/actions/interaction/verify/VerifyIfGivenOptionIsDuplicate.ts +60 -0
  229. package/src/automation/actions/interaction/verify/VerifyIfImageIsBroken.ts +40 -0
  230. package/src/automation/actions/interaction/verify/VerifyIfLinkIsBroken.ts +38 -0
  231. package/src/automation/actions/interaction/verify/VerifyIfLinkIsWorking.ts +37 -0
  232. package/src/automation/actions/interaction/verify/VerifyIfLinksAreBroken.ts +46 -0
  233. package/src/automation/actions/interaction/verify/VerifyIfLinksAreWorking.ts +45 -0
  234. package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsDeselectedInElement.ts +75 -0
  235. package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsSelectedInListBox.ts +77 -0
  236. package/src/automation/actions/interaction/verify/VerifyIfOptionWithTextIsDeselected.ts +40 -0
  237. package/src/automation/actions/interaction/verify/VerifyIfOptionWithValueIsDeselected.ts +61 -0
  238. package/src/automation/actions/interaction/verify/VerifyIfOptionWithValueIsSelected.ts +58 -0
  239. package/src/automation/actions/interaction/verify/VerifyIfOptionWithVisibleTextIsSelected.ts +40 -0
  240. package/src/automation/actions/interaction/verify/VerifyIfSpecifiedOptionIsSelected.ts +78 -0
  241. package/src/automation/actions/interaction/verify/VerifyIfStatusCodeOfALinkIsStatusCode.ts +37 -0
  242. package/src/automation/actions/interaction/verify/VerifyIfStatusCodesOfLinks.ts +46 -0
  243. package/src/automation/actions/interaction/verify/VerifyIfVideoEnded.ts +49 -0
  244. package/src/automation/actions/interaction/verify/VerifyIfVideoIsMuted.ts +49 -0
  245. package/src/automation/actions/interaction/verify/VerifyIfVideoIsPaused.ts +49 -0
  246. package/src/automation/actions/interaction/verify/VerifyIfVideoIsPlaying.ts +50 -0
  247. package/src/automation/actions/interaction/verify/VerifyIfVideoPlayingInMute.ts +58 -0
  248. package/src/automation/actions/interaction/verify/VerifyIfVideoPlayingInUnmute.ts +58 -0
  249. package/src/automation/actions/interaction/verify/VerifyIfXAndYCoordinateOfElement.ts +101 -0
  250. package/src/automation/actions/interaction/verify/VerifyLinkNavigatesToTitle.ts +41 -0
  251. package/src/automation/actions/interaction/verify/VerifyListBoxOptionsAreSorted.ts +72 -0
  252. package/src/automation/actions/interaction/verify/VerifyNavigateURL.ts +34 -0
  253. package/src/automation/actions/interaction/verify/VerifyNumberOfElementsByTagName.ts +35 -0
  254. package/src/automation/actions/interaction/verify/VerifyNumberOfElementsByXpath.ts +52 -0
  255. package/src/automation/actions/interaction/verify/VerifyPartialAttributeValue.ts +94 -0
  256. package/src/automation/actions/interaction/verify/VerifyPartialTitleOfCurrentPage.ts +29 -0
  257. package/src/automation/actions/interaction/verify/VerifyPerformanceScore.ts +84 -0
  258. package/src/automation/actions/interaction/verify/VerifyPwaScore.ts +66 -0
  259. package/src/automation/actions/interaction/verify/VerifyRadioButtonIsNotSelected.ts +42 -0
  260. package/src/automation/actions/interaction/verify/VerifyRadioButtonIsSelected.ts +42 -0
  261. package/src/automation/actions/interaction/verify/VerifySeoScore.ts +79 -0
  262. package/src/automation/actions/interaction/verify/VerifyTagName.ts +44 -0
  263. package/src/automation/actions/interaction/verify/VerifyThatSpecifiedOptionIsNotSelected.ts +73 -0
  264. package/src/automation/actions/interaction/verify/VerifyTitleInAllPage.ts +51 -0
  265. package/src/automation/actions/interaction/verify/VerifyTitleOfCurrentPage.ts +30 -0
  266. package/src/automation/actions/interaction/verify/VerifyValueOfElementContainsString.ts +51 -0
  267. package/src/automation/actions/interaction/verify/VerifyValueOfElementIsCleared.ts +45 -0
  268. package/src/automation/actions/interaction/verify/VerifyValueOfElementIsString.ts +54 -0
  269. package/src/automation/actions/interaction/verify/VerifyWidthOfElement.ts +90 -0
  270. package/src/automation/actions/interaction/verify/VerifyXLocationOfElement.ts +89 -0
  271. package/src/automation/actions/interaction/verify/VerifyYLocationOfElement.ts +90 -0
  272. package/src/automation/actions/interaction/verify/checkIfElementIsDisplayed.ts +83 -0
  273. package/src/automation/actions/interaction/verify/verifypartialtext.ts +131 -0
  274. package/src/automation/actions/interaction/verify/verifytext.ts +143 -0
  275. package/src/automation/actions/interaction/wait/wait.ts +16 -0
  276. package/src/automation/actions/interaction/wait/waitTillAttributeOfElementIsString.ts +88 -0
  277. package/src/automation/actions/interaction/wait/waitTillElementContainsText.ts +79 -0
  278. package/src/automation/actions/interaction/wait/waitTillElementHasText.ts +71 -0
  279. package/src/automation/actions/interaction/wait/waitTillElementIsClickable.ts +72 -0
  280. package/src/automation/actions/interaction/wait/waitTillPresenceOfAllElements.ts +72 -0
  281. package/src/automation/actions/interaction/wait/waitTillPresenceOfElement.ts +67 -0
  282. package/src/automation/actions/interface/IframeInterface.ts +6 -0
  283. package/src/automation/actions/interface/alertActionInterface.ts +39 -0
  284. package/src/automation/actions/interface/clearActionInterface.ts +27 -0
  285. package/src/automation/actions/interface/clickActionInterface.ts +87 -0
  286. package/src/automation/actions/interface/dragAndDropToElementInterface.ts +18 -0
  287. package/src/automation/actions/interface/findActionInterface.ts +15 -0
  288. package/src/automation/actions/interface/getActionInterface.ts +873 -0
  289. package/src/automation/actions/interface/interactionActionInterface.ts +51 -3
  290. package/src/automation/actions/interface/maximizeAndMinimizeInterface.ts +12 -0
  291. package/src/automation/actions/interface/navigationActionInterface.ts +1 -1
  292. package/src/automation/actions/interface/pressActionInterface.ts +25 -0
  293. package/src/automation/actions/interface/scrollActionInterface.ts +45 -0
  294. package/src/automation/actions/interface/setActionInterface.ts +10 -0
  295. package/src/automation/actions/interface/shadowDomInterface.ts +78 -0
  296. package/src/automation/actions/interface/switchingActionInterface.ts +93 -0
  297. package/src/automation/actions/interface/uploadFile.ts +14 -0
  298. package/src/automation/actions/interface/verifyActionInterface.ts +743 -0
  299. package/src/automation/actions/interface/waitActionInterface.ts +75 -0
  300. package/src/automation/browserSession/initiateBrowserSession.ts +12 -40
  301. package/src/automation/mobileSession/initiateMobileSession.ts +81 -0
  302. package/src/core/constants/allAction.ts +21 -0
  303. package/src/core/constants/defaultValues.ts +1 -0
  304. package/src/core/constants/supportedActions.ts +27 -2
  305. package/src/core/interfaces/actionInterface.ts +238 -3
  306. package/src/core/interfaces/automationRunnerInterface.ts +2 -1
  307. package/src/core/interfaces/browserCapabilitiesInterface.ts +1 -3
  308. package/src/core/interfaces/errorInfoInterface.ts +7 -0
  309. package/src/core/interfaces/executionDetails.ts +10 -6
  310. package/src/core/interfaces/fireflinkScriptPayloadInterface.ts +17 -5
  311. package/src/core/interfaces/llmResponseInterface.ts +28 -4
  312. package/src/core/interfaces/promptInterface.ts +20 -0
  313. package/src/core/interfaces/scriptGenrationDataInterface.ts +2 -2
  314. package/src/core/interfaces/simplifyAndFlattenInterface.ts +13 -0
  315. package/src/core/main/actionHandlerFactory.ts +1528 -53
  316. package/src/core/main/executionContext.ts +5 -1
  317. package/src/core/main/runAutomationScript.ts +528 -123
  318. package/src/core/main/stepProcessor.ts +4 -2
  319. package/src/core/types/llmResponseType.ts +7 -3
  320. package/src/core/types/promptMap.ts +7 -4
  321. package/src/core/types/promptType.ts +6 -0
  322. package/src/core/types/scriptTypesType.ts +1 -0
  323. package/src/domAnalysis/getRelaventElements.ts +10 -1
  324. package/src/domAnalysis/relativeElementsFromDom.ts +205 -0
  325. package/src/domAnalysis/searchBest.ts +130 -17
  326. package/src/domAnalysis/simplifyAndFlatten.ts +139 -10
  327. package/src/fireflinkData/fireflinkLocators/getListOfLocators.ts +1 -2
  328. package/src/fireflinkData/fireflinkScript/scriptGenrationData.ts +70 -21
  329. package/src/imageAnalysisMobile/annotatedScreenshotMobile.ts +137 -0
  330. package/src/imageAnalysisMobile/annotatedScreenshotMobileInterface.ts +6 -0
  331. package/src/imageAnalysisWeb/annotateScreenshot.ts +196 -0
  332. package/src/imageAnalysisWeb/generateAnnotatedScreenshots.ts +43 -0
  333. package/src/imageAnalysisWeb/screenshotInterface.ts +18 -0
  334. package/src/index.ts +2 -2
  335. package/src/service/{fireflinkApi.service.ts → api/fireflinkApi.service.ts} +5 -7
  336. package/src/service/kafka/fireflinkKafka.service.ts +25 -0
  337. package/src/service/scriptRunner.service.ts +23 -42
  338. package/src/utils/DomExtraction/jsForAttributeInjection.ts +68 -12
  339. package/src/utils/InstancesDetails/getInstancesInfo.ts +12 -0
  340. package/src/utils/alertPopup/isAlertPresent.ts +20 -0
  341. package/src/utils/alertPopup/isAlertPresentInterface.ts +6 -0
  342. package/src/utils/helpers/enterActionHelper.ts +88 -2
  343. package/src/utils/helpers/imageUtils.ts +10 -0
  344. package/src/utils/helpers/sameActionsHelper.ts +52 -0
  345. package/src/utils/helpers/xpathcreation.ts +59 -0
  346. package/src/utils/iframesExtraction/findElementUsingFF.ts +45 -0
  347. package/src/utils/iframesExtraction/iframeInterface.ts +22 -0
  348. package/src/utils/iframesExtraction/switchToIframeByMeta.ts +23 -0
  349. package/src/utils/javascript/jsFindElement.ts +39 -31
  350. package/src/utils/javascript/jsForShadowRoot.ts +9 -9
  351. package/src/utils/javascript/jsForVision.ts +151 -0
  352. package/src/utils/logger/logData.ts +126 -47
  353. package/src/utils/mobileXpath/findXpathFromIndex.ts +87 -0
  354. package/src/utils/mobileXpath/findXpathFromIndexInterface.ts +4 -0
  355. package/src/utils/newTab/newTabTracker.ts +62 -0
  356. package/src/automation/actions/interaction/click.ts +0 -25
  357. package/src/automation/actions/interaction/enterInput.ts +0 -36
  358. package/src/automation/actions/navigation/getTitle.ts +0 -9
  359. package/src/automation/actions/navigation/goBack.ts +0 -9
  360. package/src/automation/actions/navigation/navigate.ts +0 -10
  361. package/src/automation/actions/navigation/refresh.ts +0 -9
  362. package/src/automation/actions/wait/wait.ts +0 -10
package/.env ADDED
@@ -0,0 +1 @@
1
+ KAFKAJS_NO_PARTITIONER_WARNING=1
@@ -0,0 +1,5 @@
1
+ echo "Linting code..."
2
+ npm run lint
3
+
4
+ echo "Running TypeScript check..."
5
+ npm run type-check
package/ARCHITECTURE.md CHANGED
@@ -71,6 +71,8 @@ AutomationRunner
71
71
 
72
72
  FOR EACH STEP
73
73
 
74
+ Is termination check
75
+
74
76
  LLM → Action + Keywords
75
77
 
76
78
  Inject Annotated DOM
@@ -93,16 +95,17 @@ AutomationRunner
93
95
  │ │
94
96
  NO YES
95
97
  │ │
96
- │ Append CloseBrowser
98
+ │ Append CloseBrowser
99
+ | (add manual step, nlp name if available)
97
100
  │ ↓
98
- Stop Execution
101
+ Add error info via LLM
99
102
  │ |
100
103
  ↓ |
101
104
  Continue Next Step |
102
105
  ↓ |
103
106
  (all Steps Complete) |
104
107
  | |
105
- | |
108
+ | Stop Execution
106
109
  └──────┬──────┘
107
110
  Collect Token Usage
108
111
 
package/Note.md ADDED
@@ -0,0 +1,7 @@
1
+ API calls are often faster in TypeScript (Node.js) because:
2
+
3
+ Non-blocking networking
4
+ Single event loop for async tasks
5
+ Efficient socket and connection reuse
6
+ Optimized JSON parsing in V8
7
+ Lower runtime overhead per request
package/RELEASE_GUIDE.md CHANGED
@@ -3,7 +3,7 @@
3
3
  git checkout feature/your-feature-name
4
4
  git add .
5
5
  git commit -m "feat: new changes"
6
- git pull --rebase
6
+ git pull
7
7
  npm version prerelease --preid=beta
8
8
  git push --follow-tags
9
9
 
@@ -2,35 +2,14 @@ image: node:20
2
2
 
3
3
  pipelines:
4
4
  branches:
5
- "feature/automation_V2":
6
- - step:
7
- name: Publish Beta
8
- caches:
9
- - node
10
- script:
11
- - echo "Installing dependencies"
12
- - npm ci
13
-
14
- - echo "Building project"
15
- - npm run build
16
-
17
- - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
18
-
19
- - echo "Publishing as beta"
20
- - npm publish --tag beta --access public
21
- "release/automation_V2":
5
+ release/automation_V2:
22
6
  - step:
23
7
  name: Publish Production
24
8
  caches:
25
9
  - node
26
10
  script:
27
- - echo "Installing dependencies"
28
11
  - npm ci
29
-
30
- - echo "Building project"
12
+ - npm run lint
31
13
  - npm run build
32
-
33
- - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
34
-
35
- - echo "Publishing as latest"
36
- - npm publish --access public
14
+ - echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
15
+ - npm publish --access public
package/eslint.config.ts CHANGED
@@ -4,6 +4,9 @@ import tseslint from "typescript-eslint";
4
4
  import { defineConfig } from "eslint/config";
5
5
 
6
6
  export default defineConfig([
7
+ {
8
+ ignores: ["src/tests/**", "dist/**", "node_modules/**"]
9
+ },
7
10
  {
8
11
  files: ["**/*.{js,mjs,cjs,ts,mts,cts}"],
9
12
  plugins: { js },
@@ -15,6 +18,7 @@ export default defineConfig([
15
18
 
16
19
  {
17
20
  rules: {
21
+ "no-useless-escape": "off",
18
22
  "no-console": ["error", { allow: ["warn", "error"] }],
19
23
  "@typescript-eslint/no-explicit-any": "off",
20
24
  "@typescript-eslint/no-unused-vars": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ff-automationv2",
3
- "version": "2.1.3",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "This lib is used to automate the manual testcase",
@@ -9,45 +9,57 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "import": "./dist/index.js",
12
+ "require": "./dist/index.js",
12
13
  "types": "./dist/index.d.ts"
13
14
  }
14
15
  },
15
16
  "scripts": {
17
+ "type-check": "tsc --noEmit",
16
18
  "builds": "npm run lint && tsc",
17
- "build": "tsc",
18
- "prepare": "npm run build",
19
+ "build": "eslint . && tsc && echo Build Successful",
20
+ "prepare": "husky",
19
21
  "lint": "eslint src --max-warnings=0",
20
22
  "test": "npm run build && node dist/tests/test12.js",
21
23
  "llm": "npm run build && node dist/tests/testllm.js",
22
24
  "dev": "npm run build && node dist/index.js",
23
25
  "start": "node dist/index.js",
24
- "file": "node dist/domAnalysis/getXpath.js"
26
+ "file": "node dist/domAnalysis/getXpath.js",
27
+ "error": "node dist/tests/test12.js",
28
+ "bro": "node dist/tests/test3.js"
25
29
  },
26
30
  "keywords": [],
27
31
  "author": "Diwahar R",
28
32
  "license": "ISC",
29
33
  "devDependencies": {
30
34
  "@eslint/js": "10.0.1",
35
+ "@types/fs-extra": "^11.0.4",
31
36
  "@types/js-beautify": "^1.14.3",
32
37
  "@types/jsdom": "27.0.0",
33
- "@types/node": "25.2.2",
38
+ "@types/node": "^25.4.0",
34
39
  "eslint": "10.0.0",
35
40
  "globals": "17.3.0",
41
+ "husky": "^9.1.7",
36
42
  "jiti": "2.6.1",
37
43
  "nodemon": "3.1.11",
38
44
  "ts-node": "10.9.2",
39
- "typescript": "5.9.3",
45
+ "typescript": "^5.9.3",
40
46
  "typescript-eslint": "8.56.0"
41
47
  },
42
48
  "dependencies": {
43
- "axios": "1.13.5",
49
+ "@xmldom/xmldom": "^0.8.11",
50
+ "axios": "^1.13.5",
51
+ "canvas": "3.2.1",
44
52
  "cheerio": "1.2.0",
53
+ "devtools": "^8.42.0",
54
+ "dotenv": "^17.3.1",
55
+ "fast-fuzzy": "^1.12.0",
45
56
  "fs-extra": "11.3.3",
46
- "fuzzball": "2.2.3",
47
57
  "js-beautify": "1.15.1",
48
58
  "jsdom": "27.4.0",
59
+ "kafkajs": "^2.2.4",
49
60
  "openai": "6.18.0",
50
61
  "uuid": "13.0.0",
51
- "webdriverio": "9.23.3"
62
+ "webdriverio": "8.46.0",
63
+ "xpath": "^0.0.34"
52
64
  }
53
65
  }
@@ -7,7 +7,7 @@ export function decodeApiKey(apiKey: string): string {
7
7
  try {
8
8
  return Buffer.from(apiKey, "base64").toString("utf-8");
9
9
  } catch (error) {
10
- throw new Error("Failed to decode API key", { cause: error });
10
+ throw new Error("Failed to decode API key", { cause: error });
11
11
  }
12
12
  }
13
13
 
@@ -1,89 +1,196 @@
1
1
  import { prompts } from "../llmprompts/promptRegistry.js";
2
2
  import OpenAI from "openai";
3
3
  import { decodeApiKey } from "./decodeApiKey.js";
4
- import { FireFlinkLLMResponse } from "../../core/types/llmResponseType.js"
5
- import { PromptArgsMap } from "../../core/interfaces/promptInterface.js"
6
- import { userInputFormatters } from "../../ai/llmprompts/userPrompts/userPrompt.js"
7
- import { visionPromptMessage } from "../../core/types/visionllmInputType.js"
4
+ import { FireFlinkLLMResponse } from "../../core/types/llmResponseType.js";
5
+ import { PromptArgsMap } from "../../core/interfaces/promptInterface.js";
6
+ import { userInputFormatters } from "../../ai/llmprompts/userPrompts/userPrompt.js";
7
+ import { visionPromptMessage } from "../../core/types/visionllmInputType.js";
8
8
  import { PromptType } from "../../core/types/promptType.js";
9
+ import { platform } from "../../core/types/scriptTypesType.js"
10
+ import { logger } from "../../utils/logger/logData.js";
11
+
9
12
  export class llmAction {
10
13
  private client: OpenAI;
14
+ private visionClient: OpenAI;
11
15
  private model: string;
12
- private visionClient: OpenAI
16
+ private visionApiKey: string
17
+
13
18
  constructor(
14
19
  apiKey: string,
15
20
  baseURL: string,
16
21
  model: string,
17
- visionApiKey: string
22
+ visionApiKey: string,
18
23
  ) {
19
24
  this.model = model;
25
+ this.visionApiKey = visionApiKey;
20
26
  this.client = new OpenAI({
21
27
  apiKey: decodeApiKey(apiKey),
22
28
  baseURL: baseURL,
23
29
  });
24
30
  this.visionClient = new OpenAI({
25
- apiKey: decodeApiKey(visionApiKey),
31
+ apiKey: decodeApiKey(this.visionApiKey),
26
32
  });
27
33
 
28
34
  }
29
35
 
30
- private async getLLMResponseText(system: string, user: string): Promise<FireFlinkLLMResponse> {
31
- const response = await this.client.chat.completions.create({
32
- model: this.model,
33
- messages: [
34
- {
35
- role: "system",
36
- content: system
37
- },
38
- {
39
- role: "user",
40
- content: user
41
- }
42
- ],
43
- response_format: { type: "json_object" }
44
- });
45
- try {
46
36
 
47
- return response;
48
- } catch {
49
- throw new Error(`Invalid JSON returned from LLM `);
50
- }
51
- }
52
37
  async getLLMResponse<K extends keyof PromptArgsMap>(
38
+ platform: platform,
53
39
  type: K,
54
40
  args: PromptArgsMap[K],
55
41
  userInput: Record<string, any>
56
42
  ): Promise<FireFlinkLLMResponse> {
57
- const promptBuilder: (args: PromptArgsMap[K]) => Promise<string> =
58
- prompts[type];
43
+ const promptBuilder = prompts[platform][type];
59
44
  const systemPrompt = await promptBuilder(args);
60
- const userPrompt: string | visionPromptMessage = userInputFormatters[type](userInput);
45
+ const userPrompt = userInputFormatters[type](userInput);
46
+
61
47
  if (type === PromptType.VISION_PROMPT && Array.isArray(userPrompt)) {
62
48
  return this.getLLMResponseWithVision(systemPrompt, userPrompt);
63
49
  }
50
+
64
51
  if (typeof userPrompt !== "string") {
65
52
  throw new Error("Invalid non-vision user prompt format");
66
53
  }
54
+
67
55
  return this.getLLMResponseText(systemPrompt, userPrompt);
68
56
  }
69
57
 
70
- private async getLLMResponseWithVision(system: any, userPrompt: visionPromptMessage): Promise<string> {
71
- const response = await this.visionClient.chat.completions.create({
72
- model: "gpt-4.1",
73
- messages: [
74
- {
75
- role: "system",
76
- content: system
77
- },
78
- {
79
- role: "user",
80
- content: userPrompt
58
+ private async getLLMResponseText(
59
+ system: string,
60
+ user: string
61
+ ): Promise<FireFlinkLLMResponse> {
62
+ let attempt = 0;
63
+ const MAX_RETRIES = 5
64
+ const startTime = new Date().getTime()
65
+ while (attempt < MAX_RETRIES) {
66
+ attempt++;
67
+ try {
68
+ const response = await this.client.chat.completions.create({
69
+ model: this.model,
70
+ messages: [
71
+ { role: "system", content: system },
72
+ { role: "user", content: user },
73
+ ],
74
+ response_format: { type: "json_object" },
75
+ });
76
+
77
+ const content = response.choices?.[0]?.message?.content;
78
+
79
+ logger.info(`LLM Attempt ${attempt} - Raw Response:`, content);
80
+
81
+ if (this.isInvalidLLMOutput(content)) {
82
+ logger.error(`Invalid LLM output. Retrying (${attempt})`);
83
+ continue;
81
84
  }
82
- ],
83
- response_format: { type: "json_object" }
84
- });
85
- return response.choices[0].message.content || "";
85
+ logger.info("Time taken to get LLM response (Text):", Date.now() - startTime, "ms");
86
+ return response as FireFlinkLLMResponse;
87
+ } catch (error: any) {
88
+ logger.error(`LLM Error Attempt ${attempt}:`, error);
89
+
90
+ const structuredError = this.handleKnownErrors(error);
91
+ if (structuredError) return structuredError;
92
+
93
+ }
94
+ }
95
+
96
+ return this.buildRetryFailure();
97
+ }
98
+ private async getLLMResponseWithVision(
99
+ system: string,
100
+ userPrompt: visionPromptMessage
101
+ ): Promise<FireFlinkLLMResponse> {
102
+ let attempt = 0;
103
+ const MAX_RETRIES = 5
104
+ const startTime = new Date().getTime()
105
+ while (attempt < MAX_RETRIES) {
106
+ attempt++;
107
+
108
+ try {
109
+ const response = await this.visionClient.chat.completions.create({
110
+ model: "gpt-4.1",
111
+ messages: [
112
+ { role: "system", content: system },
113
+ { role: "user", content: userPrompt },
114
+ ],
115
+ response_format: { type: "json_object" },
116
+ });
117
+
118
+ const content = response.choices?.[0]?.message?.content;
119
+
120
+ logger.info(`Vision LLM Attempt ${attempt} - Raw Response:`, content);
121
+
122
+ if (this.isInvalidLLMOutput(content)) {
123
+ logger.error(`Invalid Vision output. Retrying (${attempt})`);
124
+ continue;
125
+ }
126
+ logger.info("Time taken to get LLM response (vision):", Date.now() - startTime, "ms");
127
+ return response as FireFlinkLLMResponse;
128
+ } catch (error: any) {
129
+ logger.error(`Vision LLM Error Attempt ${attempt}:`, error);
130
+
131
+ const structuredError = this.handleKnownErrors(error);
132
+ if (structuredError) return structuredError;
133
+ }
134
+ }
135
+
136
+ return this.buildRetryFailure();
86
137
  }
87
138
 
139
+ private isInvalidLLMOutput(content: any): boolean {
140
+ if (!content) return true;
141
+
142
+ if (typeof content === "string") {
143
+ const trimmed = content.trim();
144
+ if (!trimmed) return true;
145
+ if (trimmed === "{}") return true;
146
+
147
+ try {
148
+ const parsed = JSON.parse(trimmed);
149
+ if (
150
+ typeof parsed === "object" &&
151
+ parsed !== null &&
152
+ Object.keys(parsed).length === 0
153
+ ) {
154
+ return true;
155
+ }
156
+ } catch {
157
+ return true;
158
+ }
159
+ }
160
+
161
+ return false;
162
+ }
163
+
164
+ private handleKnownErrors(error: any): FireFlinkLLMResponse | null {
165
+ if (error?.status === 429) {
166
+ return {
167
+ error: "Rate Limit Exceeded (429)",
168
+ errorDescription: "FireFlink has exceeded the API quota or rate limit for the selected AI model. \n This is common with free or low-tier API plans \n Please wait a moment before retrying or check your API usage limits.",
169
+ rawError: "Rate limit reached for model. HTTP 429 returned by model"
170
+ };
171
+ }
172
+
173
+ if (
174
+ error?.status === 400 &&
175
+ error?.error?.message?.toLowerCase().includes("context")
176
+ ) {
177
+ return {
178
+ error: "Context Length Exceeded (400)",
179
+ errorDescription: "FireFlink could not process the request because the input exceeds the maximum context length supported by the selected AI model.\nThis typically happens when the input is very long",
180
+ rawError: "This model's maximum context length has been exceeded. HTTP 400 returned by model"
181
+ };
182
+ }
183
+
184
+ return null;
185
+ }
186
+
187
+ private buildRetryFailure(): FireFlinkLLMResponse {
188
+ return {
189
+ error: "LLM Empty Response After Retry",
190
+ errorDescription:
191
+ "FireFlink attempted multiple times but received empty or invalid responses.",
192
+ rawError: "Max retry limit reached",
193
+ };
194
+ }
88
195
 
89
- }
196
+ }
@@ -0,0 +1,45 @@
1
+ export type keywordExtractor = {
2
+ priorAndNextSteps: string[];
3
+
4
+ };
5
+
6
+ export type FFInspectorArgs = {
7
+ stepAction: string;
8
+ extractedDomJson: string;
9
+ priorAndNextSteps: string[];
10
+ isAlert?: boolean;
11
+ isDrag?: boolean;
12
+ };
13
+ export type FFInspectorArgsMob = {
14
+ stepAction: string;
15
+ extractedDomJson: string;
16
+ priorAndNextSteps: string[];
17
+ };
18
+
19
+ export type getActionArgs = {
20
+ extractedDomJson: string;
21
+ priorAndNextSteps: string[];
22
+ }
23
+
24
+ export type verifyActionArgs = {
25
+ extractedDomJson: string;
26
+ priorAndNextSteps: string[];
27
+ }
28
+
29
+ export type visionPrompt = {
30
+ priorAndNextSteps: string[]
31
+ }
32
+
33
+ export type visionPromptMobile = {
34
+ priorAndNextSteps: string[]
35
+ }
36
+
37
+ export type waitActionArgs = {
38
+ extractedDomJson: string;
39
+ priorAndNextSteps: string[]
40
+ }
41
+
42
+ export type combinedActionArgs = {
43
+ extractedDomJson: string;
44
+ priorAndNextSteps: string[]
45
+ }
@@ -1,16 +1,42 @@
1
1
  import { keywordExtractor } from "./systemPrompts/actionExtractorPrompt.js";
2
- import { buildStepExtractionPrompt } from "./systemPrompts/userStoryToListPrompt.js";
2
+ import { buildStepExtractionPrompt, androidbuildStepExtractionPrompt } from "./systemPrompts/userStoryToListPrompt.js";
3
3
  import { buildErrorDescriptionPrompt } from "./systemPrompts/errorDescriptionPrompt.js";
4
4
  import { ffInspectorNumExtractor } from "./systemPrompts/fireflinkElementIndexExtactors.js";
5
+ import { ffInspectorNumExtractorMob } from "./systemPrompts/fireflinkElementIndexExtractor_Mob.js";
5
6
  import { visionPrompt } from "./systemPrompts/visionPrompt.js";
7
+ import { visionPromptMobile } from "./systemPrompts/visionPromptMobile.js";
6
8
  import { PromptMap } from "../../core/types/promptMap.js";
7
-
8
-
9
+ import { verifyActionExtractorPrompt } from "./systemPrompts/verifyActionExtractorPrompt.js";
10
+ import { getActionExtractorPrompt } from "./systemPrompts/getActionExtractorPrompt.js";
11
+ import { verifyActionExtractorPromptMob } from "./systemPrompts/verifyActionExtractorPromptMob.js";
12
+ import { getActionExtractorPromptMob } from "./systemPrompts/getActionExtractorPromptMob.js";
13
+ import { keywordExtractorMobile } from "./systemPrompts/mobileKeywordExtractor.js";
14
+ import { combinedActionExtractorPromptMob } from "./systemPrompts/combinedActionExtractorPromptMob.js";
15
+ import { waitActionExtractorPromptMob } from "./systemPrompts/waitActionExtractorPromptMob.js";
16
+ import{waitActionExtractorPrompt} from "./systemPrompts/waitActionExtractorPrompt.js";
17
+ import { combinedActionExtractorPrompt } from "./systemPrompts/combinedActionExtractorPrompt.js";
9
18
  export const prompts: PromptMap = {
10
- userStoryToList: buildStepExtractionPrompt,
11
- keywordExtractorPrompt: keywordExtractor,
12
- errorDescriptionPrompt: buildErrorDescriptionPrompt,
13
- ffInspectorNumExtractor: ffInspectorNumExtractor,
14
- visionPrompt: visionPrompt,
19
+ web: {
20
+ userStoryToList: buildStepExtractionPrompt,
21
+ keywordExtractorPrompt: keywordExtractor,
22
+ errorDescriptionPrompt: buildErrorDescriptionPrompt,
23
+ ffInspectorNumExtractor: ffInspectorNumExtractor,
24
+ verifyActionExtractorPrompt: verifyActionExtractorPrompt,
25
+ visionPrompt: visionPrompt,
26
+ getActionExtractorPrompt: getActionExtractorPrompt,
27
+ combinedActionExtractorPrompt: combinedActionExtractorPrompt,
28
+ waitActionExtractorPrompt: waitActionExtractorPrompt,
29
+ },
30
+ android: {
31
+ userStoryToList: androidbuildStepExtractionPrompt,
32
+ keywordExtractorPrompt: keywordExtractorMobile,
33
+ errorDescriptionPrompt: buildErrorDescriptionPrompt,
34
+ ffInspectorNumExtractor: ffInspectorNumExtractorMob,
35
+ verifyActionExtractorPrompt: verifyActionExtractorPromptMob,
36
+ visionPrompt: visionPromptMobile,
37
+ getActionExtractorPrompt: getActionExtractorPromptMob,
38
+ combinedActionExtractorPrompt: combinedActionExtractorPromptMob,
39
+ waitActionExtractorPrompt: waitActionExtractorPromptMob,
40
+ }
15
41
  };
16
42
 
@@ -1,13 +1,10 @@
1
1
 
2
- type keywordExtractor = {
3
- priorAndNextSteps: string[];
4
-
5
- };
2
+ import { keywordExtractor } from "../llmPromptTypes/systemPromptTypes"
6
3
  export async function keywordExtractor(
7
4
  { priorAndNextSteps }: keywordExtractor
8
5
  ): Promise<string> {
9
6
 
10
- const allowedActions: string[] = ["enter", "wait", "verify", "scroll", "navigate", "click", "maximize", "get", "upload", "close", "open", "drag_and_drop", "switch", "cleartext"];
7
+ const allowedActions: string[] = ["enter", "wait", "verify", "scroll", "navigate", "click", "maximize", "minimize", "get", "upload", "close", "open", "drag_and_drop", "switch", "cleartext"];
11
8
 
12
9
  const prompt = `
13
10
  You are an expert in Web application testing.
@@ -15,7 +12,7 @@ You are an expert in Web application testing.
15
12
  Rules:
16
13
  - Only give response for the current step.
17
14
  - understand the step and context from the ${JSON.stringify(priorAndNextSteps)}.and keywords should be from step. it should not be related to other steps.
18
- - 3 to 5 keywords maximum. dont give more than 5 keywords. and no need for casesensitive.
15
+ - 3 to 5 keywords maximum. dont give more than 5 keywords. and no need for casesensitive.And first keyword should be full keyword from step same as mentioned.like (click on search bar.in -> "search bar.in")
19
16
  - If the step is about entering text or Uploading file, Should NOT include input value from the step into keywords.
20
17
  - If the step has words like tag name audio, video, image,svg, checkbox etc, include them in the keywords.
21
18
  - If icon is metioned in step than 'svg' should add in keywords and for Upload action first keyword should be 'file'.
@@ -28,7 +25,7 @@ You are an expert in Web application testing.
28
25
  - Do Not include any other unrelated keywords for step.
29
26
  - Do NOT include generic UI words (button, field, etc) and action words (tap, click, press, etc).
30
27
  - Do NOT include status/technical words (displayed, enabled, authenticate, visible).
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.
28
+ - If an element label contains multiple words (e.g., "Sign In", "Add to Cart"), keep them together as ONE keyword like ["Sign In", "SignIn", "Add to Cart", "AddToCart"] and Never split them and also for keywords you generated, should not split them like ["sign", "in","add","to","cart"].
32
29
  - element_name: extract name of the element that mentioned in the the step.(eg:tap on x -> element_name:x) keep element_name as short as possible and make the first letter of first word of the element_name as capital. beacuse element_name is also used to find element in the dom. and if element_name is not mentioned in step than return action of the step as element_name.
33
30
  - action: click for taping, clicking or selecting, enter for entering input, wait for waiting or sleeping,scroll for scrolling and swiping, navigate for navigating to page using url or navigateing back to previous page, get for getting,fetching element,maximize for maximizing browser window, close for closing browser window,open for opening browser window, upload for uploading file using path, drag_and_drop for dragging and dropping element, switch is for switching to tab or window or frame,cleartext for clearing or removing text from element.
34
31
  - action must be one of from this list ${JSON.stringify(allowedActions)}.if not one of them, return '0'. if step about set or find action return '0'
@@ -0,0 +1,41 @@
1
+ import { combinedActionArgs } from "../llmPromptTypes/systemPromptTypes"
2
+
3
+ export async function combinedActionExtractorPrompt({
4
+ extractedDomJson,
5
+ priorAndNextSteps,
6
+
7
+ }: combinedActionArgs
8
+ ): Promise<string> {
9
+ const nlpList = `"dummy"`;
10
+
11
+
12
+ const elementType = ["link", "textfield", "icon", "button", "radiobutton", "checkbox", "tab", "action overflow button", "hamburger menu", "toggle button", "steppers", "sliders"]
13
+ const prompt = `
14
+ You are an intelligent assistant that extracts structured UI action data.
15
+ Given the step, the simplified DOM: ${extractedDomJson}, and the list of NLP names: ${nlpList}.
16
+
17
+ Select the perfect matching NLP name from the list that best fits the step's intent.
18
+
19
+ Return **only valid JSON** in the following format:
20
+ {
21
+ "attribute_value": "Fire-Flink-x",
22
+ "nlpName": "x",
23
+ "input_text":"x",
24
+ "keyword": "x",
25
+ "element_type": "x",
26
+ "keycode": "x"
27
+ }
28
+ Rules:
29
+ - nlpName must be exactly one from the provided list.
30
+ - Use context from the steps : ${priorAndNextSteps}, keyword and json to search for FF-inspecter.
31
+ - **Find the FF-inspecter attribute value of the element in the Simplified JSON whose text or attributes best match the step.**
32
+ - If step has mutipul inputs add all in input_text and all matched attribute_value also.
33
+ - Extract input_text from the step, if you can't find any input text in the step, return keyword as input_text.input can be number, app package, apk file path.dont include extra words.
34
+ - Extract keyword from the step, if the step contains any keyword.
35
+ - Extract keycode of keys if the step contains any key name like ENTER,SPACE,BACKSPACE etc and give keycode of the given key.
36
+ - Use the closest semantic match for the step; return attribute_value as Fire-Flink-0, only if nothing is found.
37
+ - Based on step give most relevant type of element. use this list to choose element_type: ${elementType} and Never change syntax of element_type, follow the syntax of element_type in list.if element_type is not there in list return 'link'.
38
+ - Respond with valid JSON only.
39
+ `;
40
+ return prompt;
41
+ }