ff-automationv2 2.2.28 → 2.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/llmcalls/llmAction.d.ts +9 -4
- package/dist/ai/llmcalls/llmAction.js +214 -42
- package/dist/ai/llmcalls/parseLlmOputput.js +21 -9
- package/dist/ai/llmprompts/promptRegistry.js +15 -0
- package/dist/ai/llmprompts/systemPrompts/actionExtractorPrompt.js +48 -11
- package/dist/ai/llmprompts/systemPrompts/combinedActionExtractorPrompt.js +7 -6
- package/dist/ai/llmprompts/systemPrompts/combinedActionExtractorPromptMob.js +14 -13
- package/dist/ai/llmprompts/systemPrompts/errorDescriptionPrompt.js +6 -4
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.js +125 -67
- package/dist/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.js +65 -28
- package/dist/ai/llmprompts/systemPrompts/getActionExtractorPrompt.js +18 -16
- package/dist/ai/llmprompts/systemPrompts/getActionExtractorPromptMob.js +13 -13
- package/dist/ai/llmprompts/systemPrompts/mobileKeywordExtractor.js +26 -15
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.d.ts +1 -0
- package/dist/ai/llmprompts/systemPrompts/otpExtractorPrompt.js +22 -0
- package/dist/ai/llmprompts/systemPrompts/userStoryToListPrompt.js +1 -1
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.js +23 -19
- package/dist/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.js +9 -9
- package/dist/ai/llmprompts/systemPrompts/visionPrompt.js +18 -8
- package/dist/ai/llmprompts/systemPrompts/visionPromptMobile.js +4 -0
- package/dist/ai/llmprompts/systemPrompts/waitActionExtractorPrompt.js +10 -9
- package/dist/ai/llmprompts/systemPrompts/waitActionExtractorPromptMob.js +8 -7
- package/dist/ai/llmprompts/userPrompts/userPrompt.js +8 -8
- package/dist/automation/actions/executor.d.ts +42 -34
- package/dist/automation/actions/executor.js +300 -166
- package/dist/automation/actions/interaction/alert/clickCancelOnAlertPopup.js +4 -4
- package/dist/automation/actions/interaction/alert/clickOkOnAlertPopup.js +4 -4
- package/dist/automation/actions/interaction/alert/enterDataToAlert.js +4 -3
- package/dist/automation/actions/interaction/alert/getTextPresentOnAlertPopup.js +4 -4
- package/dist/automation/actions/interaction/alert/verifyAlertPopUpMessageContainsString.js +4 -3
- package/dist/automation/actions/interaction/alert/verifyAlertPopupIsDisplayed.js +10 -4
- package/dist/automation/actions/interaction/alert/verifyTextPresentOnAlertPopup.js +4 -3
- package/dist/automation/actions/interaction/alert/waitTillAlertIsPresent.js +5 -5
- package/dist/automation/actions/interaction/clear/clear.js +33 -26
- package/dist/automation/actions/interaction/clear/clearAndEnter.js +33 -26
- package/dist/automation/actions/interaction/click/MOB_DoubleTapAtSpecifiedLocation.js +5 -6
- package/dist/automation/actions/interaction/click/click.js +65 -26
- package/dist/automation/actions/interaction/click/clickNtimes.js +29 -24
- package/dist/automation/actions/interaction/click/clickUsingJs.js +12 -12
- package/dist/automation/actions/interaction/click/doubleClick.js +32 -25
- package/dist/automation/actions/interaction/click/rightClick.js +18 -13
- package/dist/automation/actions/interaction/click/tapOnSpecifiedLocation.js +7 -5
- package/dist/automation/actions/interaction/click/waitAndClick.js +29 -27
- package/dist/automation/actions/interaction/dragAndDrop/dragAndDrop.js +2 -2
- package/dist/automation/actions/interaction/elementLessAction/MobCheckIfAppIsClosed.js +14 -9
- package/dist/automation/actions/interaction/elementLessAction/MobRunAppInBackgroundInterface.js +9 -9
- package/dist/automation/actions/interaction/elementlessActions/activateAppUsingAppPackage.d.ts +0 -3
- package/dist/automation/actions/interaction/elementlessActions/activateAppUsingAppPackage.js +8 -9
- package/dist/automation/actions/interaction/elementlessActions/getOtp.d.ts +2 -0
- package/dist/automation/actions/interaction/elementlessActions/getOtp.js +101 -0
- package/dist/automation/actions/interaction/elementlessActions/installAPK.js +74 -33
- package/dist/automation/actions/interaction/elementlessActions/isAppInstalled.js +10 -8
- package/dist/automation/actions/interaction/elementlessActions/openAppWithApkFilePath.js +87 -68
- package/dist/automation/actions/interaction/elementlessActions/openMobileApplication.js +8 -6
- package/dist/automation/actions/interaction/elementlessActions/receiveMessageOnEmulator.js +4 -3
- package/dist/automation/actions/interaction/elementlessActions/terminateAppUsingAppPackage.js +8 -6
- package/dist/automation/actions/interaction/elementlessActions/uninstallAPK.js +76 -32
- package/dist/automation/actions/interaction/enterActions/EnterInputIntoElementFromClipBoardInterface_mob.js +17 -13
- package/dist/automation/actions/interaction/enterActions/enterInput.js +55 -30
- package/dist/automation/actions/interaction/enterActions/enterInputAndPress.js +32 -24
- package/dist/automation/actions/interaction/enterActions/enterUrl.js +22 -17
- package/dist/automation/actions/interaction/enterActions/enterusingJs.js +19 -13
- package/dist/automation/actions/interaction/enterActions/waitAndEnter.js +33 -26
- package/dist/automation/actions/interaction/find/MOB_FindElement.js +37 -21
- package/dist/automation/actions/interaction/find/findElements.js +49 -32
- package/dist/automation/actions/interaction/get/MOB_GetADBLogsForGivenAppPackage.js +5 -6
- package/dist/automation/actions/interaction/get/MOB_GetAllContexts.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetAllWindowHandles.js +8 -9
- package/dist/automation/actions/interaction/get/MOB_GetAltitude.js +20 -10
- package/dist/automation/actions/interaction/get/MOB_GetBatteryPercentage.js +7 -9
- package/dist/automation/actions/interaction/get/MOB_GetBatteryStatus.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetClipBoardText.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentActivity.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentAppPackage.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentContext.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentDeviceDate.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentDeviceSettings.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentDeviceStatus.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentDeviceSystemBars.js +5 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentDeviceTime.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentOrientation.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetCurrentSessionId.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetDeviceLocation.js +20 -9
- package/dist/automation/actions/interaction/get/MOB_GetDeviceName.js +7 -8
- package/dist/automation/actions/interaction/get/MOB_GetDeviceOsVersion.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetDeviceUdid.js +7 -8
- package/dist/automation/actions/interaction/get/MOB_GetHeightOfElement.js +12 -11
- package/dist/automation/actions/interaction/get/MOB_GetHeightOfScreen.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetHourFromCurrentDeviceTime.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetLatitude.js +20 -12
- package/dist/automation/actions/interaction/get/MOB_GetLongitude.js +20 -12
- package/dist/automation/actions/interaction/get/MOB_GetMinuteFromCurrentDeviceTime.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetSecondFromCurrentDeviceTime.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetSizeOfScreen.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetSupportedPerformanceDataTypes.js +4 -6
- package/dist/automation/actions/interaction/get/MOB_GetTextFromElementAndSetToClipBoard.js +11 -8
- package/dist/automation/actions/interaction/get/MOB_GetWidthOfElement.js +12 -11
- package/dist/automation/actions/interaction/get/MOB_GetWidthOfScreen.js +4 -6
- package/dist/automation/actions/interaction/get/browserWindowGetPosition.js +4 -4
- package/dist/automation/actions/interaction/get/getAllBrokenImages.js +4 -4
- package/dist/automation/actions/interaction/get/getAllBrokenLinkCount.js +4 -4
- package/dist/automation/actions/interaction/get/getAllBrokenLinks.js +5 -5
- package/dist/automation/actions/interaction/get/getAllConsoleErrors.js +4 -4
- package/dist/automation/actions/interaction/get/getAllConsoleInformation.js +5 -5
- package/dist/automation/actions/interaction/get/getAllConsoleLogs.js +5 -5
- package/dist/automation/actions/interaction/get/getAllConsoleWarnings.js +5 -5
- package/dist/automation/actions/interaction/get/getAllCookieNames.js +5 -5
- package/dist/automation/actions/interaction/get/getAllCookieValues.js +5 -5
- package/dist/automation/actions/interaction/get/getAllSelectedOptions.js +12 -12
- package/dist/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsText.js +12 -12
- package/dist/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsTextInSortedOrder.js +12 -12
- package/dist/automation/actions/interaction/get/getAllTheSelectedOptionsFromListBoxAsText.js +12 -12
- package/dist/automation/actions/interaction/get/getAllWindowHandles.js +5 -5
- package/dist/automation/actions/interaction/get/getAttribute.js +27 -25
- package/dist/automation/actions/interaction/get/getAudioCurrentPlaybackRate.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioCurrentSeekTime.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioCurrentVolume.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioDecodedByte.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioDefaultPlaybackRate.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioMediaLength.js +12 -12
- package/dist/automation/actions/interaction/get/getAudioMediaSource.js +12 -12
- package/dist/automation/actions/interaction/get/getBestPracticesScore.js +4 -3
- package/dist/automation/actions/interaction/get/getBrowserCount.js +4 -4
- package/dist/automation/actions/interaction/get/getBrowserVersion.js +4 -4
- package/dist/automation/actions/interaction/get/getCapabilityNames.js +4 -4
- package/dist/automation/actions/interaction/get/getClipBoardText.js +4 -4
- package/dist/automation/actions/interaction/get/getCollectiveApiResponseTime.js +5 -4
- package/dist/automation/actions/interaction/get/getCollectiveApiStatusCode.js +5 -4
- package/dist/automation/actions/interaction/get/getCssValue.js +12 -12
- package/dist/automation/actions/interaction/get/getCurrentDayOfTheWeek.js +4 -4
- package/dist/automation/actions/interaction/get/getCurrentSecondsFromCurrentSystemTime.js +5 -5
- package/dist/automation/actions/interaction/get/getCurrentSystemDate.js +4 -4
- package/dist/automation/actions/interaction/get/getCurrentSystemDay.js +5 -5
- package/dist/automation/actions/interaction/get/getCurrentSystemMonth.js +5 -5
- package/dist/automation/actions/interaction/get/getCurrentSystemTime.js +5 -5
- package/dist/automation/actions/interaction/get/getCurrentSystemYear.js +5 -5
- package/dist/automation/actions/interaction/get/getCurrentWindowHandle.js +9 -10
- package/dist/automation/actions/interaction/get/getDataFromApiRequestHeaderForJsonPath.js +5 -4
- package/dist/automation/actions/interaction/get/getDataFromApiResponseForJsonPath.js +5 -4
- package/dist/automation/actions/interaction/get/getDateWithGivenFormat.js +5 -4
- package/dist/automation/actions/interaction/get/getDriverInstance.js +12 -11
- package/dist/automation/actions/interaction/get/getFirstContentfulPaint.js +5 -5
- package/dist/automation/actions/interaction/get/getFirstSelectedOption.js +12 -12
- package/dist/automation/actions/interaction/get/getFullPaintTime.js +5 -5
- package/dist/automation/actions/interaction/get/getHTMLCodeOfPage.js +4 -4
- package/dist/automation/actions/interaction/get/getHeightOfBrowserWindow.js +4 -4
- package/dist/automation/actions/interaction/get/getHeightOfWebElement.js +12 -12
- package/dist/automation/actions/interaction/get/getHourFromCurrentSystemTime.js +4 -4
- package/dist/automation/actions/interaction/get/getImplicitTimeOut.js +11 -10
- package/dist/automation/actions/interaction/get/getLargestContentfulPaint.js +4 -4
- package/dist/automation/actions/interaction/get/getListBoxSize.js +12 -12
- package/dist/automation/actions/interaction/get/getListOfElementsFromLocatorTypeLocatorValue.js +90 -44
- package/dist/automation/actions/interaction/get/getLocation.js +32 -31
- package/dist/automation/actions/interaction/get/getMinuteFromCurrentSystemTime.js +4 -4
- package/dist/automation/actions/interaction/get/getNetworkRouteTime.js +4 -4
- package/dist/automation/actions/interaction/get/getNumberOfBrokenImages.js +4 -4
- package/dist/automation/actions/interaction/get/getNumberOfLinksPresentInCurrentPage.js +4 -4
- package/dist/automation/actions/interaction/get/getNumberOfWorkingLinksFromCurrentPage.js +4 -4
- package/dist/automation/actions/interaction/get/getOptions.js +12 -12
- package/dist/automation/actions/interaction/get/getPageTitle.js +5 -5
- package/dist/automation/actions/interaction/get/getPerformanceMetrics.js +5 -5
- package/dist/automation/actions/interaction/get/getPwaScore.js +5 -4
- package/dist/automation/actions/interaction/get/getRect.js +26 -23
- package/dist/automation/actions/interaction/get/getScreenshot.js +12 -18
- package/dist/automation/actions/interaction/get/getScreenshotAs.js +27 -32
- package/dist/automation/actions/interaction/get/getSeoScore.js +5 -4
- package/dist/automation/actions/interaction/get/getSingleApiRequestPayload.js +7 -6
- package/dist/automation/actions/interaction/get/getSingleApiResponse.js +12 -14
- package/dist/automation/actions/interaction/get/getSingleApiResponseTime.js +13 -13
- package/dist/automation/actions/interaction/get/getSingleApiStatusCode.d.ts +1 -1
- package/dist/automation/actions/interaction/get/getSingleApiStatusCode.js +21 -17
- package/dist/automation/actions/interaction/get/getSize.js +26 -24
- package/dist/automation/actions/interaction/get/getSizeOfBrowserWindow.js +5 -5
- package/dist/automation/actions/interaction/get/getStringDataFromLocalFile.js +11 -13
- package/dist/automation/actions/interaction/get/getSystemProperty.js +7 -33
- package/dist/automation/actions/interaction/get/getTagName.js +26 -24
- package/dist/automation/actions/interaction/get/getText.js +28 -25
- package/dist/automation/actions/interaction/get/getTheFirstSelectedOptionFromListBoxAsText.js +12 -12
- package/dist/automation/actions/interaction/get/getTotalNumberOfCookies.js +5 -5
- package/dist/automation/actions/interaction/get/getTunnelIdentifier.js +5 -4
- package/dist/automation/actions/interaction/get/getURLPresentInAddressBar.js +5 -5
- package/dist/automation/actions/interaction/get/getUserHomeDirectory.js +5 -5
- package/dist/automation/actions/interaction/get/getValueByCookieName.js +7 -11
- package/dist/automation/actions/interaction/get/getValueFromLocalStorage.js +7 -10
- package/dist/automation/actions/interaction/get/getValueOfSystemVariable.js +8 -6
- package/dist/automation/actions/interaction/get/getVideoCurrentPlaybackRate.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoCurrentSeekTime.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoCurrentVolume.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoDecodedByte.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoDefaultPlaybackRate.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoMediaLength.js +12 -12
- package/dist/automation/actions/interaction/get/getVideoMediaSource.js +12 -12
- package/dist/automation/actions/interaction/get/getWidthOfBrowser.js +5 -5
- package/dist/automation/actions/interaction/get/getWidthOfWebElement.js +12 -12
- package/dist/automation/actions/interaction/get/getWorkingLinksFromCurrentPage.js +5 -5
- package/dist/automation/actions/interaction/get/getWrappedElement.js +12 -12
- package/dist/automation/actions/interaction/get/getWrappedOptionFromListBoxAsText.js +14 -14
- package/dist/automation/actions/interaction/get/getXLocationOfBrowserWindow.js +5 -4
- package/dist/automation/actions/interaction/get/getXLocationOfWebElement.js +26 -24
- package/dist/automation/actions/interaction/get/getYLocationOfBrowserWindow.js +5 -5
- package/dist/automation/actions/interaction/get/getYLocationOfWebElement.js +26 -24
- package/dist/automation/actions/interaction/iframe/switchToDefaultContent.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOff.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/AirplaneModeSwitchOn.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/Break.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/Continue.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/GpsSwitchOff.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/GpsSwitchOn.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/HideKeyboard.js +13 -7
- package/dist/automation/actions/interaction/inputlessActions/LockDevice.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/OpenChromeBrowser.js +18 -6
- package/dist/automation/actions/interaction/inputlessActions/OpenNotification.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/ResetApp.js +14 -7
- package/dist/automation/actions/interaction/inputlessActions/RestartCurrentDevice.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/SetDeviceOrientationAsLandscape.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/SetDeviceOrientationAsPortrait.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOff.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/SetEmulatorPowerStateOn.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/WifiSwitchOff.js +5 -5
- package/dist/automation/actions/interaction/inputlessActions/WifiSwitchOn.js +5 -5
- package/dist/automation/actions/interaction/maximize/maximize.js +5 -5
- package/dist/automation/actions/interaction/maximize/minimize.js +5 -5
- package/dist/automation/actions/interaction/mouse/mouseClickOnCurrentCursorNTImes.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/mouseClickOnCurrentCursorNTImes.js +31 -0
- package/dist/automation/actions/interaction/mouse/mouseClickOnCurrentCursorPoint.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/mouseClickOnCurrentCursorPoint.js +27 -0
- package/dist/automation/actions/interaction/mouse/mouseDoubleClickAtCursorPoint.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/mouseDoubleClickAtCursorPoint.js +31 -0
- package/dist/automation/actions/interaction/mouse/mouseHover.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/mouseHover.js +36 -0
- package/dist/automation/actions/interaction/mouse/mouseReleaseLeftMouseButton.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/mouseReleaseLeftMouseButton.js +42 -0
- package/dist/automation/actions/interaction/mouse/pressAndHold.d.ts +2 -0
- package/dist/automation/actions/interaction/mouse/pressAndHold.js +47 -0
- package/dist/automation/actions/interaction/navigation/goBack.js +5 -5
- package/dist/automation/actions/interaction/navigation/navigate.js +5 -4
- package/dist/automation/actions/interaction/navigation/refresh.js +5 -5
- package/dist/automation/actions/interaction/pinch/PinchInByPercentMob.js +12 -13
- package/dist/automation/actions/interaction/pinch/PinchOutByPercentMob.js +12 -11
- package/dist/automation/actions/interaction/press/longPress.js +15 -11
- package/dist/automation/actions/interaction/press/mobPressBackKey.js +4 -6
- package/dist/automation/actions/interaction/press/mobPressBackSpaceKey.js +12 -8
- package/dist/automation/actions/interaction/press/mobPressSpaceKey.js +12 -8
- package/dist/automation/actions/interaction/press/pressAnyKey.js +25 -16
- package/dist/automation/actions/interaction/press/pressAnyKeyNTimes.js +23 -14
- package/dist/automation/actions/interaction/press/pressEnterKey.js +21 -14
- package/dist/automation/actions/interaction/press/pressHomeKey.js +16 -9
- package/dist/automation/actions/interaction/scroll/scrollHorizontallyTillElementIsVisible.js +20 -15
- package/dist/automation/actions/interaction/scroll/scrollPageToSpecificLocation.js +8 -7
- package/dist/automation/actions/interaction/scroll/scrollToElement.js +18 -13
- package/dist/automation/actions/interaction/scroll/scrollVerticallyTillElementIsVisible.js +20 -15
- package/dist/automation/actions/interaction/set/MOB_SetContext.js +5 -6
- package/dist/automation/actions/interaction/set/MOB_SetEmulatorPowerPercentage.js +5 -6
- package/dist/automation/actions/interaction/set/setClipBoardText.js +13 -13
- package/dist/automation/actions/interaction/shadowDom/shadowDomClick.js +5 -4
- package/dist/automation/actions/interaction/shadowDom/shadowDomEnter.js +5 -4
- package/dist/automation/actions/interaction/shadowDom/shadowDomGetText.js +6 -5
- package/dist/automation/actions/interaction/shadowDom/shadowDomUpload.js +13 -9
- package/dist/automation/actions/interaction/shadowDom/shadowDomVerifyPartialText.js +6 -5
- package/dist/automation/actions/interaction/shadowDom/shadowDomVerifyText.js +6 -5
- package/dist/automation/actions/interaction/swipe/swipeDirectionNTimes.js +12 -10
- package/dist/automation/actions/interaction/swipe/swipeDownToElement.js +13 -10
- package/dist/automation/actions/interaction/swipe/swipeIos.d.ts +2 -0
- package/dist/automation/actions/interaction/swipe/swipeIos.js +52 -0
- package/dist/automation/actions/interaction/swipe/swipeLeftToElement.js +16 -11
- package/dist/automation/actions/interaction/swipe/swipeRightToElement.js +15 -10
- package/dist/automation/actions/interaction/swipe/swipeUpToElement.js +12 -10
- package/dist/automation/actions/interaction/swipe/swipeUpToElementForMWeb.js +16 -13
- package/dist/automation/actions/interaction/swipe/swipeUsingReferenceElement.js +19 -16
- package/dist/automation/actions/interaction/switch/switchToNewTabBasedOnTitle.js +7 -6
- package/dist/automation/actions/interaction/switch/switchToNewWindowBasedOnTitle.js +6 -5
- package/dist/automation/actions/interaction/switch/switchToParentWindow.js +6 -6
- package/dist/automation/actions/interaction/switch/switchToTabBasedOnUrl.js +6 -5
- package/dist/automation/actions/interaction/switch/switchToWindowBasedOnURL.js +5 -4
- package/dist/automation/actions/interaction/switch/switchToWindowIfTitleContainsString.js +7 -6
- package/dist/automation/actions/interaction/switch/switchToWindowIfUrlContainsString.js +6 -5
- package/dist/automation/actions/interaction/upload/uploadfile.js +21 -18
- package/dist/automation/actions/interaction/verify/MOB_VerifyBatteryLevel.js +8 -8
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfAirplaneModeOff.js +7 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfAirplaneModeOn.js +7 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfAppIsClosed.js +19 -10
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfDeviceIsLocked.js +7 -6
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfDeviceIsUnlocked.js +7 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfGpsOff.js +12 -8
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfGpsOn.js +12 -8
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfKeyboardIsHidden.js +7 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfKeyboardIsShown.js +8 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfWifiOff.js +8 -7
- package/dist/automation/actions/interaction/verify/MOB_VerifyIfWifiOn.js +8 -7
- package/dist/automation/actions/interaction/verify/VerifyAccessibilityScore.js +8 -7
- package/dist/automation/actions/interaction/verify/VerifyAllBrokenImages.js +6 -6
- package/dist/automation/actions/interaction/verify/VerifyAllBrowserWindowsClosed.js +12 -10
- package/dist/automation/actions/interaction/verify/VerifyAllOptionsAreDeSelected.js +19 -19
- package/dist/automation/actions/interaction/verify/VerifyAllOptionsAreSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyAttributeValue.js +35 -53
- package/dist/automation/actions/interaction/verify/VerifyBestPracticesScore.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyBrowserHtmlCodeContainsString.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowHeight.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowTitleContainsString.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowTitleIsString.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowUrlContainsExpectedUrl.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowUrlIsString.js +5 -4
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowWidth.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowXLocation.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyBrowserWindowYLocation.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyCheckBoxIsNotSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyCheckBoxIsSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyCssAttributeValue.js +20 -14
- package/dist/automation/actions/interaction/verify/VerifyElementIsClickable.js +28 -25
- package/dist/automation/actions/interaction/verify/VerifyElementIsDisabled.js +29 -27
- package/dist/automation/actions/interaction/verify/VerifyElementIsDisplayed.js +26 -24
- package/dist/automation/actions/interaction/verify/VerifyElementIsEnabled.js +26 -24
- package/dist/automation/actions/interaction/verify/VerifyElementIsEnabledInSpecifiedTime.d.ts +2 -0
- package/dist/automation/actions/interaction/verify/VerifyElementIsEnabledInSpecifiedTime.js +84 -0
- package/dist/automation/actions/interaction/verify/VerifyElementIsNotDisplayed.js +51 -28
- package/dist/automation/actions/interaction/verify/VerifyElementIsSelected.js +39 -27
- package/dist/automation/actions/interaction/verify/VerifyElementIsSelectedInSpecifiedTime.d.ts +2 -0
- package/dist/automation/actions/interaction/verify/VerifyElementIsSelectedInSpecifiedTime.js +83 -0
- package/dist/automation/actions/interaction/verify/VerifyElementNotContainsText.js +23 -23
- package/dist/automation/actions/interaction/verify/VerifyHeightOfWebElement.js +23 -23
- package/dist/automation/actions/interaction/verify/VerifyHexCodeForGivenXYCoordinates.js +44 -14
- package/dist/automation/actions/interaction/verify/VerifyIfAllCookiesAreDeleted.js +4 -4
- package/dist/automation/actions/interaction/verify/VerifyIfAudioEnded.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfAudioIsMuted.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfAudioIsPaused.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfAudioIsPlaying.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfBrowserWindowIsClosed.js +8 -9
- package/dist/automation/actions/interaction/verify/VerifyIfCookieNameIsAdded.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyIfCookieNameIsDeleted.js +5 -4
- package/dist/automation/actions/interaction/verify/VerifyIfCookieObjectIsPresent.js +5 -5
- package/dist/automation/actions/interaction/verify/VerifyIfGivenOptionIsDuplicate.js +14 -14
- package/dist/automation/actions/interaction/verify/VerifyIfImageIsBroken.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyIfLinkIsBroken.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyIfLinkIsWorking.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyIfLinksAreBroken.js +5 -4
- package/dist/automation/actions/interaction/verify/VerifyIfLinksAreWorking.js +5 -4
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsDeselectedInElement.js +13 -13
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsSelectedInListBox.js +13 -13
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithTextIsDeselected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithValueIsDeselected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithValueIsSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfOptionWithVisibleTextIsSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfSpecifiedOptionIsSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfStatusCodeOfALinkIsStatusCode.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyIfStatusCodesOfLinks.js +30 -22
- package/dist/automation/actions/interaction/verify/VerifyIfVideoEnded.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfVideoIsMuted.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfVideoIsPaused.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfVideoIsPlaying.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfVideoPlayingInMute.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfVideoPlayingInUnmute.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyIfXAndYCoordinateOfElement.js +25 -23
- package/dist/automation/actions/interaction/verify/VerifyLinkNavigatesToTitle.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyListBoxOptionsAreSorted.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyNavigateURL.js +42 -14
- package/dist/automation/actions/interaction/verify/VerifyNumberOfElementsByTagName.js +7 -5
- package/dist/automation/actions/interaction/verify/VerifyNumberOfElementsByXpath.js +13 -7
- package/dist/automation/actions/interaction/verify/VerifyPartialAttributeValue.js +33 -42
- package/dist/automation/actions/interaction/verify/VerifyPartialTitleOfCurrentPage.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyPerformanceScore.js +7 -6
- package/dist/automation/actions/interaction/verify/VerifyPwaScore.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyRadioButtonIsNotSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyRadioButtonIsSelected.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifySeoScore.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyTagName.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyThatSpecifiedOptionIsNotSelected.js +20 -31
- package/dist/automation/actions/interaction/verify/VerifyTitleInAllPage.js +8 -7
- package/dist/automation/actions/interaction/verify/VerifyTitleOfCurrentPage.js +6 -5
- package/dist/automation/actions/interaction/verify/VerifyValueOfElementContainsString.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyValueOfElementIsCleared.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyValueOfElementIsString.js +12 -12
- package/dist/automation/actions/interaction/verify/VerifyWidthOfElement.js +23 -23
- package/dist/automation/actions/interaction/verify/VerifyXLocationOfElement.js +23 -23
- package/dist/automation/actions/interaction/verify/VerifyYLocationOfElement.js +26 -23
- package/dist/automation/actions/interaction/verify/checkIfElementIsDisplayed.js +26 -22
- package/dist/automation/actions/interaction/verify/verifyElementIsDisplayedWithinSpecifiedTime.d.ts +2 -0
- package/dist/automation/actions/interaction/verify/verifyElementIsDisplayedWithinSpecifiedTime.js +85 -0
- package/dist/automation/actions/interaction/verify/verifypartialtext.js +28 -25
- package/dist/automation/actions/interaction/verify/verifytext.js +30 -30
- package/dist/automation/actions/interaction/wait/MOB_WaitTillAllElementsAreInvisible.ts.js +5 -6
- package/dist/automation/actions/interaction/wait/MOB_WaitTillAttributeOfElementContainsString.js +17 -14
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsEnabled.js +12 -11
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsInvisible.js +14 -12
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsSelected.js +12 -11
- package/dist/automation/actions/interaction/wait/MOB_WaitTillElementIsVisible.js +15 -13
- package/dist/automation/actions/interaction/wait/MOB_WaitTillStalenessOfElement.js +12 -11
- package/dist/automation/actions/interaction/wait/wait.js +5 -4
- package/dist/automation/actions/interaction/wait/waitTillAttributeOfElementIsString.js +26 -24
- package/dist/automation/actions/interaction/wait/waitTillElementContainsText.js +26 -24
- package/dist/automation/actions/interaction/wait/waitTillElementHasText.js +26 -24
- package/dist/automation/actions/interaction/wait/waitTillElementIsClickable.js +28 -25
- package/dist/automation/actions/interaction/wait/waitTillPresenceOfAllElements.js +32 -22
- package/dist/automation/actions/interaction/wait/waitTillPresenceOfElement.js +26 -24
- package/dist/automation/actions/interface/FireFlinkResponseSchema.d.ts +160 -0
- package/dist/automation/actions/interface/FireFlinkResponseSchema.js +225 -0
- package/dist/automation/actions/interface/alertActionInterface.d.ts +1 -0
- package/dist/automation/actions/interface/findActionInterface.d.ts +3 -0
- package/dist/automation/actions/interface/getActionInterface.d.ts +76 -66
- package/dist/automation/actions/interface/getOtpInterface.d.ts +15 -0
- package/dist/automation/actions/interface/getOtpInterface.js +2 -0
- package/dist/automation/actions/interface/interactionActionInterface.d.ts +5 -0
- package/dist/automation/actions/interface/mouseActionsinterface.d.ts +51 -0
- package/dist/automation/actions/interface/mouseActionsinterface.js +2 -0
- package/dist/automation/actions/interface/pinchActionInterface.d.ts +7 -0
- package/dist/automation/actions/interface/pressActionInterface.d.ts +4 -0
- package/dist/automation/actions/interface/swipeActionInterface.d.ts +25 -10
- package/dist/automation/actions/interface/verifyActionInterface.d.ts +36 -0
- package/dist/automation/actions/interface/waitActionInterface.d.ts +19 -0
- package/dist/automation/browserSession/initiateBrowserSession.d.ts +1 -1
- package/dist/automation/browserSession/initiateBrowserSession.js +15 -7
- package/dist/automation/cloudSession/initiateCloudSession.js +3 -1
- package/dist/automation/driverState.d.ts +2 -0
- package/dist/automation/driverState.js +4 -0
- package/dist/automation/mobileSession/initiateMobileSession.d.ts +28 -5
- package/dist/automation/mobileSession/initiateMobileSession.js +100 -23
- package/dist/core/constants/allAction.js +6 -1
- package/dist/core/constants/supportedActions.d.ts +1 -0
- package/dist/core/constants/supportedActions.js +19 -8
- package/dist/core/interfaces/actionInterface.d.ts +38 -33
- package/dist/core/interfaces/browserConfigurationInterface.d.ts +0 -4
- package/dist/core/interfaces/browserConfigurationInterface.js +0 -1
- package/dist/core/interfaces/executionDetails.d.ts +6 -3
- package/dist/core/interfaces/fireflinkScriptPayloadInterface.d.ts +26 -17
- package/dist/core/interfaces/llmConfigurationInterface.d.ts +3 -2
- package/dist/core/interfaces/llmResponseInterface.d.ts +11 -10
- package/dist/core/interfaces/promptInterface.d.ts +1 -0
- package/dist/core/interfaces/scriptGenrationDataInterface.d.ts +14 -0
- package/dist/core/interfaces/simplifyAndFlattenInterface.d.ts +5 -0
- package/dist/core/main/SessionManager.d.ts +9 -0
- package/dist/core/main/SessionManager.js +23 -0
- package/dist/core/main/actionHandlerFactory.js +353 -86
- package/dist/core/main/executionContext.d.ts +8 -2
- package/dist/core/main/executionContext.js +94 -4
- package/dist/core/main/runAutomationScript.d.ts +2 -0
- package/dist/core/main/runAutomationScript.js +1003 -276
- package/dist/core/main/stepProcessor.d.ts +2 -1
- package/dist/core/main/stepProcessor.js +8 -3
- package/dist/core/types/browserType.d.ts +3 -3
- package/dist/core/types/browserType.js +2 -2
- package/dist/core/types/messageType.d.ts +13 -0
- package/dist/core/types/messageType.js +15 -0
- package/dist/core/types/promptType.d.ts +2 -1
- package/dist/core/types/promptType.js +1 -0
- package/dist/core/types/scriptTypesType.d.ts +1 -1
- package/dist/core/types/visionllmInputType.d.ts +4 -5
- package/dist/domAnalysis/getRelaventElements.d.ts +5 -1
- package/dist/domAnalysis/getRelaventElements.js +14 -5
- package/dist/domAnalysis/relativeElementsFromDom.d.ts +2 -1
- package/dist/domAnalysis/relativeElementsFromDom.js +66 -1
- package/dist/domAnalysis/searchBest.d.ts +5 -1
- package/dist/domAnalysis/searchBest.js +160 -58
- package/dist/domAnalysis/simplifyAndFlatten.d.ts +3 -2
- package/dist/domAnalysis/simplifyAndFlatten.js +114 -19
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.d.ts +3 -0
- package/dist/fireflinkData/fireflinkLocators/getListOfLocators.js +26 -12
- package/dist/fireflinkData/fireflinkLocators/{elementsFromHTML.d.ts → parser/getElementsFromHTML.d.ts} +5 -11
- package/dist/fireflinkData/fireflinkLocators/parser/getElementsFromHTML.js +573 -0
- package/dist/fireflinkData/fireflinkLocators/types/locator.d.ts +27 -0
- package/dist/fireflinkData/fireflinkLocators/types/locator.js +2 -0
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.d.ts +2 -0
- package/dist/fireflinkData/fireflinkLocators/utils/androidSelector.js +57 -0
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.d.ts +19 -0
- package/dist/fireflinkData/fireflinkLocators/utils/cssSelector.js +189 -0
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.d.ts +2 -0
- package/dist/fireflinkData/fireflinkLocators/utils/iosSelector.js +183 -0
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.d.ts +35 -0
- package/dist/fireflinkData/fireflinkLocators/utils/referenceXpath.js +513 -0
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.d.ts +29 -0
- package/dist/fireflinkData/fireflinkLocators/utils/xpath.js +710 -0
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.d.ts +135 -0
- package/dist/fireflinkData/fireflinkLocators/utils/xpathHelpers.js +1628 -0
- package/dist/fireflinkData/fireflinkScript/appendScriptData.d.ts +2 -0
- package/dist/fireflinkData/fireflinkScript/appendScriptData.js +48 -0
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.d.ts +2 -2
- package/dist/fireflinkData/fireflinkScript/scriptGenrationData.js +18 -24
- package/dist/imageAnalysisMobile/annotatedScreenshotMobile.d.ts +4 -0
- package/dist/imageAnalysisMobile/annotatedScreenshotMobile.js +115 -7
- package/dist/imageAnalysisWeb/annotateScreenshot.js +4 -4
- package/dist/imageAnalysisWeb/generateAnnotatedScreenshots.d.ts +4 -1
- package/dist/imageAnalysisWeb/generateAnnotatedScreenshots.js +15 -17
- package/dist/llmConfig/llmConfiguration.d.ts +4 -3
- package/dist/llmConfig/llmConfiguration.js +48 -18
- package/dist/service/api/fireflinkApi.service.d.ts +1 -1
- package/dist/service/api/fireflinkApi.service.js +1 -2
- package/dist/service/fireflink.service.d.ts +3 -3
- package/dist/service/fireflink.service.js +24 -22
- package/dist/service/kafka/fireflinkKafka.service.d.ts +1 -2
- package/dist/service/kafka/fireflinkKafka.service.js +6 -4
- package/dist/tests/poc.d.ts +0 -1
- package/dist/tests/poc.js +211 -226
- package/dist/tests/test.d.ts +1 -0
- package/dist/tests/test.js +26 -0
- package/dist/tests/test12.d.ts +0 -1
- package/dist/tests/test12.js +65 -467
- package/dist/tests/testkaf.d.ts +0 -1
- package/dist/tests/testkaf.js +51 -55
- package/dist/tests/testss.d.ts +1 -0
- package/dist/tests/testss.js +23 -0
- package/dist/utils/DomExtraction/jsForAttributeInjection.d.ts +2 -0
- package/dist/utils/DomExtraction/jsForAttributeInjection.js +220 -8
- package/dist/utils/InstancesDetails/getInstancesInfo.d.ts +26 -1
- package/dist/utils/InstancesDetails/getInstancesInfo.js +11 -5
- package/dist/utils/browserCap/capability.d.ts +14 -10
- package/dist/utils/browserCap/capability.js +97 -16
- package/dist/utils/frameWorkDetector/frameWorkDetector.d.ts +6 -0
- package/dist/utils/frameWorkDetector/frameWorkDetector.js +43 -0
- package/dist/utils/frameWorkDetector/frameWorkDetectorInterface.d.ts +10 -0
- package/dist/utils/frameWorkDetector/frameWorkDetectorInterface.js +2 -0
- package/dist/utils/helpers/domSanitizer.d.ts +1 -0
- package/dist/utils/helpers/domSanitizer.js +9 -0
- package/dist/utils/helpers/enterActionHelper.d.ts +1 -0
- package/dist/utils/helpers/enterActionHelper.js +25 -5
- package/dist/utils/helpers/platformContext.d.ts +3 -0
- package/dist/utils/helpers/platformContext.js +11 -0
- package/dist/utils/helpers/platformSyntax.d.ts +1 -0
- package/dist/utils/helpers/platformSyntax.js +17 -0
- package/dist/utils/helpers/sameActionsHelper.js +7 -2
- package/dist/utils/helpers/xpathcreation.d.ts +5 -1
- package/dist/utils/helpers/xpathcreation.js +44 -5
- package/dist/utils/iframesExtraction/findElementUsingFF.js +12 -9
- package/dist/utils/iframesExtraction/iframeInterface.d.ts +4 -0
- package/dist/utils/javascript/jsFindElement.d.ts +1 -1
- package/dist/utils/javascript/jsFindElement.js +2 -2
- package/dist/utils/javascript/jsForShadowRoot.d.ts +1 -1
- package/dist/utils/javascript/jsForShadowRoot.js +4 -0
- package/dist/utils/javascript/jsForVision.d.ts +2 -2
- package/dist/utils/javascript/jsForVision.js +17 -5
- package/dist/utils/logger/logData.d.ts +1 -0
- package/dist/utils/logger/logData.js +19 -0
- package/dist/utils/newTab/newTabTracker.js +18 -6
- package/dist/utils/sslConfig/apiCallPatch.d.ts +1 -0
- package/dist/utils/sslConfig/apiCallPatch.js +33 -0
- package/dist/utils/sslConfig/getSecureAgent.d.ts +2 -0
- package/dist/utils/sslConfig/getSecureAgent.js +30 -0
- package/dist/utils/swipe/domSearchHelper.d.ts +1 -1
- package/dist/utils/swipe/domSearchHelper.js +43 -42
- package/dist/utils/swipe/swipeMovement.js +28 -19
- package/dist/utils/workers/LocatorWorkerInterface.d.ts +22 -0
- package/dist/utils/workers/LocatorWorkerInterface.js +2 -0
- package/dist/utils/workers/LocatorWorkerPool.d.ts +13 -0
- package/dist/utils/workers/LocatorWorkerPool.js +89 -0
- package/dist/utils/workers/locatorWorker.d.ts +1 -0
- package/dist/utils/workers/locatorWorker.js +44 -0
- package/package.json +23 -6
- package/dist/automation/actions/interaction/get/getAudioDimension.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getAudioDimension.js +0 -34
- package/dist/automation/actions/interaction/get/getAudioHeight.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getAudioHeight.js +0 -30
- package/dist/automation/actions/interaction/get/getAudioWidth.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getAudioWidth.js +0 -30
- package/dist/automation/actions/interaction/get/getVideoDimension.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getVideoDimension.js +0 -31
- package/dist/automation/actions/interaction/get/getVideoHeight.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getVideoHeight.js +0 -28
- package/dist/automation/actions/interaction/get/getVideoWidth.d.ts +0 -2
- package/dist/automation/actions/interaction/get/getVideoWidth.js +0 -28
- package/dist/fireflinkData/fireflinkLocators/elementsFromHTML.js +0 -514
- package/dist/fireflinkData/fireflinkLocators/typeList.d.ts +0 -1
- package/dist/fireflinkData/fireflinkLocators/typeList.js +0 -33
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.AutomationRunner = void 0;
|
|
4
|
+
require("../../utils/sslConfig/apiCallPatch.js");
|
|
5
|
+
const platformContext_js_1 = require("../../utils/helpers/platformContext.js");
|
|
4
6
|
const llmConfiguration_js_1 = require("../../llmConfig/llmConfiguration.js");
|
|
5
7
|
const llmAction_js_1 = require("../../ai/llmcalls/llmAction.js");
|
|
6
|
-
const executionContext_js_1 = require("./executionContext.js");
|
|
7
8
|
const actionHandlerFactory_js_1 = require("../../core/main/actionHandlerFactory.js");
|
|
8
9
|
const stepProcessor_js_1 = require("./stepProcessor.js");
|
|
9
10
|
const fireflinkApi_service_js_1 = require("../../service/api/fireflinkApi.service.js");
|
|
@@ -26,6 +27,12 @@ const logData_js_1 = require("../../utils/logger/logData.js");
|
|
|
26
27
|
const sameActionsHelper_js_1 = require("../../utils/helpers/sameActionsHelper.js");
|
|
27
28
|
const node_console_1 = require("node:console");
|
|
28
29
|
const annotatedScreenshotMobile_js_1 = require("../../imageAnalysisMobile/annotatedScreenshotMobile.js");
|
|
30
|
+
const toon_1 = require("@toon-format/toon");
|
|
31
|
+
const messageType_js_1 = require("../types/messageType.js");
|
|
32
|
+
const platformSyntax_js_1 = require("../../utils/helpers/platformSyntax.js");
|
|
33
|
+
const driverState_js_1 = require("../../automation/driverState.js");
|
|
34
|
+
const SessionManager_js_1 = require("./SessionManager.js");
|
|
35
|
+
const domSanitizer_js_1 = require("../../utils/helpers/domSanitizer.js");
|
|
29
36
|
class AutomationRunner {
|
|
30
37
|
constructor() {
|
|
31
38
|
this.KafkaPayload = {};
|
|
@@ -36,38 +43,68 @@ class AutomationRunner {
|
|
|
36
43
|
static updateSessionTerminationInfo(testCaseId) {
|
|
37
44
|
AutomationRunner.sessionTerminationDetails[testCaseId] = true;
|
|
38
45
|
}
|
|
39
|
-
|
|
46
|
+
static normalizeScriptType(scriptType) {
|
|
47
|
+
const rawValue = (scriptType ?? "Web").trim();
|
|
48
|
+
if (!rawValue) {
|
|
49
|
+
return "Web";
|
|
50
|
+
}
|
|
51
|
+
const value = rawValue.toLowerCase();
|
|
52
|
+
if (value.includes("web") && value.includes("android")) {
|
|
53
|
+
return "Web";
|
|
54
|
+
}
|
|
55
|
+
if (value.includes("android") && value.includes("ios")) {
|
|
56
|
+
return "Android";
|
|
57
|
+
}
|
|
58
|
+
if (value.includes("android")) {
|
|
59
|
+
return "Android";
|
|
60
|
+
}
|
|
61
|
+
if (value.includes("ios")) {
|
|
62
|
+
return "iOS";
|
|
63
|
+
}
|
|
64
|
+
if (value.includes("web")) {
|
|
65
|
+
return "Web";
|
|
66
|
+
}
|
|
67
|
+
return "Web";
|
|
68
|
+
}
|
|
69
|
+
async cleanup(context, domInfo, extractedRelevantDom, stepProcessor, fireflinkService, request, platform) {
|
|
40
70
|
try {
|
|
41
71
|
logData_js_1.logger.info("Starting cleanup process...");
|
|
42
72
|
domInfo = null;
|
|
43
73
|
extractedRelevantDom = null;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
logData_js_1.logger.info("Android session deleted successfully");
|
|
52
|
-
},
|
|
53
|
-
web: async () => {
|
|
54
|
-
if (request.isCloud) {
|
|
55
|
-
if (driver?.sessionId) {
|
|
56
|
-
await driver.deleteSession();
|
|
57
|
-
}
|
|
58
|
-
logData_js_1.logger.info("Cloud session closed");
|
|
59
|
-
}
|
|
60
|
-
if (driver?.sessionId) {
|
|
61
|
-
logData_js_1.logger.info("Still browser session is active, session id :", driver.sessionId);
|
|
62
|
-
}
|
|
74
|
+
try {
|
|
75
|
+
if (context?.session) {
|
|
76
|
+
const webDriver = await context.session.getCurrentDriver().catch(() => null);
|
|
77
|
+
if (webDriver?.sessionId) {
|
|
78
|
+
if (request.isCloud) {
|
|
79
|
+
await webDriver.deleteSession();
|
|
80
|
+
logData_js_1.logger.info("Cloud web session deleted successfully");
|
|
63
81
|
}
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
else {
|
|
83
|
+
logData_js_1.logger.info("Local web session kept alive.");
|
|
84
|
+
}
|
|
85
|
+
}
|
|
66
86
|
}
|
|
67
|
-
|
|
68
|
-
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
logData_js_1.logger.error("Error closing Web session:", err);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
if (context?.mobileSession) {
|
|
93
|
+
const mobileDriver = await context.mobileSession.getCurrentDriver().catch(() => null);
|
|
94
|
+
if (mobileDriver?.sessionId) {
|
|
95
|
+
if (platform === "ios") {
|
|
96
|
+
logData_js_1.logger.info("iOS session is not deleted");
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
await mobileDriver.deleteSession();
|
|
100
|
+
logData_js_1.logger.info("Mobile session deleted successfully");
|
|
101
|
+
}
|
|
102
|
+
}
|
|
69
103
|
}
|
|
70
104
|
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
logData_js_1.logger.error("Error closing Mobile session:", err);
|
|
107
|
+
}
|
|
71
108
|
if (stepProcessor) {
|
|
72
109
|
stepProcessor.llm = null;
|
|
73
110
|
}
|
|
@@ -85,35 +122,52 @@ class AutomationRunner {
|
|
|
85
122
|
async run(request) {
|
|
86
123
|
const usedElementNames = [];
|
|
87
124
|
(0, logData_js_1.initLogger)(request.sessionPath);
|
|
125
|
+
request.type = request.platform;
|
|
126
|
+
request.platform = AutomationRunner.normalizeScriptType(request.platform);
|
|
88
127
|
logData_js_1.logger.info("User Given Step", request.userStory);
|
|
128
|
+
const data = JSON.parse(request.scriptName);
|
|
129
|
+
const hasMoreSteps = data.hasMoreSteps;
|
|
130
|
+
request.scriptName = data.automationScriptName;
|
|
89
131
|
if (request.isTerminate)
|
|
90
132
|
return AutomationRunner.updateSessionTerminationInfo(request.testCaseId);
|
|
91
133
|
AutomationRunner.sessionTerminationDetails[request.testCaseId] = request.isTerminate;
|
|
92
134
|
const apiService = new fireflinkApi_service_js_1.FireFlinkApiService();
|
|
93
135
|
const fireflinkServiceInstance = new fireflink_service_js_1.fireflinkService(apiService, request.broker, request.sslConfig);
|
|
94
|
-
const instanceDetails = await fireflinkServiceInstance.runGetInstancesDetails(request.projectId, request.token, request.serverHost);
|
|
136
|
+
const instanceDetails = await fireflinkServiceInstance.runGetInstancesDetails(request.projectId, request.token, request.serverHost, request.licenseId);
|
|
95
137
|
const aiInfo = (0, getInstancesInfo_js_1.getAiInstanceInfo)(instanceDetails.responseObject);
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
138
|
+
let context = SessionManager_js_1.SessionManager.get(request);
|
|
139
|
+
if (!context) {
|
|
140
|
+
context = SessionManager_js_1.SessionManager.create(request);
|
|
141
|
+
}
|
|
142
|
+
const configProvider = new llmConfiguration_js_1.ServiceProviderProviderConfiguration();
|
|
143
|
+
const provider = await configProvider.getProvider(aiInfo);
|
|
99
144
|
let domInfo = null;
|
|
100
145
|
let extractedRelevantDom = null;
|
|
101
146
|
let errorInfo = {};
|
|
102
|
-
const llm = new llmAction_js_1.llmAction(aiInfo.apiKey,
|
|
147
|
+
const llm = new llmAction_js_1.llmAction(aiInfo.apiKey, provider, aiInfo.model, aiInfo.visionApiKey, aiInfo.accountType, aiInfo.enterpriseConfigFile, aiInfo.serviceProvider);
|
|
103
148
|
let preCapturedDomInfo = null;
|
|
104
149
|
const stepProcessor = new stepProcessor_js_1.StepProcessor(llm);
|
|
105
|
-
|
|
150
|
+
let platform = context.activePlatform;
|
|
151
|
+
(0, platformContext_js_1.setPlatform)(platform);
|
|
106
152
|
const actionHandlers = (0, actionHandlerFactory_js_1.createActionHandlers)(context);
|
|
107
153
|
const domProcessor = new getRelaventElements_js_1.DomProcessingEngine();
|
|
108
154
|
let stepCount = 1;
|
|
109
155
|
const listOfSteps = request.userStory.map(step => String(step));
|
|
110
156
|
let driver;
|
|
111
|
-
if (listOfSteps.length == 0) {
|
|
157
|
+
if (listOfSteps.length == 0 && request?.aiExecutionAction !== "stopExecution") {
|
|
112
158
|
logData_js_1.logger.info(listOfSteps);
|
|
113
159
|
throw new Error("No executable manual steps were returned by the LLM.");
|
|
114
160
|
}
|
|
161
|
+
if (aiInfo.serviceProvider === "DefaultFireFlink") {
|
|
162
|
+
logData_js_1.logger.info('Service Provider --> DefaultFireFlink');
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
logData_js_1.logger.info(`Service Provider --> ${aiInfo.serviceProvider} and Model --> ${aiInfo.model}`);
|
|
166
|
+
}
|
|
115
167
|
const start_time = new Date().getTime();
|
|
116
|
-
for (const step of listOfSteps) {
|
|
168
|
+
for (const [index, step] of listOfSteps.entries()) {
|
|
169
|
+
platform = context.activePlatform;
|
|
170
|
+
(0, platformContext_js_1.setPlatform)(platform);
|
|
117
171
|
let stepResult;
|
|
118
172
|
let stepResultVision;
|
|
119
173
|
let stepAction;
|
|
@@ -123,10 +177,70 @@ class AutomationRunner {
|
|
|
123
177
|
let frameAction;
|
|
124
178
|
let iframeDomHtml = null;
|
|
125
179
|
let doc;
|
|
180
|
+
let pageDOM;
|
|
126
181
|
let beforeHandles = null;
|
|
182
|
+
let baseStepActionBeforeFallback;
|
|
183
|
+
const topic = request.topic;
|
|
184
|
+
const produceLiveLog = async (message) => {
|
|
185
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
186
|
+
topic: topic, message: {
|
|
187
|
+
topic: "",
|
|
188
|
+
service: "",
|
|
189
|
+
chatId: "",
|
|
190
|
+
aiPromptPayload: {
|
|
191
|
+
display: false,
|
|
192
|
+
message: "",
|
|
193
|
+
messageId: "",
|
|
194
|
+
branchId: "",
|
|
195
|
+
userId: request.userId,
|
|
196
|
+
scriptId: "",
|
|
197
|
+
scriptType: "",
|
|
198
|
+
type: "logs",
|
|
199
|
+
sessionId: "",
|
|
200
|
+
licenseId: request.licenseId,
|
|
201
|
+
projectId: request.projectId,
|
|
202
|
+
liveLogs: {
|
|
203
|
+
executionId: request.kafkaMessageKey,
|
|
204
|
+
message,
|
|
205
|
+
messageType: messageType_js_1.MessageType.LiveLog.retry,
|
|
206
|
+
},
|
|
207
|
+
attachment: [],
|
|
208
|
+
},
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
};
|
|
127
212
|
try {
|
|
213
|
+
if (request?.aiExecutionAction === "stopExecution") {
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
128
216
|
if (AutomationRunner.getSessionTerminationInfo(request.testCaseId)) {
|
|
129
217
|
logData_js_1.logger.info(`Execution terminated successfully. Script: ${request.scriptName}, Test Case ID: ${request.testCaseId}`);
|
|
218
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
219
|
+
topic: topic, message: {
|
|
220
|
+
topic: "",
|
|
221
|
+
service: "",
|
|
222
|
+
chatId: "",
|
|
223
|
+
aiPromptPayload: {
|
|
224
|
+
display: false,
|
|
225
|
+
message: "",
|
|
226
|
+
messageId: "",
|
|
227
|
+
branchId: "",
|
|
228
|
+
userId: request.userId,
|
|
229
|
+
scriptId: "",
|
|
230
|
+
scriptType: "",
|
|
231
|
+
type: "logs",
|
|
232
|
+
sessionId: "",
|
|
233
|
+
licenseId: request.licenseId,
|
|
234
|
+
projectId: request.projectId,
|
|
235
|
+
liveLogs: {
|
|
236
|
+
executionId: request.kafkaMessageKey,
|
|
237
|
+
message: "Execution terminated by the user",
|
|
238
|
+
messageType: messageType_js_1.MessageType.LiveLog.Termination,
|
|
239
|
+
},
|
|
240
|
+
attachment: [],
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
});
|
|
130
244
|
break;
|
|
131
245
|
}
|
|
132
246
|
logData_js_1.logger.info(`Processing step ${stepCount}: ${step}`);
|
|
@@ -139,7 +253,139 @@ class AutomationRunner {
|
|
|
139
253
|
args: { priorAndNextSteps },
|
|
140
254
|
input: { currentStep: step }
|
|
141
255
|
});
|
|
256
|
+
if (platform === "android" || platform === "ios") {
|
|
257
|
+
if (!driver) {
|
|
258
|
+
await context.initializeMobileDriver(result.response.keywords);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
262
|
+
topic: topic, message: {
|
|
263
|
+
topic: "",
|
|
264
|
+
service: "",
|
|
265
|
+
chatId: "",
|
|
266
|
+
aiPromptPayload: {
|
|
267
|
+
display: false,
|
|
268
|
+
message: "",
|
|
269
|
+
messageId: "",
|
|
270
|
+
branchId: "",
|
|
271
|
+
userId: request.userId,
|
|
272
|
+
scriptId: "",
|
|
273
|
+
scriptType: "",
|
|
274
|
+
type: "logs",
|
|
275
|
+
sessionId: "",
|
|
276
|
+
licenseId: request.licenseId,
|
|
277
|
+
projectId: request.projectId,
|
|
278
|
+
liveLogs: {
|
|
279
|
+
executionId: request.kafkaMessageKey,
|
|
280
|
+
message: result.response.liveLog,
|
|
281
|
+
messageType: messageType_js_1.MessageType.LiveLog.Ongoing,
|
|
282
|
+
},
|
|
283
|
+
attachment: [],
|
|
284
|
+
},
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
logData_js_1.logger.info(`Message produced to Kafka topic - ${JSON.stringify({ messageType: messageType_js_1.MessageType.LiveLog.Ongoing })}`);
|
|
142
288
|
const action = result.response.action;
|
|
289
|
+
if (request.scenario && action === 'enter') {
|
|
290
|
+
const currentUserStoryStep = request.userStory[index];
|
|
291
|
+
if (currentUserStoryStep &&
|
|
292
|
+
currentUserStoryStep.length > 1 &&
|
|
293
|
+
typeof currentUserStoryStep[1] === 'string' &&
|
|
294
|
+
currentUserStoryStep[1].trim() == '') {
|
|
295
|
+
throw new Error(`Input is missing for the given step: ${currentUserStoryStep?.[0]}. Please provide the input.`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (action === 'notwebopenaction') {
|
|
299
|
+
throw new Error(`Selected platform is invalid for the step: ${step}`);
|
|
300
|
+
}
|
|
301
|
+
if (!allAction_js_1.allKeywordAction.includes(action)) {
|
|
302
|
+
throw new Error(`Unsupported action at action or keyword exracter: ${action}`);
|
|
303
|
+
}
|
|
304
|
+
let handler = actionHandlers[action];
|
|
305
|
+
if (supportedActions_js_1.INPUTLESS_ACTIONS.includes(action)) {
|
|
306
|
+
logData_js_1.logger.info(result.response.keywords);
|
|
307
|
+
await handler({ keywords: result.response.keywords, step: step, driverSession: request.kafkaMessageKey });
|
|
308
|
+
stepCount++;
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
if (action === "getOtp") {
|
|
312
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
313
|
+
platform: platform,
|
|
314
|
+
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
315
|
+
args: {
|
|
316
|
+
stepAction: "getOtp",
|
|
317
|
+
extractedDomJson: null,
|
|
318
|
+
priorAndNextSteps,
|
|
319
|
+
isAlert: false,
|
|
320
|
+
isDrag: false
|
|
321
|
+
},
|
|
322
|
+
input: { currentStep: step }
|
|
323
|
+
});
|
|
324
|
+
const otpAction = platform === "android" || platform === "ios"
|
|
325
|
+
? sameActionsHelper_js_1.sameActionHelper[stepResult.response.nlpName] ||
|
|
326
|
+
stepResult.response.nlpName
|
|
327
|
+
: stepResult.response.nlpName;
|
|
328
|
+
handler = actionHandlers[otpAction];
|
|
329
|
+
await handler({
|
|
330
|
+
selector: stepResult.response.inputText,
|
|
331
|
+
timeFrom: stepResult.response.timeFrom,
|
|
332
|
+
waitTime: stepResult.response.waitTime,
|
|
333
|
+
activity: stepResult.response.activity,
|
|
334
|
+
otpExtractor: async (smsBody) => {
|
|
335
|
+
const llmRes = await stepProcessor.getLLMResponse({
|
|
336
|
+
platform: platform,
|
|
337
|
+
type: promptType_js_1.PromptType.OTP_EXTRACTOR,
|
|
338
|
+
args: {},
|
|
339
|
+
input: { smsBody }
|
|
340
|
+
});
|
|
341
|
+
if (llmRes.response?.otp) {
|
|
342
|
+
context.extractedOtp = llmRes.response.otp;
|
|
343
|
+
}
|
|
344
|
+
return llmRes.response;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
stepCount++;
|
|
348
|
+
continue;
|
|
349
|
+
}
|
|
350
|
+
if (action === "getOtp") {
|
|
351
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
352
|
+
platform: platform,
|
|
353
|
+
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
354
|
+
args: {
|
|
355
|
+
stepAction: "getOtp",
|
|
356
|
+
extractedDomJson: null,
|
|
357
|
+
priorAndNextSteps,
|
|
358
|
+
isAlert: false,
|
|
359
|
+
isDrag: false
|
|
360
|
+
},
|
|
361
|
+
input: { currentStep: step }
|
|
362
|
+
});
|
|
363
|
+
const otpAction = platform === "android" || platform === "ios"
|
|
364
|
+
? sameActionsHelper_js_1.sameActionHelper[stepResult.response.nlpName] ||
|
|
365
|
+
stepResult.response.nlpName
|
|
366
|
+
: stepResult.response.nlpName;
|
|
367
|
+
handler = actionHandlers[otpAction];
|
|
368
|
+
await handler({
|
|
369
|
+
selector: stepResult.response.inputText,
|
|
370
|
+
timeFrom: stepResult.response.timeFrom,
|
|
371
|
+
waitTime: stepResult.response.waitTime,
|
|
372
|
+
activity: stepResult.response.activity,
|
|
373
|
+
otpExtractor: async (smsBody) => {
|
|
374
|
+
const llmRes = await stepProcessor.getLLMResponse({
|
|
375
|
+
platform: platform,
|
|
376
|
+
type: promptType_js_1.PromptType.OTP_EXTRACTOR,
|
|
377
|
+
args: {},
|
|
378
|
+
input: { smsBody }
|
|
379
|
+
});
|
|
380
|
+
if (llmRes.response?.otp) {
|
|
381
|
+
context.extractedOtp = llmRes.response.otp;
|
|
382
|
+
}
|
|
383
|
+
return llmRes.response;
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
stepCount++;
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
143
389
|
let elementName = result.response.elementName;
|
|
144
390
|
if (elementName) {
|
|
145
391
|
const baseName = elementName;
|
|
@@ -153,30 +399,30 @@ class AutomationRunner {
|
|
|
153
399
|
result.response.elementName = elementName;
|
|
154
400
|
usedElementNames.push(elementName);
|
|
155
401
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
stepCount++;
|
|
164
|
-
continue;
|
|
165
|
-
}
|
|
166
|
-
if (platform == "web") {
|
|
167
|
-
driver = await context.session.getCurrentDriver();
|
|
402
|
+
try {
|
|
403
|
+
if (platform == "web") {
|
|
404
|
+
driver = await context.session.getCurrentDriver();
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
driver = await context.mobileSession.getCurrentDriver();
|
|
408
|
+
}
|
|
168
409
|
}
|
|
169
|
-
|
|
170
|
-
|
|
410
|
+
catch (error) {
|
|
411
|
+
if (action == "verify") {
|
|
412
|
+
driver = null;
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
throw error;
|
|
416
|
+
}
|
|
171
417
|
}
|
|
172
|
-
if (await (0, isAlertPresent_js_1.isAlertPresent)(driver) &&
|
|
418
|
+
if (await (0, isAlertPresent_js_1.isAlertPresent)(driver) && !["wait", "verify"].includes(action)) {
|
|
173
419
|
logData_js_1.logger.info("Alert is present");
|
|
174
420
|
stepResult = await stepProcessor.getLLMResponse({
|
|
175
421
|
platform: platform,
|
|
176
422
|
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
177
423
|
args: {
|
|
178
424
|
stepAction: action,
|
|
179
|
-
extractedDomJson:
|
|
425
|
+
extractedDomJson: null,
|
|
180
426
|
priorAndNextSteps,
|
|
181
427
|
isAlert: true,
|
|
182
428
|
isDrag: false
|
|
@@ -186,50 +432,90 @@ class AutomationRunner {
|
|
|
186
432
|
stepAction = stepResult.response.action;
|
|
187
433
|
handler = actionHandlers[stepAction];
|
|
188
434
|
await handler({
|
|
189
|
-
value: stepResult.response.
|
|
435
|
+
value: stepResult.response.inputText
|
|
190
436
|
});
|
|
437
|
+
stepCount++;
|
|
191
438
|
continue;
|
|
192
439
|
}
|
|
193
440
|
else {
|
|
194
|
-
|
|
441
|
+
let toonDom;
|
|
442
|
+
if (preCapturedDomInfo && platform === "web") {
|
|
195
443
|
logData_js_1.logger.info("Using pre-captured DOM from previous toaster detection");
|
|
196
444
|
domInfo = preCapturedDomInfo;
|
|
197
445
|
preCapturedDomInfo = null;
|
|
446
|
+
const parser = new jsdom_1.JSDOM((0, domSanitizer_js_1.sanitizeWebDom)(domInfo.dom));
|
|
447
|
+
doc = parser.window.document;
|
|
198
448
|
}
|
|
199
449
|
else {
|
|
450
|
+
try {
|
|
451
|
+
if (platform === "web") {
|
|
452
|
+
domInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
453
|
+
logData_js_1.logger.saveDOM(domInfo.dom, `annotated-dom-${stepCount}`);
|
|
454
|
+
const parser = new jsdom_1.JSDOM((0, domSanitizer_js_1.sanitizeWebDom)(domInfo.dom));
|
|
455
|
+
doc = parser.window.document;
|
|
456
|
+
}
|
|
457
|
+
else {
|
|
458
|
+
domInfo = await (0, jsForAttributeInjection_js_2.getAnnotatedDOMForMobile)(driver);
|
|
459
|
+
logData_js_1.logger.saveDOM(domInfo.dom, `annotated-dom-Mob-${stepCount}`);
|
|
460
|
+
const parser = new jsdom_1.JSDOM(domInfo.dom, {
|
|
461
|
+
contentType: "text/xml"
|
|
462
|
+
});
|
|
463
|
+
doc = parser.window.document;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
if (action == "verify") {
|
|
468
|
+
extractedRelevantDom = null;
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
throw error;
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
try {
|
|
200
476
|
if (platform === "web") {
|
|
201
|
-
|
|
202
|
-
|
|
477
|
+
extractedRelevantDom = await domProcessor.webProcess({
|
|
478
|
+
keywords: result.response.keywords,
|
|
479
|
+
rawDom: domInfo.dom,
|
|
480
|
+
stepCount: stepCount,
|
|
481
|
+
stepAction: action,
|
|
482
|
+
step: step,
|
|
483
|
+
platform: platform,
|
|
484
|
+
driver: driver
|
|
485
|
+
});
|
|
486
|
+
toonDom = (0, toon_1.encode)(extractedRelevantDom || []);
|
|
487
|
+
// logger.saveJSON(extractedRelevantDom, `relevant-dom-${stepCount}`);
|
|
488
|
+
logData_js_1.logger.saveText(toonDom, `relevant-dom-toon-${stepCount}`);
|
|
203
489
|
}
|
|
204
490
|
else {
|
|
205
|
-
|
|
206
|
-
|
|
491
|
+
extractedRelevantDom = await domProcessor.mobileProcess({
|
|
492
|
+
keywords: result.response.keywords,
|
|
493
|
+
rawDom: domInfo.dom,
|
|
494
|
+
stepCount: stepCount,
|
|
495
|
+
stepAction: action,
|
|
496
|
+
step: step,
|
|
497
|
+
platform: platform,
|
|
498
|
+
driver: driver
|
|
499
|
+
});
|
|
500
|
+
toonDom = (0, toon_1.encode)(extractedRelevantDom || []);
|
|
501
|
+
// logger.saveJSON(extractedRelevantDom, `relevant-dom-Mob-${stepCount}`);
|
|
502
|
+
logData_js_1.logger.saveText(toonDom, `relevant-dom-toon-Mob-${stepCount}`);
|
|
207
503
|
}
|
|
208
504
|
}
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
});
|
|
217
|
-
logData_js_1.logger.saveJSON(extractedRelevantDom, `relevant-dom-${stepCount}`);
|
|
218
|
-
}
|
|
219
|
-
else {
|
|
220
|
-
extractedRelevantDom = domProcessor.mobileProcess({
|
|
221
|
-
keywords: result.response.keywords,
|
|
222
|
-
rawDom: domInfo.dom,
|
|
223
|
-
stepCount: stepCount
|
|
224
|
-
});
|
|
225
|
-
logData_js_1.logger.saveJSON(extractedRelevantDom, `relevant-dom-Mob-${stepCount}`);
|
|
505
|
+
catch (error) {
|
|
506
|
+
if (action == "verify") {
|
|
507
|
+
extractedRelevantDom = null;
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
throw error;
|
|
511
|
+
}
|
|
226
512
|
}
|
|
227
513
|
if (action == "verify") {
|
|
228
514
|
stepResult = await stepProcessor.getLLMResponse({
|
|
229
515
|
platform: platform,
|
|
230
516
|
type: promptType_js_1.PromptType.VERIFY_PROMPT,
|
|
231
517
|
args: {
|
|
232
|
-
extractedDomJson:
|
|
518
|
+
extractedDomJson: toonDom,
|
|
233
519
|
priorAndNextSteps,
|
|
234
520
|
},
|
|
235
521
|
input: { currentStep: step }
|
|
@@ -241,7 +527,7 @@ class AutomationRunner {
|
|
|
241
527
|
platform: platform,
|
|
242
528
|
type: promptType_js_1.PromptType.GET_PROMPT,
|
|
243
529
|
args: {
|
|
244
|
-
extractedDomJson:
|
|
530
|
+
extractedDomJson: toonDom,
|
|
245
531
|
priorAndNextSteps,
|
|
246
532
|
},
|
|
247
533
|
input: { currentStep: step }
|
|
@@ -253,7 +539,7 @@ class AutomationRunner {
|
|
|
253
539
|
platform: platform,
|
|
254
540
|
type: promptType_js_1.PromptType.WAIT_ACTION_EXTRACTOR_PROMPT,
|
|
255
541
|
args: {
|
|
256
|
-
extractedDomJson:
|
|
542
|
+
extractedDomJson: toonDom,
|
|
257
543
|
priorAndNextSteps,
|
|
258
544
|
},
|
|
259
545
|
input: { currentStep: step }
|
|
@@ -265,7 +551,7 @@ class AutomationRunner {
|
|
|
265
551
|
platform: platform,
|
|
266
552
|
type: promptType_js_1.PromptType.COMBINED_ACTION_EXTRACTOR_PROMPT,
|
|
267
553
|
args: {
|
|
268
|
-
extractedDomJson:
|
|
554
|
+
extractedDomJson: toonDom,
|
|
269
555
|
priorAndNextSteps,
|
|
270
556
|
},
|
|
271
557
|
input: { currentStep: step }
|
|
@@ -277,7 +563,7 @@ class AutomationRunner {
|
|
|
277
563
|
platform: platform,
|
|
278
564
|
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
279
565
|
args: {
|
|
280
|
-
extractedDomJson:
|
|
566
|
+
extractedDomJson: toonDom,
|
|
281
567
|
priorAndNextSteps,
|
|
282
568
|
isDrag: true,
|
|
283
569
|
isAlert: false
|
|
@@ -291,8 +577,8 @@ class AutomationRunner {
|
|
|
291
577
|
platform: platform,
|
|
292
578
|
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
293
579
|
args: {
|
|
294
|
-
stepAction: action,
|
|
295
|
-
extractedDomJson:
|
|
580
|
+
stepAction: action === "enterOtp" ? "enter" : action,
|
|
581
|
+
extractedDomJson: toonDom,
|
|
296
582
|
priorAndNextSteps,
|
|
297
583
|
isAlert: false,
|
|
298
584
|
isDrag: false
|
|
@@ -305,11 +591,23 @@ class AutomationRunner {
|
|
|
305
591
|
else {
|
|
306
592
|
stepAction = stepResult.response.nlpName;
|
|
307
593
|
}
|
|
594
|
+
if ((action === "enterOtp" || stepAction === "enterOtp") && context.extractedOtp) {
|
|
595
|
+
stepResult.response.inputText = context.extractedOtp;
|
|
596
|
+
}
|
|
308
597
|
}
|
|
309
598
|
}
|
|
310
|
-
if (platform === "android") {
|
|
599
|
+
if (platform === "android" || platform === "ios") {
|
|
311
600
|
stepAction = sameActionsHelper_js_1.sameActionHelper[stepAction] || stepAction;
|
|
312
|
-
|
|
601
|
+
// logger.info(`step action: ${stepAction}`);
|
|
602
|
+
}
|
|
603
|
+
if (supportedActions_js_1.SKIPPED_ACTIONS.includes(stepAction)) {
|
|
604
|
+
handler = actionHandlers[stepAction];
|
|
605
|
+
await handler();
|
|
606
|
+
stepCount++;
|
|
607
|
+
continue;
|
|
608
|
+
}
|
|
609
|
+
if (platform === "web") {
|
|
610
|
+
beforeHandles = await driver.getWindowHandles();
|
|
313
611
|
}
|
|
314
612
|
if (supportedActions_js_1.ELEMENTLESS_ACTION.includes(stepAction)) {
|
|
315
613
|
let currentDriver = null;
|
|
@@ -319,218 +617,460 @@ class AutomationRunner {
|
|
|
319
617
|
beforeHandles = await currentDriver.getWindowHandles();
|
|
320
618
|
}
|
|
321
619
|
else {
|
|
322
|
-
currentDriver = await context.
|
|
620
|
+
currentDriver = await context.mobileSession.getCurrentDriver();
|
|
323
621
|
}
|
|
324
622
|
handler = actionHandlers[stepAction];
|
|
325
|
-
|
|
326
|
-
if ((currentDriver) && (platform == "web")) {
|
|
327
|
-
await (0, newTabTracker_js_1.newTabTracker)(currentDriver, action, beforeHandles, context.scriptAppender);
|
|
328
|
-
}
|
|
329
|
-
stepCount++;
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
try {
|
|
333
|
-
if (stepAction == "Builtin_DragAndDropToElement") {
|
|
334
|
-
handler = actionHandlers[stepAction];
|
|
335
|
-
const fireflinkIndex1 = stepResult.response.drag;
|
|
336
|
-
const ele1 = doc.querySelector(`[ff-inspect="${fireflinkIndex1}"]`);
|
|
337
|
-
const selector1 = ele1?.getAttribute("ff-xpath");
|
|
338
|
-
const fireflinkIndex2 = stepResult.response.drop;
|
|
339
|
-
const ele2 = doc.querySelector(`[ff-inspect="${fireflinkIndex2}"]`);
|
|
340
|
-
const selector2 = ele2?.getAttribute("ff-xpath");
|
|
341
|
-
if (!selector2 && !selector1) {
|
|
342
|
-
throw new Error(`Unable to resolve xpath for ${fireflinkIndex2}`);
|
|
343
|
-
}
|
|
344
|
-
else if (fireflinkIndex2 == "Fire-Flink-0" && fireflinkIndex1 == "Fire-Flink-0") {
|
|
345
|
-
throw new Error(`Unable to find element for ${step}`);
|
|
346
|
-
}
|
|
623
|
+
if (stepAction == "getOtp") {
|
|
347
624
|
await handler({
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
625
|
+
selector: stepResult.response.inputText,
|
|
626
|
+
activity: stepResult.response.activity,
|
|
627
|
+
otpExtractor: async (smsBody) => {
|
|
628
|
+
const llmRes = await stepProcessor.getLLMResponse({
|
|
629
|
+
platform: platform,
|
|
630
|
+
type: promptType_js_1.PromptType.OTP_EXTRACTOR,
|
|
631
|
+
args: {},
|
|
632
|
+
input: { smsBody }
|
|
633
|
+
});
|
|
634
|
+
if (llmRes.response?.otp) {
|
|
635
|
+
context.extractedOtp = llmRes.response.otp;
|
|
636
|
+
}
|
|
637
|
+
return llmRes.response;
|
|
638
|
+
}
|
|
357
639
|
});
|
|
640
|
+
stepCount++;
|
|
358
641
|
continue;
|
|
359
642
|
}
|
|
360
|
-
fireflinkIndex = stepResult.response.attribute_value;
|
|
361
|
-
if (fireflinkIndex == "Fire-Flink-0") {
|
|
362
|
-
logData_js_1.logger.error(`element not found for step "${step}"`);
|
|
363
|
-
throw new Error(`element not found for step "${step}"`, { cause: node_console_1.error });
|
|
364
|
-
}
|
|
365
|
-
if (platform === "web") {
|
|
366
|
-
const ele = doc.querySelector(`[ff-inspect="${fireflinkIndex}"]`);
|
|
367
|
-
selector = ele.getAttribute("ff-xpath");
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
const result = await (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, fireflinkIndex);
|
|
371
|
-
selector = result.xpathPath;
|
|
372
|
-
}
|
|
373
|
-
if (!selector) {
|
|
374
|
-
logData_js_1.logger.info(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
375
|
-
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`, { cause: node_console_1.error });
|
|
376
|
-
}
|
|
377
|
-
if (platform === "web") {
|
|
378
|
-
beforeHandles = await driver.getWindowHandles();
|
|
379
|
-
}
|
|
380
|
-
if (selector.includes("shadow")) {
|
|
381
|
-
stepAction = stepAction + "_shadow";
|
|
382
|
-
logData_js_1.logger.info(stepAction);
|
|
383
|
-
}
|
|
384
|
-
else if (selector.includes("iframe")) {
|
|
385
|
-
frameAction = "switchToDefaultContent";
|
|
386
|
-
handler = actionHandlers[frameAction];
|
|
387
|
-
await handler({
|
|
388
|
-
driver: driver,
|
|
389
|
-
});
|
|
390
|
-
const result_if = await driver.executeAsyncScript(jsFindElement_js_1.Find_element_by_ff_js_script, [fireflinkIndex]);
|
|
391
|
-
if (!result_if?.success) {
|
|
392
|
-
logData_js_1.logger.info("Not found");
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
const { xpath_if, frames, iframe_dom_html } = result_if;
|
|
396
|
-
selector = xpath_if;
|
|
397
|
-
iframeDomHtml = iframe_dom_html;
|
|
398
|
-
frameAction = "switchToFrame";
|
|
399
|
-
handler = actionHandlers[frameAction];
|
|
400
|
-
await handler({
|
|
401
|
-
selector: selector,
|
|
402
|
-
fireflinkIndex,
|
|
403
|
-
frames: frames,
|
|
404
|
-
elementName: result.response.elementName,
|
|
405
|
-
elementType: stepResult.response.elementType
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
handler = actionHandlers[stepAction];
|
|
409
|
-
if (iframeDomHtml != null) {
|
|
410
|
-
domInfo = iframeDomHtml;
|
|
411
|
-
}
|
|
412
|
-
else {
|
|
413
|
-
domInfo = domInfo.dom;
|
|
414
|
-
}
|
|
415
643
|
await handler({
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
fireflinkIndex,
|
|
419
|
-
pageDOM: domInfo,
|
|
644
|
+
value: stepResult.response.inputText,
|
|
645
|
+
selector: stepResult.response.attributeValue,
|
|
420
646
|
elementName: result.response.elementName,
|
|
421
|
-
elementType: stepResult.response.elementType
|
|
422
|
-
num_of_scrolls: stepResult.response.num_of_scrolls,
|
|
423
|
-
direction: stepResult.response.direction,
|
|
647
|
+
elementType: stepResult.response.elementType
|
|
424
648
|
});
|
|
425
|
-
if (platform
|
|
426
|
-
|
|
427
|
-
if (action === "click") {
|
|
428
|
-
await driver.executeScript(jsForToaster_js_1.TOAST_WATCHER_JS, []);
|
|
429
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
430
|
-
const postClickToastDetected = await driver.executeScript("return window.__toastDetected === true;", []);
|
|
431
|
-
if (postClickToastDetected) {
|
|
432
|
-
logData_js_1.logger.info(`Toast detected after click`);
|
|
433
|
-
preCapturedDomInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
434
|
-
logData_js_1.logger.saveDOM(preCapturedDomInfo.dom, `toaster-dom-${stepCount}`);
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
await (0, newTabTracker_js_1.newTabTracker)(driver, action, beforeHandles, context.scriptAppender);
|
|
649
|
+
if ((currentDriver) && (platform == "web")) {
|
|
650
|
+
await (0, newTabTracker_js_1.newTabTracker)(currentDriver, action, beforeHandles, context.scriptAppender);
|
|
439
651
|
}
|
|
652
|
+
stepCount++;
|
|
653
|
+
continue;
|
|
440
654
|
}
|
|
441
|
-
|
|
442
|
-
|
|
655
|
+
baseStepActionBeforeFallback = stepAction;
|
|
656
|
+
for (let fallbackAttempt = 1; fallbackAttempt <= 2; fallbackAttempt++) {
|
|
443
657
|
try {
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
658
|
+
if (fallbackAttempt > 1) {
|
|
659
|
+
logData_js_1.logger.info(`Waiting 5 seconds before retrying step "${step}". Attempt ${fallbackAttempt}`);
|
|
660
|
+
await new Promise(resolve => setTimeout(resolve, 5000));
|
|
661
|
+
logData_js_1.logger.info(`Retrying step "${step}" after vision fallback failure. Attempt ${fallbackAttempt}`);
|
|
662
|
+
// if (result.response.liveLog) {
|
|
663
|
+
// await produceLiveLog(result.response.liveLog);
|
|
664
|
+
// }
|
|
665
|
+
stepAction = baseStepActionBeforeFallback;
|
|
666
|
+
selector = "";
|
|
667
|
+
xpath = "";
|
|
668
|
+
iframeDomHtml = null;
|
|
669
|
+
beforeHandles = null;
|
|
670
|
+
if (platform === "web") {
|
|
671
|
+
domInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
672
|
+
logData_js_1.logger.saveDOM(domInfo.dom, `annotated-dom-retry-${stepCount}`);
|
|
673
|
+
const parser = new jsdom_1.JSDOM((0, domSanitizer_js_1.sanitizeWebDom)(domInfo.dom));
|
|
674
|
+
doc = parser.window.document;
|
|
675
|
+
}
|
|
676
|
+
else {
|
|
677
|
+
domInfo = await (0, jsForAttributeInjection_js_2.getAnnotatedDOMForMobile)(driver);
|
|
678
|
+
logData_js_1.logger.saveDOM(domInfo.dom, `annotated-dom-Mob-retry-${stepCount}`);
|
|
679
|
+
const parser = new jsdom_1.JSDOM(domInfo.dom, {
|
|
680
|
+
contentType: "text/xml"
|
|
681
|
+
});
|
|
682
|
+
doc = parser.window.document;
|
|
683
|
+
}
|
|
684
|
+
let retryToonDom;
|
|
685
|
+
if (platform === "web") {
|
|
686
|
+
extractedRelevantDom = await domProcessor.webProcess({
|
|
687
|
+
keywords: result.response.keywords,
|
|
688
|
+
rawDom: domInfo.dom,
|
|
689
|
+
stepCount: stepCount,
|
|
690
|
+
stepAction: action,
|
|
691
|
+
step: step,
|
|
692
|
+
platform: platform,
|
|
693
|
+
driver: driver
|
|
694
|
+
});
|
|
695
|
+
retryToonDom = (0, toon_1.encode)(extractedRelevantDom || []);
|
|
696
|
+
logData_js_1.logger.saveText(retryToonDom, `relevant-dom-toon-retry-${stepCount}`);
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
extractedRelevantDom = await domProcessor.mobileProcess({
|
|
700
|
+
keywords: result.response.keywords,
|
|
701
|
+
rawDom: domInfo.dom,
|
|
702
|
+
stepCount: stepCount,
|
|
703
|
+
stepAction: action,
|
|
704
|
+
step: step,
|
|
705
|
+
platform: platform,
|
|
706
|
+
driver: driver
|
|
707
|
+
});
|
|
708
|
+
retryToonDom = (0, toon_1.encode)(extractedRelevantDom || []);
|
|
709
|
+
logData_js_1.logger.saveText(retryToonDom, `relevant-dom-toon-Mob-retry-${stepCount}`);
|
|
710
|
+
}
|
|
711
|
+
if (action == "verify") {
|
|
712
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
713
|
+
platform: platform,
|
|
714
|
+
type: promptType_js_1.PromptType.VERIFY_PROMPT,
|
|
715
|
+
args: {
|
|
716
|
+
extractedDomJson: retryToonDom,
|
|
717
|
+
priorAndNextSteps,
|
|
718
|
+
},
|
|
719
|
+
input: { currentStep: step }
|
|
720
|
+
});
|
|
721
|
+
stepAction = stepResult.response.nlpName;
|
|
722
|
+
}
|
|
723
|
+
else if (action == "get") {
|
|
724
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
725
|
+
platform: platform,
|
|
726
|
+
type: promptType_js_1.PromptType.GET_PROMPT,
|
|
727
|
+
args: {
|
|
728
|
+
extractedDomJson: retryToonDom,
|
|
729
|
+
priorAndNextSteps,
|
|
730
|
+
},
|
|
731
|
+
input: { currentStep: step }
|
|
732
|
+
});
|
|
733
|
+
stepAction = stepResult.response.nlpName;
|
|
734
|
+
}
|
|
735
|
+
else if (action == "wait") {
|
|
736
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
737
|
+
platform: platform,
|
|
738
|
+
type: promptType_js_1.PromptType.WAIT_ACTION_EXTRACTOR_PROMPT,
|
|
739
|
+
args: {
|
|
740
|
+
extractedDomJson: retryToonDom,
|
|
741
|
+
priorAndNextSteps,
|
|
742
|
+
},
|
|
743
|
+
input: { currentStep: step }
|
|
744
|
+
});
|
|
745
|
+
stepAction = stepResult.response.nlpName;
|
|
746
|
+
}
|
|
747
|
+
else if (action == "combined") {
|
|
748
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
749
|
+
platform: platform,
|
|
750
|
+
type: promptType_js_1.PromptType.COMBINED_ACTION_EXTRACTOR_PROMPT,
|
|
751
|
+
args: {
|
|
752
|
+
extractedDomJson: retryToonDom,
|
|
753
|
+
priorAndNextSteps,
|
|
754
|
+
},
|
|
755
|
+
input: { currentStep: step }
|
|
756
|
+
});
|
|
757
|
+
stepAction = stepResult.response.nlpName;
|
|
758
|
+
}
|
|
759
|
+
else if (action == "drag_and_drop") {
|
|
760
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
761
|
+
platform: platform,
|
|
762
|
+
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
763
|
+
args: {
|
|
764
|
+
extractedDomJson: retryToonDom,
|
|
765
|
+
priorAndNextSteps,
|
|
766
|
+
isDrag: true,
|
|
767
|
+
isAlert: false
|
|
768
|
+
},
|
|
769
|
+
input: { currentStep: step }
|
|
770
|
+
});
|
|
771
|
+
stepAction = stepResult.response.nlpName;
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
774
|
+
stepResult = await stepProcessor.getLLMResponse({
|
|
775
|
+
platform: platform,
|
|
776
|
+
type: promptType_js_1.PromptType.FF_INSPECTOR,
|
|
777
|
+
args: {
|
|
778
|
+
stepAction: action,
|
|
779
|
+
extractedDomJson: retryToonDom,
|
|
780
|
+
priorAndNextSteps,
|
|
781
|
+
isAlert: false,
|
|
782
|
+
isDrag: false
|
|
783
|
+
},
|
|
784
|
+
input: { currentStep: step }
|
|
785
|
+
});
|
|
786
|
+
stepAction = platform == "web"
|
|
787
|
+
? stepResult.response.action
|
|
788
|
+
: stepResult.response.nlpName;
|
|
789
|
+
}
|
|
790
|
+
if (platform === "android" || platform === "ios") {
|
|
791
|
+
stepAction = sameActionsHelper_js_1.sameActionHelper[stepAction] || stepAction;
|
|
792
|
+
}
|
|
448
793
|
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
794
|
+
if (stepAction == "Builtin_DragAndDropToElement") {
|
|
795
|
+
handler = actionHandlers[stepAction];
|
|
796
|
+
const fireflinkIndex1 = stepResult.response.drag;
|
|
797
|
+
const ele1 = doc.querySelector(`[ff-inspect="${fireflinkIndex1}"]`);
|
|
798
|
+
const selector1 = ele1?.getAttribute("ff-xpath");
|
|
799
|
+
const fireflinkIndex2 = stepResult.response.drop;
|
|
800
|
+
const ele2 = doc.querySelector(`[ff-inspect="${fireflinkIndex2}"]`);
|
|
801
|
+
const selector2 = ele2?.getAttribute("ff-xpath");
|
|
802
|
+
if (!selector2 && !selector1) {
|
|
803
|
+
throw new Error(`Unable to resolve xpath for ${fireflinkIndex2}`);
|
|
804
|
+
}
|
|
805
|
+
else if (fireflinkIndex2 == "Fire-Flink-0" && fireflinkIndex1 == "Fire-Flink-0") {
|
|
806
|
+
throw new Error(`Unable to find element for ${step}`);
|
|
807
|
+
}
|
|
808
|
+
await handler({
|
|
809
|
+
selector1: selector1,
|
|
810
|
+
selector2: selector2,
|
|
811
|
+
fireflinkIndex1: fireflinkIndex1,
|
|
812
|
+
fireflinkIndex2: fireflinkIndex2,
|
|
813
|
+
pageDOM: domInfo.dom,
|
|
814
|
+
elementName1: stepResult.response.drag_element_name,
|
|
815
|
+
elementName2: stepResult.response.drop_element_name,
|
|
816
|
+
elementType1: stepResult.response.drag_element_type,
|
|
817
|
+
elementType2: stepResult.response.drop_element_type
|
|
818
|
+
});
|
|
819
|
+
continue;
|
|
453
820
|
}
|
|
454
|
-
|
|
455
|
-
platform: platform,
|
|
456
|
-
type: promptType_js_1.PromptType.VISION_PROMPT,
|
|
457
|
-
args: {
|
|
458
|
-
priorAndNextSteps
|
|
459
|
-
},
|
|
460
|
-
input: { currentStep: step, annotatedScreenshot: annotatedScreenshot }
|
|
461
|
-
});
|
|
462
|
-
fireflinkIndex = stepResultVision.response.fireflinkIndex;
|
|
463
|
-
logData_js_1.logger.info(`fireflinkIndex: ${fireflinkIndex}`);
|
|
821
|
+
fireflinkIndex = stepResult.response.attributeValue;
|
|
464
822
|
if (fireflinkIndex == "Fire-Flink-0") {
|
|
465
|
-
logData_js_1.logger.error(`
|
|
466
|
-
|
|
467
|
-
throw new Error(`vision unable to find element for step "${step}"`, { cause: error });
|
|
468
|
-
}
|
|
469
|
-
if (platform == "android") {
|
|
470
|
-
const index = Number(fireflinkIndex.split("-").pop());
|
|
471
|
-
const box = bounds[index - 1];
|
|
472
|
-
if (!box) {
|
|
473
|
-
throw new Error(`No bounds found for index ${index}`, { cause: error });
|
|
474
|
-
}
|
|
475
|
-
const { x1, y1, x2, y2 } = box;
|
|
476
|
-
const boundsStr = `[${x1},${y1}][${x2},${y2}]`;
|
|
477
|
-
const result = (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, boundsStr);
|
|
478
|
-
xpath = result.xpathPath;
|
|
479
|
-
fireflinkIndex = result.ffInspector ?? fireflinkIndex;
|
|
480
|
-
logData_js_1.logger.info(`fireflinkIndex: ${fireflinkIndex}`);
|
|
481
|
-
logData_js_1.logger.info(`xpath: ${xpath}`);
|
|
823
|
+
logData_js_1.logger.error(`element not found for step "${step}"`);
|
|
824
|
+
throw new Error(`element not found for step "${step}"`, { cause: node_console_1.error });
|
|
482
825
|
}
|
|
483
|
-
|
|
826
|
+
if (platform === "web") {
|
|
827
|
+
if (!doc) {
|
|
828
|
+
logData_js_1.logger.info("doc is undefined. Rebuilding document from domInfo.");
|
|
829
|
+
if (!domInfo || !domInfo.dom) {
|
|
830
|
+
domInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
831
|
+
}
|
|
832
|
+
const parser = new jsdom_1.JSDOM((0, domSanitizer_js_1.sanitizeWebDom)(domInfo.dom));
|
|
833
|
+
doc = parser.window.document;
|
|
834
|
+
}
|
|
484
835
|
const ele = doc.querySelector(`[ff-inspect="${fireflinkIndex}"]`);
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
836
|
+
if (ele) {
|
|
837
|
+
selector = ele.getAttribute("ff-xpath") || "";
|
|
838
|
+
}
|
|
839
|
+
else {
|
|
840
|
+
const result = (0, xpathcreation_js_1.getWebXPathByFFIndex)(domInfo.dom, fireflinkIndex);
|
|
841
|
+
selector = result.xpathPath;
|
|
490
842
|
}
|
|
491
|
-
}
|
|
492
|
-
if (iframeDomHtml != null) {
|
|
493
|
-
domInfo = iframeDomHtml;
|
|
494
843
|
}
|
|
495
844
|
else {
|
|
496
|
-
|
|
845
|
+
const result = await (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, fireflinkIndex);
|
|
846
|
+
selector = result.xpathPath;
|
|
847
|
+
}
|
|
848
|
+
if (!selector) {
|
|
849
|
+
logData_js_1.logger.info(`Unable to resolve xpath for ${fireflinkIndex}`);
|
|
850
|
+
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`, { cause: node_console_1.error });
|
|
851
|
+
}
|
|
852
|
+
if (selector.includes("shadow")) {
|
|
853
|
+
stepAction = stepAction + "_shadow";
|
|
854
|
+
logData_js_1.logger.info(stepAction);
|
|
855
|
+
}
|
|
856
|
+
else if (selector.includes("iframe")) {
|
|
857
|
+
frameAction = "switchToDefaultContent";
|
|
858
|
+
handler = actionHandlers[frameAction];
|
|
859
|
+
await handler({
|
|
860
|
+
driver: driver,
|
|
861
|
+
});
|
|
862
|
+
const result_if = await driver.executeAsyncScript(jsFindElement_js_1.Find_element_by_ff_js_script, [fireflinkIndex]);
|
|
863
|
+
if (!result_if?.success) {
|
|
864
|
+
logData_js_1.logger.info("Not found");
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
const { xpath_if, frames, iframe_dom_html } = result_if;
|
|
868
|
+
selector = xpath_if;
|
|
869
|
+
iframeDomHtml = iframe_dom_html;
|
|
870
|
+
frameAction = "switchToFrame";
|
|
871
|
+
handler = actionHandlers[frameAction];
|
|
872
|
+
await handler({
|
|
873
|
+
selector: selector,
|
|
874
|
+
frames: frames,
|
|
875
|
+
elementName: result.response.elementName,
|
|
876
|
+
elementType: stepResult.response.elementType,
|
|
877
|
+
pageDOM: domInfo.dom,
|
|
878
|
+
fireflinkIndex
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
if (selector.includes('svg')) {
|
|
882
|
+
const match = /svg\[(\d+)\]/.exec(selector);
|
|
883
|
+
const svgIndex = match ? match[1] : "1";
|
|
884
|
+
selector = selector.replace(/svg\[\d+\]/, `*[name()='svg'][${svgIndex}]`);
|
|
497
885
|
}
|
|
498
|
-
|
|
886
|
+
pageDOM = iframeDomHtml ?? domInfo.dom;
|
|
499
887
|
handler = actionHandlers[stepAction];
|
|
888
|
+
// logger.info(`xpath ------>: ${selector}`)
|
|
500
889
|
await handler({
|
|
501
|
-
|
|
502
|
-
|
|
890
|
+
nlpName: stepResult.response.nlpName,
|
|
891
|
+
selector: selector,
|
|
892
|
+
value: stepResult.response.inputText,
|
|
503
893
|
fireflinkIndex,
|
|
504
|
-
pageDOM:
|
|
894
|
+
pageDOM: pageDOM,
|
|
505
895
|
elementName: result.response.elementName,
|
|
506
|
-
elementType: stepResult.response.elementType
|
|
896
|
+
elementType: stepResult.response.elementType,
|
|
897
|
+
numOfScrolls: stepResult.response.numOfScrolls,
|
|
898
|
+
direction: stepResult.response.direction,
|
|
899
|
+
stepIndex: stepCount,
|
|
900
|
+
filteredSteps: listOfSteps,
|
|
901
|
+
attributeType: stepResult.response.attributeType,
|
|
507
902
|
});
|
|
508
|
-
if (
|
|
509
|
-
if (
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
903
|
+
if (platform === "web") {
|
|
904
|
+
if (await (0, isAlertPresent_js_1.isAlertPresent)(driver) != true) {
|
|
905
|
+
if (action === "click") {
|
|
906
|
+
await driver.executeScript(jsForToaster_js_1.TOAST_WATCHER_JS, []);
|
|
907
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
908
|
+
const postClickToastDetected = await driver.executeScript("return window.__toastDetected === true;", []);
|
|
909
|
+
if (postClickToastDetected) {
|
|
910
|
+
logData_js_1.logger.info(`Toast detected after click`);
|
|
911
|
+
preCapturedDomInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
912
|
+
logData_js_1.logger.saveDOM(preCapturedDomInfo.dom, `toaster-dom-${stepCount}`);
|
|
913
|
+
}
|
|
517
914
|
}
|
|
518
915
|
}
|
|
916
|
+
if (beforeHandles?.length > 0) {
|
|
917
|
+
await (0, newTabTracker_js_1.newTabTracker)(driver, action, beforeHandles, context.scriptAppender);
|
|
918
|
+
}
|
|
519
919
|
}
|
|
920
|
+
if (fallbackAttempt === 2) {
|
|
921
|
+
await produceLiveLog("Retry successful. Moving on to the next step.");
|
|
922
|
+
}
|
|
923
|
+
break;
|
|
520
924
|
}
|
|
521
925
|
catch (error) {
|
|
522
|
-
logData_js_1.logger.error(`
|
|
523
|
-
|
|
926
|
+
logData_js_1.logger.error(`execution failed for step "${step}": ${error} and going for vision`);
|
|
927
|
+
try {
|
|
928
|
+
let annotatedScreenshot;
|
|
929
|
+
let bounds;
|
|
930
|
+
if (action === "scroll") {
|
|
931
|
+
throw new Error(`Scroll action failed element not found`, { cause: error });
|
|
932
|
+
}
|
|
933
|
+
if (platform === "web") {
|
|
934
|
+
annotatedScreenshot = await (0, generateAnnotatedScreenshots_js_1.generateAnnotatedScreenshots)(driver);
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
domInfo = await (0, jsForAttributeInjection_js_2.getAnnotatedDOMForMobile)(driver);
|
|
938
|
+
let VissionResult;
|
|
939
|
+
if (platform === "android") {
|
|
940
|
+
VissionResult = await (0, annotatedScreenshotMobile_js_1.annotateScreenshot)(driver, domInfo.dom);
|
|
941
|
+
}
|
|
942
|
+
else {
|
|
943
|
+
VissionResult = await (0, annotatedScreenshotMobile_js_1.annotateIosScreenshot)(driver, domInfo.dom);
|
|
944
|
+
}
|
|
945
|
+
annotatedScreenshot = VissionResult.boxedImageBuffer;
|
|
946
|
+
bounds = VissionResult.boxes;
|
|
947
|
+
}
|
|
948
|
+
if (platform == "web") {
|
|
949
|
+
stepResultVision = await stepProcessor.getLLMResponse({
|
|
950
|
+
platform: platform,
|
|
951
|
+
type: promptType_js_1.PromptType.VISION_PROMPT,
|
|
952
|
+
args: {
|
|
953
|
+
priorAndNextSteps
|
|
954
|
+
},
|
|
955
|
+
input: { currentStep: step, annotatedScreenshot: annotatedScreenshot.primary },
|
|
956
|
+
isVision: true
|
|
957
|
+
});
|
|
958
|
+
if (stepResultVision.response.fireflinkIndex == "Fire-Flink-0") {
|
|
959
|
+
stepResultVision = await stepProcessor.getLLMResponse({
|
|
960
|
+
platform: platform,
|
|
961
|
+
type: promptType_js_1.PromptType.VISION_PROMPT,
|
|
962
|
+
args: {
|
|
963
|
+
priorAndNextSteps
|
|
964
|
+
},
|
|
965
|
+
input: { currentStep: step, annotatedScreenshot: annotatedScreenshot.secondary },
|
|
966
|
+
isVision: true
|
|
967
|
+
});
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
else {
|
|
971
|
+
stepResultVision = await stepProcessor.getLLMResponse({
|
|
972
|
+
platform: platform,
|
|
973
|
+
type: promptType_js_1.PromptType.VISION_PROMPT,
|
|
974
|
+
args: {
|
|
975
|
+
priorAndNextSteps
|
|
976
|
+
},
|
|
977
|
+
input: { currentStep: step, annotatedScreenshot: annotatedScreenshot },
|
|
978
|
+
isVision: true
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
fireflinkIndex = stepResultVision.response.fireflinkIndex;
|
|
982
|
+
logData_js_1.logger.info(`fireflinkIndex: ${fireflinkIndex}`);
|
|
983
|
+
if (fireflinkIndex == "Fire-Flink-0") {
|
|
984
|
+
logData_js_1.logger.error(`vision unable to find element for step "${step}"`);
|
|
985
|
+
if (platform === "web") {
|
|
986
|
+
context.scriptAppender.setErrorNLP(stepAction);
|
|
987
|
+
}
|
|
988
|
+
throw new Error(`vision unable to find element for step "${step}"`, { cause: error });
|
|
989
|
+
}
|
|
990
|
+
if (platform == "android" || platform == "ios") {
|
|
991
|
+
const index = Number(fireflinkIndex.split("-").pop());
|
|
992
|
+
const box = bounds[index - 1];
|
|
993
|
+
if (!box) {
|
|
994
|
+
throw new Error(`No bounds found for index ${index}`, { cause: error });
|
|
995
|
+
}
|
|
996
|
+
const { x1, y1, x2, y2 } = box;
|
|
997
|
+
const boundsStr = `[${x1},${y1}][${x2},${y2}]`;
|
|
998
|
+
const result = (0, xpathcreation_js_1.getFFIndexAndXPath)(domInfo.dom, boundsStr, platform);
|
|
999
|
+
xpath = result.xpathPath;
|
|
1000
|
+
fireflinkIndex = result.ffInspector ?? fireflinkIndex;
|
|
1001
|
+
}
|
|
1002
|
+
else {
|
|
1003
|
+
if (!domInfo || !domInfo.dom || !doc) {
|
|
1004
|
+
logData_js_1.logger.info("Re-fetching annotated DOM for vision fallback");
|
|
1005
|
+
domInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
1006
|
+
const parser = new jsdom_1.JSDOM((0, domSanitizer_js_1.sanitizeWebDom)(domInfo.dom));
|
|
1007
|
+
doc = parser.window.document;
|
|
1008
|
+
}
|
|
1009
|
+
const ele = doc.querySelector(`[ff-inspect="${fireflinkIndex}"]`);
|
|
1010
|
+
if (ele) {
|
|
1011
|
+
xpath = ele.getAttribute("ff-xpath") || "";
|
|
1012
|
+
}
|
|
1013
|
+
else {
|
|
1014
|
+
const result = (0, xpathcreation_js_1.getWebXPathByFFIndex)(domInfo.dom, fireflinkIndex);
|
|
1015
|
+
xpath = result.xpathPath;
|
|
1016
|
+
}
|
|
1017
|
+
if (!xpath) {
|
|
1018
|
+
context.scriptAppender.setErrorNLP(stepAction);
|
|
1019
|
+
throw new Error(`Unable to resolve xpath for ${fireflinkIndex}`, { cause: error });
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
pageDOM = iframeDomHtml ?? domInfo.dom;
|
|
1023
|
+
handler = actionHandlers[stepAction];
|
|
1024
|
+
await handler({
|
|
1025
|
+
selector: xpath,
|
|
1026
|
+
value: stepResult.response.inputText,
|
|
1027
|
+
fireflinkIndex,
|
|
1028
|
+
pageDOM: pageDOM,
|
|
1029
|
+
elementName: result.response.elementName,
|
|
1030
|
+
elementType: stepResult.response.elementType,
|
|
1031
|
+
stepIndex: stepCount,
|
|
1032
|
+
filteredSteps: listOfSteps
|
|
1033
|
+
});
|
|
1034
|
+
if (platform === "web") {
|
|
1035
|
+
if (await (0, isAlertPresent_js_1.isAlertPresent)(driver) != true) {
|
|
1036
|
+
if (action === "click") {
|
|
1037
|
+
await driver.executeScript(jsForToaster_js_1.TOAST_WATCHER_JS, []);
|
|
1038
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
1039
|
+
const postClickToastDetected = await driver.executeScript("return window.__toastDetected === true;", []);
|
|
1040
|
+
if (postClickToastDetected) {
|
|
1041
|
+
logData_js_1.logger.info(`Toast detected after click`);
|
|
1042
|
+
preCapturedDomInfo = await (0, jsForAttributeInjection_js_1.getAnnotatedDOM)(driver);
|
|
1043
|
+
logData_js_1.logger.saveDOM(preCapturedDomInfo.dom, `toaster-dom-${stepCount}`);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
if (beforeHandles?.length > 0) {
|
|
1048
|
+
await (0, newTabTracker_js_1.newTabTracker)(driver, action, beforeHandles, context.scriptAppender);
|
|
1049
|
+
}
|
|
1050
|
+
}
|
|
1051
|
+
if (fallbackAttempt === 2) {
|
|
1052
|
+
await produceLiveLog("Retry successful. Moving on to the next step.");
|
|
1053
|
+
}
|
|
1054
|
+
break;
|
|
1055
|
+
}
|
|
1056
|
+
catch (error) {
|
|
1057
|
+
logData_js_1.logger.error(`vision execution failed for step "${step}": ${error}`);
|
|
1058
|
+
if (fallbackAttempt < 2) {
|
|
1059
|
+
await produceLiveLog("Step failed to execute. Waiting a few seconds before reattempting the same step.");
|
|
1060
|
+
continue;
|
|
1061
|
+
}
|
|
1062
|
+
throw error;
|
|
1063
|
+
}
|
|
524
1064
|
}
|
|
525
1065
|
}
|
|
1066
|
+
baseStepActionBeforeFallback = stepAction;
|
|
526
1067
|
domInfo = null;
|
|
527
1068
|
extractedRelevantDom = null;
|
|
528
1069
|
stepCount++;
|
|
529
1070
|
}
|
|
530
1071
|
catch (error) {
|
|
531
1072
|
logData_js_1.logger.error(`Error executing step "${step}":`, error);
|
|
532
|
-
if (error
|
|
533
|
-
error.error === "Rate Limit Exceeded (429)") {
|
|
1073
|
+
if (error?.error) {
|
|
534
1074
|
errorInfo.error = error.error;
|
|
535
1075
|
errorInfo.errorDescription = error.errorDescription;
|
|
536
1076
|
if (context.scriptAppender.getErrorNLP()) {
|
|
@@ -551,45 +1091,232 @@ class AutomationRunner {
|
|
|
551
1091
|
}
|
|
552
1092
|
logData_js_1.logger.info('execution time->', new Date().getTime() - start_time);
|
|
553
1093
|
const payload = {
|
|
554
|
-
scriptName: request.scriptName,
|
|
555
|
-
version: request.version,
|
|
1094
|
+
scriptName: request.scriptName ?? "SCRIPT_NAME",
|
|
556
1095
|
type: request.type,
|
|
557
|
-
scriptType: request.
|
|
1096
|
+
scriptType: request.type,
|
|
558
1097
|
projectId: request.projectId,
|
|
559
1098
|
testCaseId: request.testCaseId,
|
|
560
|
-
promptId: request.promptId,
|
|
561
1099
|
pageDetails: request.pageDetails,
|
|
562
|
-
generatedBy: request.generatedBy,
|
|
563
|
-
webSocketId: request.webSocketId,
|
|
564
1100
|
licenseType: request.licenseType,
|
|
565
1101
|
licenseId: request.licenseId,
|
|
566
1102
|
userId: request.userId,
|
|
567
1103
|
projectType: request.projectType,
|
|
1104
|
+
platform: (0, platformSyntax_js_1.getPlatformSyntax)(platform),
|
|
568
1105
|
tokensConsumed: (await stepProcessor.getResultTokenUsage()).totalTokens,
|
|
569
|
-
...(errorInfo && Object.keys(errorInfo).length > 0
|
|
570
|
-
? { error: errorInfo }
|
|
571
|
-
: {})
|
|
572
1106
|
};
|
|
1107
|
+
this.KafkaPayload.topic = request.topic;
|
|
1108
|
+
let keepSessionAlive = false;
|
|
573
1109
|
try {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
1110
|
+
if ((errorInfo && Object.keys(errorInfo).length > 0)) {
|
|
1111
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
1112
|
+
topic: this.KafkaPayload.topic, message: {
|
|
1113
|
+
topic: "",
|
|
1114
|
+
service: "",
|
|
1115
|
+
chatId: "",
|
|
1116
|
+
aiPromptPayload: {
|
|
1117
|
+
display: false,
|
|
1118
|
+
message: "",
|
|
1119
|
+
messageId: "",
|
|
1120
|
+
branchId: "",
|
|
1121
|
+
userId: request.userId,
|
|
1122
|
+
scriptId: "",
|
|
1123
|
+
scriptType: "",
|
|
1124
|
+
type: "logs",
|
|
1125
|
+
sessionId: "",
|
|
1126
|
+
licenseId: request.licenseId,
|
|
1127
|
+
projectId: request.projectId,
|
|
1128
|
+
liveLogs: {
|
|
1129
|
+
executionId: request.kafkaMessageKey,
|
|
1130
|
+
message: errorInfo.errorDescription ?? "errorDescription unknown",
|
|
1131
|
+
messageType: messageType_js_1.MessageType.LiveLog.Error,
|
|
1132
|
+
},
|
|
1133
|
+
attachment: [],
|
|
1134
|
+
},
|
|
1135
|
+
}
|
|
1136
|
+
});
|
|
1137
|
+
logData_js_1.logger.info(`Message produced to Kafka topic - ${JSON.stringify({ messageType: messageType_js_1.MessageType.LiveLog.Error })}`);
|
|
1138
|
+
await context.scriptAppender.waitForAllSteps();
|
|
1139
|
+
if (driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey]) {
|
|
1140
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey].push(...context.scriptAppender.getData());
|
|
1141
|
+
}
|
|
1142
|
+
else {
|
|
1143
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey] = context.scriptAppender.getData();
|
|
1144
|
+
}
|
|
1145
|
+
context.scriptAppender.reset();
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
else {
|
|
1149
|
+
if (request?.aiExecutionAction === "stopExecution") {
|
|
1150
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
1151
|
+
topic: this.KafkaPayload.topic, message: {
|
|
1152
|
+
topic: "",
|
|
1153
|
+
service: "",
|
|
1154
|
+
chatId: "",
|
|
1155
|
+
aiPromptPayload: {
|
|
1156
|
+
display: false,
|
|
1157
|
+
message: "",
|
|
1158
|
+
messageId: "",
|
|
1159
|
+
branchId: "",
|
|
1160
|
+
userId: request.userId,
|
|
1161
|
+
scriptId: "",
|
|
1162
|
+
scriptType: "",
|
|
1163
|
+
type: "logs",
|
|
1164
|
+
sessionId: "",
|
|
1165
|
+
licenseId: request.licenseId,
|
|
1166
|
+
projectId: request.projectId,
|
|
1167
|
+
liveLogs: {
|
|
1168
|
+
executionId: request.kafkaMessageKey,
|
|
1169
|
+
message: "Execution stopped",
|
|
1170
|
+
messageType: messageType_js_1.MessageType.LiveLog.ExecutionStopped,
|
|
1171
|
+
},
|
|
1172
|
+
attachment: [],
|
|
1173
|
+
},
|
|
1174
|
+
}
|
|
1175
|
+
});
|
|
1176
|
+
logData_js_1.logger.info(`Message produced to Kafka topic - ${JSON.stringify({ messageType: messageType_js_1.MessageType.LiveLog.ExecutionStopped })}`);
|
|
1177
|
+
}
|
|
1178
|
+
else if (hasMoreSteps) {
|
|
1179
|
+
keepSessionAlive = true;
|
|
1180
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
1181
|
+
topic: this.KafkaPayload.topic, message: {
|
|
1182
|
+
topic: "",
|
|
1183
|
+
service: "",
|
|
1184
|
+
chatId: "",
|
|
1185
|
+
aiPromptPayload: {
|
|
1186
|
+
display: false,
|
|
1187
|
+
message: "",
|
|
1188
|
+
messageId: "",
|
|
1189
|
+
branchId: "",
|
|
1190
|
+
userId: request.userId,
|
|
1191
|
+
scriptId: "",
|
|
1192
|
+
scriptType: "",
|
|
1193
|
+
type: "logs",
|
|
1194
|
+
sessionId: "",
|
|
1195
|
+
licenseId: request.licenseId,
|
|
1196
|
+
projectId: request.projectId,
|
|
1197
|
+
liveLogs: {
|
|
1198
|
+
executionId: request.kafkaMessageKey,
|
|
1199
|
+
message: "Invoke the generate_script_from_scenario tool with the remaining test steps to continue the automation execution from where it left off.",
|
|
1200
|
+
messageType: messageType_js_1.MessageType.nextBatch,
|
|
1201
|
+
},
|
|
1202
|
+
attachment: [],
|
|
1203
|
+
},
|
|
1204
|
+
}
|
|
1205
|
+
});
|
|
1206
|
+
logData_js_1.logger.info(`Message produced to Kafka topic - ${JSON.stringify({ messageType: messageType_js_1.MessageType.nextBatch })}`);
|
|
1207
|
+
await context.scriptAppender.waitForAllSteps();
|
|
1208
|
+
if (driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey]) {
|
|
1209
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey].push(...context.scriptAppender.getData());
|
|
1210
|
+
}
|
|
1211
|
+
else {
|
|
1212
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey] = context.scriptAppender.getData();
|
|
1213
|
+
}
|
|
1214
|
+
context.scriptAppender.reset();
|
|
1215
|
+
}
|
|
1216
|
+
else {
|
|
1217
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
1218
|
+
topic: this.KafkaPayload.topic, message: {
|
|
1219
|
+
topic: "",
|
|
1220
|
+
service: "",
|
|
1221
|
+
chatId: "",
|
|
1222
|
+
aiPromptPayload: {
|
|
1223
|
+
display: false,
|
|
1224
|
+
message: "",
|
|
1225
|
+
messageId: "",
|
|
1226
|
+
branchId: "",
|
|
1227
|
+
userId: request.userId,
|
|
1228
|
+
scriptId: "",
|
|
1229
|
+
scriptType: "",
|
|
1230
|
+
type: "logs",
|
|
1231
|
+
sessionId: "",
|
|
1232
|
+
licenseId: request.licenseId,
|
|
1233
|
+
projectId: request.projectId,
|
|
1234
|
+
liveLogs: {
|
|
1235
|
+
executionId: request.kafkaMessageKey,
|
|
1236
|
+
message: "Execution completed",
|
|
1237
|
+
messageType: messageType_js_1.MessageType.LiveLog.Completed,
|
|
1238
|
+
},
|
|
1239
|
+
attachment: [],
|
|
1240
|
+
},
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
logData_js_1.logger.info(`Message produced to Kafka topic - ${JSON.stringify({ messageType: messageType_js_1.MessageType.LiveLog.Completed })}`);
|
|
1244
|
+
await context.scriptAppender.waitForAllSteps();
|
|
1245
|
+
if (driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey]) {
|
|
1246
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey].push(...context.scriptAppender.getData());
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey] = context.scriptAppender.getData();
|
|
1250
|
+
}
|
|
1251
|
+
context.scriptAppender.reset();
|
|
1252
|
+
}
|
|
1253
|
+
// Intermediate batches must only emit nextBatch. Sending AutomationScriptMetaData
|
|
1254
|
+
// here races the chat consumer and is treated as a finished execution.
|
|
1255
|
+
if (!keepSessionAlive) {
|
|
1256
|
+
this.KafkaPayload.message = {
|
|
1257
|
+
...payload,
|
|
1258
|
+
executionId: request.kafkaMessageKey,
|
|
1259
|
+
liveLogs: messageType_js_1.MessageType.AutomationScriptMetaData,
|
|
1260
|
+
stepData: driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey],
|
|
1261
|
+
serverHost: request.serverHost,
|
|
1262
|
+
messageType: messageType_js_1.MessageType.AutomationScriptMetaData
|
|
1263
|
+
};
|
|
1264
|
+
// logger.info(` ${JSON.stringify(context.scriptAppender.getData(), null, 2)}`);
|
|
1265
|
+
await fireflinkServiceInstance.produceMessageToKafka(request.kafkaMessageKey, {
|
|
1266
|
+
topic: this.KafkaPayload.topic, message: {
|
|
1267
|
+
topic: "",
|
|
1268
|
+
service: "",
|
|
1269
|
+
chatId: "",
|
|
1270
|
+
aiPromptPayload: {
|
|
1271
|
+
display: false,
|
|
1272
|
+
message: "",
|
|
1273
|
+
messageId: "",
|
|
1274
|
+
branchId: "",
|
|
1275
|
+
userId: request.userId,
|
|
1276
|
+
scriptId: "",
|
|
1277
|
+
scriptType: "",
|
|
1278
|
+
type: "logs",
|
|
1279
|
+
sessionId: "",
|
|
1280
|
+
licenseId: request.licenseId,
|
|
1281
|
+
projectId: request.projectId,
|
|
1282
|
+
liveLogs: {
|
|
1283
|
+
executionId: request.kafkaMessageKey,
|
|
1284
|
+
message: this.KafkaPayload,
|
|
1285
|
+
messageType: messageType_js_1.MessageType.AutomationScriptMetaData,
|
|
1286
|
+
},
|
|
1287
|
+
attachment: [],
|
|
1288
|
+
},
|
|
1289
|
+
}
|
|
1290
|
+
});
|
|
1291
|
+
const stepDataArr = this.KafkaPayload.message.stepData;
|
|
1292
|
+
const lastStep = Array.isArray(stepDataArr) && stepDataArr.length > 0
|
|
1293
|
+
? stepDataArr[stepDataArr.length - 1]
|
|
1294
|
+
: null;
|
|
1295
|
+
const closeStepNames = new Set([
|
|
1296
|
+
"CloseBrowser",
|
|
1297
|
+
"IOS_CloseApp",
|
|
1298
|
+
"MOB_CloseApp",
|
|
1299
|
+
]);
|
|
1300
|
+
if (lastStep && closeStepNames.has(lastStep.nlpName)) {
|
|
1301
|
+
SessionManager_js_1.SessionManager.remove(request);
|
|
1302
|
+
delete driverState_js_1.UserSessionAutomationTestCase[request.kafkaMessageKey];
|
|
1303
|
+
logData_js_1.logger.info("Deletion happened.");
|
|
1304
|
+
}
|
|
1305
|
+
logData_js_1.logger.info(`Final Message produced to Kafka topic ${JSON.stringify(this.KafkaPayload, null, 2)} successfully.`);
|
|
1306
|
+
}
|
|
1307
|
+
else {
|
|
1308
|
+
logData_js_1.logger.info("nextBatch produced; session kept alive for remaining steps.");
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
585
1311
|
}
|
|
586
1312
|
catch (error) {
|
|
587
1313
|
logData_js_1.logger.error("Failed to produce message :", logData_js_1.logger.getError(error));
|
|
588
1314
|
throw new Error("Failed to produce message :", { cause: error });
|
|
589
1315
|
}
|
|
590
1316
|
finally {
|
|
591
|
-
|
|
592
|
-
|
|
1317
|
+
if (!keepSessionAlive) {
|
|
1318
|
+
await this.cleanup(context, domInfo, extractedRelevantDom, stepProcessor, fireflinkServiceInstance, request, platform);
|
|
1319
|
+
}
|
|
593
1320
|
}
|
|
594
1321
|
}
|
|
595
1322
|
}
|