ff-automationv2 2.1.3 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +1 -0
- package/.husky/pre-commit +5 -0
- package/ARCHITECTURE.md +6 -3
- package/Note.md +7 -0
- package/RELEASE_GUIDE.md +1 -1
- package/bitbucket-pipelines.yml +4 -25
- package/eslint.config.ts +4 -0
- package/package.json +21 -9
- package/src/ai/llmcalls/decodeApiKey.ts +1 -1
- package/src/ai/llmcalls/llmAction.ts +154 -47
- package/src/ai/llmprompts/llmPromptTypes/systemPromptTypes.ts +45 -0
- package/src/ai/llmprompts/promptRegistry.ts +34 -8
- package/src/ai/llmprompts/systemPrompts/actionExtractorPrompt.ts +4 -7
- package/src/ai/llmprompts/systemPrompts/combinedActionExtractorPrompt.ts +41 -0
- package/src/ai/llmprompts/systemPrompts/combinedActionExtractorPromptMob.ts +53 -0
- package/src/ai/llmprompts/systemPrompts/errorDescriptionPrompt.ts +43 -14
- package/src/ai/llmprompts/systemPrompts/fireflinkElementIndexExtactors.ts +111 -36
- package/src/ai/llmprompts/systemPrompts/fireflinkElementIndexExtractor_Mob.ts +53 -0
- package/src/ai/llmprompts/systemPrompts/getActionExtractorPrompt.ts +62 -0
- package/src/ai/llmprompts/systemPrompts/getActionExtractorPromptMob.ts +54 -0
- package/src/ai/llmprompts/systemPrompts/mobileKeywordExtractor.ts +39 -0
- package/src/ai/llmprompts/systemPrompts/userStoryToListPrompt.ts +48 -11
- package/src/ai/llmprompts/systemPrompts/verifyActionExtractorPrompt.ts +82 -0
- package/src/ai/llmprompts/systemPrompts/verifyActionExtractorPromptMob.ts +58 -0
- package/src/ai/llmprompts/systemPrompts/visionPrompt.ts +8 -14
- package/src/ai/llmprompts/systemPrompts/visionPromptMobile.ts +25 -0
- package/src/ai/llmprompts/systemPrompts/waitActionExtractorPrompt.ts +65 -0
- package/src/ai/llmprompts/systemPrompts/waitActionExtractorPromptMob.ts +45 -0
- package/src/ai/llmprompts/userPrompts/userPrompt.ts +28 -4
- package/src/automation/actions/executor.ts +4478 -48
- package/src/automation/actions/interaction/alert/clickCancelOnAlertPopup.ts +21 -0
- package/src/automation/actions/interaction/alert/clickOkOnAlertPopup.ts +20 -0
- package/src/automation/actions/interaction/alert/enterDataToAlert.ts +20 -0
- package/src/automation/actions/interaction/alert/getTextPresentOnAlertPopup.ts +19 -0
- package/src/automation/actions/interaction/alert/verifyAlertPopUpMessageContainsString.ts +32 -0
- package/src/automation/actions/interaction/alert/verifyAlertPopupIsDisplayed.ts +19 -0
- package/src/automation/actions/interaction/alert/verifyTextPresentOnAlertPopup.ts +33 -0
- package/src/automation/actions/interaction/alert/waitTillAlertIsPresent.ts +25 -0
- package/src/automation/actions/interaction/clear/clear.ts +61 -0
- package/src/automation/actions/interaction/clear/clearAndEnter.ts +58 -0
- package/src/automation/actions/interaction/click/click.ts +61 -0
- package/src/automation/actions/interaction/click/clickNtimes.ts +67 -0
- package/src/automation/actions/interaction/click/clickUsingJs.ts +33 -0
- package/src/automation/actions/interaction/click/doubleClick.ts +66 -0
- package/src/automation/actions/interaction/click/rightClick.ts +29 -0
- package/src/automation/actions/interaction/click/waitAndClick.ts +83 -0
- package/src/automation/actions/interaction/dragAndDrop/dragAndDrop.ts +46 -0
- package/src/automation/actions/interaction/enterActions/enterInput.ts +81 -0
- package/src/automation/actions/interaction/enterActions/enterInputAndPress.ts +134 -0
- package/src/automation/actions/interaction/enterActions/enterUrl.ts +52 -0
- package/src/automation/actions/interaction/enterActions/enterusingJs.ts +41 -0
- package/src/automation/actions/interaction/enterActions/waitAndEnter.ts +106 -0
- package/src/automation/actions/interaction/find/findElements.ts +57 -0
- package/src/automation/actions/interaction/get/browserWindowGetPosition.ts +15 -0
- package/src/automation/actions/interaction/get/getAllBrokenImages.ts +16 -0
- package/src/automation/actions/interaction/get/getAllBrokenLinkCount.ts +17 -0
- package/src/automation/actions/interaction/get/getAllBrokenLinks.ts +16 -0
- package/src/automation/actions/interaction/get/getAllConsoleErrors.ts +16 -0
- package/src/automation/actions/interaction/get/getAllConsoleInformation.ts +16 -0
- package/src/automation/actions/interaction/get/getAllConsoleLogs.ts +16 -0
- package/src/automation/actions/interaction/get/getAllConsoleWarnings.ts +18 -0
- package/src/automation/actions/interaction/get/getAllCookieNames.ts +16 -0
- package/src/automation/actions/interaction/get/getAllCookieValues.ts +16 -0
- package/src/automation/actions/interaction/get/getAllSelectedOptions.ts +43 -0
- package/src/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsText.ts +46 -0
- package/src/automation/actions/interaction/get/getAllTheOptionsFromListBoxAsTextInSortedOrder.ts +54 -0
- package/src/automation/actions/interaction/get/getAllTheSelectedOptionsFromListBoxAsText.ts +43 -0
- package/src/automation/actions/interaction/get/getAllWindowHandles.ts +18 -0
- package/src/automation/actions/interaction/get/getAttribute.ts +83 -0
- package/src/automation/actions/interaction/get/getAudioCurrentPlaybackRate.ts +35 -0
- package/src/automation/actions/interaction/get/getAudioCurrentSeekTime.ts +36 -0
- package/src/automation/actions/interaction/get/getAudioCurrentVolume.ts +36 -0
- package/src/automation/actions/interaction/get/getAudioDecodedByte.ts +43 -0
- package/src/automation/actions/interaction/get/getAudioDefaultPlaybackRate.ts +36 -0
- package/src/automation/actions/interaction/get/getAudioDimension.ts +43 -0
- package/src/automation/actions/interaction/get/getAudioHeight.ts +38 -0
- package/src/automation/actions/interaction/get/getAudioMediaLength.ts +34 -0
- package/src/automation/actions/interaction/get/getAudioMediaSource.ts +44 -0
- package/src/automation/actions/interaction/get/getAudioWidth.ts +38 -0
- package/src/automation/actions/interaction/get/getBestPracticesScore.ts +20 -0
- package/src/automation/actions/interaction/get/getBrowserCount.ts +17 -0
- package/src/automation/actions/interaction/get/getBrowserVersion.ts +16 -0
- package/src/automation/actions/interaction/get/getCapabilityNames.ts +18 -0
- package/src/automation/actions/interaction/get/getClipBoardText.ts +16 -0
- package/src/automation/actions/interaction/get/getCollectiveApiResponseTime.ts +27 -0
- package/src/automation/actions/interaction/get/getCollectiveApiStatusCode.ts +29 -0
- package/src/automation/actions/interaction/get/getCssValue.ts +38 -0
- package/src/automation/actions/interaction/get/getCurrentDayOfTheWeek.ts +18 -0
- package/src/automation/actions/interaction/get/getCurrentSecondsFromCurrentSystemTime.ts +19 -0
- package/src/automation/actions/interaction/get/getCurrentSystemDate.ts +18 -0
- package/src/automation/actions/interaction/get/getCurrentSystemDay.ts +16 -0
- package/src/automation/actions/interaction/get/getCurrentSystemMonth.ts +16 -0
- package/src/automation/actions/interaction/get/getCurrentSystemTime.ts +18 -0
- package/src/automation/actions/interaction/get/getCurrentSystemYear.ts +18 -0
- package/src/automation/actions/interaction/get/getCurrentWindowHandle.ts +36 -0
- package/src/automation/actions/interaction/get/getDataFromApiRequestHeaderForJsonPath.ts +21 -0
- package/src/automation/actions/interaction/get/getDataFromApiResponseForJsonPath.ts +21 -0
- package/src/automation/actions/interaction/get/getDateWithGivenFormat.ts +35 -0
- package/src/automation/actions/interaction/get/getDriverInstance.ts +35 -0
- package/src/automation/actions/interaction/get/getFirstContentfulPaint.ts +16 -0
- package/src/automation/actions/interaction/get/getFirstSelectedOption.ts +44 -0
- package/src/automation/actions/interaction/get/getFullPaintTime.ts +16 -0
- package/src/automation/actions/interaction/get/getHTMLCodeOfPage.ts +18 -0
- package/src/automation/actions/interaction/get/getHeightOfBrowserWindow.ts +18 -0
- package/src/automation/actions/interaction/get/getHeightOfWebElement.ts +36 -0
- package/src/automation/actions/interaction/get/getHourFromCurrentSystemTime.ts +18 -0
- package/src/automation/actions/interaction/get/getImplicitTimeOut.ts +36 -0
- package/src/automation/actions/interaction/get/getLargestContentfulPaint.ts +16 -0
- package/src/automation/actions/interaction/get/getListBoxSize.ts +41 -0
- package/src/automation/actions/interaction/get/getListOfElementsFromLocatorTypeLocatorValue.ts +63 -0
- package/src/automation/actions/interaction/get/getLocation.ts +68 -0
- package/src/automation/actions/interaction/get/getMinuteFromCurrentSystemTime.ts +18 -0
- package/src/automation/actions/interaction/get/getNetworkRouteTime.ts +16 -0
- package/src/automation/actions/interaction/get/getNumberOfBrokenImages.ts +16 -0
- package/src/automation/actions/interaction/get/getNumberOfLinksPresentInCurrentPage.ts +18 -0
- package/src/automation/actions/interaction/get/getNumberOfWorkingLinksFromCurrentPage.ts +15 -0
- package/src/automation/actions/interaction/get/getOptions.ts +35 -0
- package/src/automation/actions/interaction/get/getPageTitle.ts +18 -0
- package/src/automation/actions/interaction/get/getPerformanceMetrics.ts +15 -0
- package/src/automation/actions/interaction/get/getPwaScore.ts +20 -0
- package/src/automation/actions/interaction/get/getRect.ts +87 -0
- package/src/automation/actions/interaction/get/getScreenshot.ts +41 -0
- package/src/automation/actions/interaction/get/getScreenshotAs.ts +64 -0
- package/src/automation/actions/interaction/get/getSeoScore.ts +20 -0
- package/src/automation/actions/interaction/get/getSingleApiRequestPayload.ts +22 -0
- package/src/automation/actions/interaction/get/getSingleApiResponse.ts +30 -0
- package/src/automation/actions/interaction/get/getSingleApiResponseTime.ts +28 -0
- package/src/automation/actions/interaction/get/getSingleApiStatusCode.ts +32 -0
- package/src/automation/actions/interaction/get/getSize.ts +68 -0
- package/src/automation/actions/interaction/get/getSizeOfBrowserWindow.ts +17 -0
- package/src/automation/actions/interaction/get/getStringDataFromLocalFile.ts +25 -0
- package/src/automation/actions/interaction/get/getSystemProperty.ts +46 -0
- package/src/automation/actions/interaction/get/getTagName.ts +67 -0
- package/src/automation/actions/interaction/get/getText.ts +68 -0
- package/src/automation/actions/interaction/get/getTheFirstSelectedOptionFromListBoxAsText.ts +44 -0
- package/src/automation/actions/interaction/get/getTotalNumberOfCookies.ts +16 -0
- package/src/automation/actions/interaction/get/getTunnelIdentifier.ts +25 -0
- package/src/automation/actions/interaction/get/getURLPresentInAddressBar.ts +18 -0
- package/src/automation/actions/interaction/get/getUserHomeDirectory.ts +16 -0
- package/src/automation/actions/interaction/get/getValueByCookieName.ts +27 -0
- package/src/automation/actions/interaction/get/getValueFromLocalStorage.ts +26 -0
- package/src/automation/actions/interaction/get/getValueOfSystemVariable.ts +20 -0
- package/src/automation/actions/interaction/get/getVideoCurrentPlaybackRate.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoCurrentSeekTime.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoCurrentVolume.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoDecodedByte.ts +52 -0
- package/src/automation/actions/interaction/get/getVideoDefaultPlaybackRate.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoDimension.ts +40 -0
- package/src/automation/actions/interaction/get/getVideoHeight.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoMediaLength.ts +36 -0
- package/src/automation/actions/interaction/get/getVideoMediaSource.ts +46 -0
- package/src/automation/actions/interaction/get/getVideoWidth.ts +36 -0
- package/src/automation/actions/interaction/get/getWidthOfBrowser.ts +18 -0
- package/src/automation/actions/interaction/get/getWidthOfWebElement.ts +36 -0
- package/src/automation/actions/interaction/get/getWorkingLinksFromCurrentPage.ts +16 -0
- package/src/automation/actions/interaction/get/getWrappedElement.ts +36 -0
- package/src/automation/actions/interaction/get/getWrappedOptionFromListBoxAsText.ts +47 -0
- package/src/automation/actions/interaction/get/getXLocationOfBrowserWindow.ts +18 -0
- package/src/automation/actions/interaction/get/getXLocationOfWebElement.ts +71 -0
- package/src/automation/actions/interaction/get/getYLocationOfBrowserWindow.ts +18 -0
- package/src/automation/actions/interaction/get/getYLocationOfWebElement.ts +70 -0
- package/src/automation/actions/interaction/iframe/switchToDefaultContent.ts +15 -0
- package/src/automation/actions/interaction/maximize/maximize.ts +15 -0
- package/src/automation/actions/interaction/maximize/minimize.ts +17 -0
- package/src/automation/actions/interaction/navigation/goBack.ts +14 -0
- package/src/automation/actions/interaction/navigation/navigate.ts +16 -0
- package/src/automation/actions/interaction/navigation/refresh.ts +14 -0
- package/src/automation/actions/interaction/press/mobPressBackKey.ts +19 -0
- package/src/automation/actions/interaction/press/pressAnyKey.ts +89 -0
- package/src/automation/actions/interaction/press/pressAnyKeyNTimes.ts +100 -0
- package/src/automation/actions/interaction/press/pressEnterKey.ts +45 -0
- package/src/automation/actions/interaction/scroll/scrollHorizontallyTillElementIsVisible.ts +29 -0
- package/src/automation/actions/interaction/scroll/scrollPageToSpecificLocation.ts +37 -0
- package/src/automation/actions/interaction/scroll/scrollToElement.ts +28 -0
- package/src/automation/actions/interaction/scroll/scrollVerticallyTillElementIsVisible.ts +29 -0
- package/src/automation/actions/interaction/set/setClipBoardText.ts +46 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomClick.ts +25 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomEnter.ts +27 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomGetText.ts +28 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomUpload.ts +37 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomVerifyPartialText.ts +29 -0
- package/src/automation/actions/interaction/shadowDom/shadowDomVerifyText.ts +22 -0
- package/src/automation/actions/interaction/switch/switchToNewTabBasedOnTitle.ts +16 -0
- package/src/automation/actions/interaction/switch/switchToNewWindowBasedOnTitle.ts +16 -0
- package/src/automation/actions/interaction/switch/switchToParentWindow.ts +19 -0
- package/src/automation/actions/interaction/switch/switchToTabBasedOnUrl.ts +16 -0
- package/src/automation/actions/interaction/switch/switchToWindowBasedOnURL.ts +16 -0
- package/src/automation/actions/interaction/switch/switchToWindowIfTitleContainsString.ts +18 -0
- package/src/automation/actions/interaction/switch/switchToWindowIfUrlContainsString.ts +18 -0
- package/src/automation/actions/interaction/upload/uploadfile.ts +41 -0
- package/src/automation/actions/interaction/verify/VerifyAccessibilityScore.ts +90 -0
- package/src/automation/actions/interaction/verify/VerifyAllBrokenImages.ts +54 -0
- package/src/automation/actions/interaction/verify/VerifyAllBrowserWindowsClosed.ts +27 -0
- package/src/automation/actions/interaction/verify/VerifyAllOptionsAreDeSelected.ts +55 -0
- package/src/automation/actions/interaction/verify/VerifyAllOptionsAreSelected.ts +66 -0
- package/src/automation/actions/interaction/verify/VerifyAttributeValue.ts +96 -0
- package/src/automation/actions/interaction/verify/VerifyBestPracticesScore.ts +87 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserHtmlCodeContainsString.ts +35 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowHeight.ts +35 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowTitleContainsString.ts +31 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowTitleIsString.ts +30 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowUrlContainsExpectedUrl.ts +30 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowUrlIsString.ts +30 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowWidth.ts +35 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowXLocation.ts +36 -0
- package/src/automation/actions/interaction/verify/VerifyBrowserWindowYLocation.ts +35 -0
- package/src/automation/actions/interaction/verify/VerifyCheckBoxIsNotSelected.ts +46 -0
- package/src/automation/actions/interaction/verify/VerifyCheckBoxIsSelected.ts +43 -0
- package/src/automation/actions/interaction/verify/VerifyCssAttributeValue.ts +62 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsClickable.ts +86 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsDisabled.ts +91 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsDisplayed.ts +87 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsEnabled.ts +87 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsNotDisplayed.ts +45 -0
- package/src/automation/actions/interaction/verify/VerifyElementIsSelected.ts +83 -0
- package/src/automation/actions/interaction/verify/VerifyElementNotContainsText.ts +129 -0
- package/src/automation/actions/interaction/verify/VerifyHeightOfWebElement.ts +101 -0
- package/src/automation/actions/interaction/verify/VerifyHexCodeForGivenXYCoordinates.ts +51 -0
- package/src/automation/actions/interaction/verify/VerifyIfAllCookiesAreDeleted.ts +27 -0
- package/src/automation/actions/interaction/verify/VerifyIfAudioEnded.ts +48 -0
- package/src/automation/actions/interaction/verify/VerifyIfAudioIsMuted.ts +48 -0
- package/src/automation/actions/interaction/verify/VerifyIfAudioIsPaused.ts +48 -0
- package/src/automation/actions/interaction/verify/VerifyIfAudioIsPlaying.ts +57 -0
- package/src/automation/actions/interaction/verify/VerifyIfBrowserWindowIsClosed.ts +27 -0
- package/src/automation/actions/interaction/verify/VerifyIfCookieNameIsAdded.ts +38 -0
- package/src/automation/actions/interaction/verify/VerifyIfCookieNameIsDeleted.ts +33 -0
- package/src/automation/actions/interaction/verify/VerifyIfCookieObjectIsPresent.ts +49 -0
- package/src/automation/actions/interaction/verify/VerifyIfGivenOptionIsDuplicate.ts +60 -0
- package/src/automation/actions/interaction/verify/VerifyIfImageIsBroken.ts +40 -0
- package/src/automation/actions/interaction/verify/VerifyIfLinkIsBroken.ts +38 -0
- package/src/automation/actions/interaction/verify/VerifyIfLinkIsWorking.ts +37 -0
- package/src/automation/actions/interaction/verify/VerifyIfLinksAreBroken.ts +46 -0
- package/src/automation/actions/interaction/verify/VerifyIfLinksAreWorking.ts +45 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsDeselectedInElement.ts +75 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsSelectedInListBox.ts +77 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithTextIsDeselected.ts +40 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithValueIsDeselected.ts +61 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithValueIsSelected.ts +58 -0
- package/src/automation/actions/interaction/verify/VerifyIfOptionWithVisibleTextIsSelected.ts +40 -0
- package/src/automation/actions/interaction/verify/VerifyIfSpecifiedOptionIsSelected.ts +78 -0
- package/src/automation/actions/interaction/verify/VerifyIfStatusCodeOfALinkIsStatusCode.ts +37 -0
- package/src/automation/actions/interaction/verify/VerifyIfStatusCodesOfLinks.ts +46 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoEnded.ts +49 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoIsMuted.ts +49 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoIsPaused.ts +49 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoIsPlaying.ts +50 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoPlayingInMute.ts +58 -0
- package/src/automation/actions/interaction/verify/VerifyIfVideoPlayingInUnmute.ts +58 -0
- package/src/automation/actions/interaction/verify/VerifyIfXAndYCoordinateOfElement.ts +101 -0
- package/src/automation/actions/interaction/verify/VerifyLinkNavigatesToTitle.ts +41 -0
- package/src/automation/actions/interaction/verify/VerifyListBoxOptionsAreSorted.ts +72 -0
- package/src/automation/actions/interaction/verify/VerifyNavigateURL.ts +34 -0
- package/src/automation/actions/interaction/verify/VerifyNumberOfElementsByTagName.ts +35 -0
- package/src/automation/actions/interaction/verify/VerifyNumberOfElementsByXpath.ts +52 -0
- package/src/automation/actions/interaction/verify/VerifyPartialAttributeValue.ts +94 -0
- package/src/automation/actions/interaction/verify/VerifyPartialTitleOfCurrentPage.ts +29 -0
- package/src/automation/actions/interaction/verify/VerifyPerformanceScore.ts +84 -0
- package/src/automation/actions/interaction/verify/VerifyPwaScore.ts +66 -0
- package/src/automation/actions/interaction/verify/VerifyRadioButtonIsNotSelected.ts +42 -0
- package/src/automation/actions/interaction/verify/VerifyRadioButtonIsSelected.ts +42 -0
- package/src/automation/actions/interaction/verify/VerifySeoScore.ts +79 -0
- package/src/automation/actions/interaction/verify/VerifyTagName.ts +44 -0
- package/src/automation/actions/interaction/verify/VerifyThatSpecifiedOptionIsNotSelected.ts +73 -0
- package/src/automation/actions/interaction/verify/VerifyTitleInAllPage.ts +51 -0
- package/src/automation/actions/interaction/verify/VerifyTitleOfCurrentPage.ts +30 -0
- package/src/automation/actions/interaction/verify/VerifyValueOfElementContainsString.ts +51 -0
- package/src/automation/actions/interaction/verify/VerifyValueOfElementIsCleared.ts +45 -0
- package/src/automation/actions/interaction/verify/VerifyValueOfElementIsString.ts +54 -0
- package/src/automation/actions/interaction/verify/VerifyWidthOfElement.ts +90 -0
- package/src/automation/actions/interaction/verify/VerifyXLocationOfElement.ts +89 -0
- package/src/automation/actions/interaction/verify/VerifyYLocationOfElement.ts +90 -0
- package/src/automation/actions/interaction/verify/checkIfElementIsDisplayed.ts +83 -0
- package/src/automation/actions/interaction/verify/verifypartialtext.ts +131 -0
- package/src/automation/actions/interaction/verify/verifytext.ts +143 -0
- package/src/automation/actions/interaction/wait/wait.ts +16 -0
- package/src/automation/actions/interaction/wait/waitTillAttributeOfElementIsString.ts +88 -0
- package/src/automation/actions/interaction/wait/waitTillElementContainsText.ts +79 -0
- package/src/automation/actions/interaction/wait/waitTillElementHasText.ts +71 -0
- package/src/automation/actions/interaction/wait/waitTillElementIsClickable.ts +72 -0
- package/src/automation/actions/interaction/wait/waitTillPresenceOfAllElements.ts +72 -0
- package/src/automation/actions/interaction/wait/waitTillPresenceOfElement.ts +67 -0
- package/src/automation/actions/interface/IframeInterface.ts +6 -0
- package/src/automation/actions/interface/alertActionInterface.ts +39 -0
- package/src/automation/actions/interface/clearActionInterface.ts +27 -0
- package/src/automation/actions/interface/clickActionInterface.ts +87 -0
- package/src/automation/actions/interface/dragAndDropToElementInterface.ts +18 -0
- package/src/automation/actions/interface/findActionInterface.ts +15 -0
- package/src/automation/actions/interface/getActionInterface.ts +873 -0
- package/src/automation/actions/interface/interactionActionInterface.ts +51 -3
- package/src/automation/actions/interface/maximizeAndMinimizeInterface.ts +12 -0
- package/src/automation/actions/interface/navigationActionInterface.ts +1 -1
- package/src/automation/actions/interface/pressActionInterface.ts +25 -0
- package/src/automation/actions/interface/scrollActionInterface.ts +45 -0
- package/src/automation/actions/interface/setActionInterface.ts +10 -0
- package/src/automation/actions/interface/shadowDomInterface.ts +78 -0
- package/src/automation/actions/interface/switchingActionInterface.ts +93 -0
- package/src/automation/actions/interface/uploadFile.ts +14 -0
- package/src/automation/actions/interface/verifyActionInterface.ts +743 -0
- package/src/automation/actions/interface/waitActionInterface.ts +75 -0
- package/src/automation/browserSession/initiateBrowserSession.ts +12 -40
- package/src/automation/mobileSession/initiateMobileSession.ts +81 -0
- package/src/core/constants/allAction.ts +21 -0
- package/src/core/constants/defaultValues.ts +1 -0
- package/src/core/constants/supportedActions.ts +27 -2
- package/src/core/interfaces/actionInterface.ts +238 -3
- package/src/core/interfaces/automationRunnerInterface.ts +2 -1
- package/src/core/interfaces/browserCapabilitiesInterface.ts +1 -3
- package/src/core/interfaces/errorInfoInterface.ts +7 -0
- package/src/core/interfaces/executionDetails.ts +10 -6
- package/src/core/interfaces/fireflinkScriptPayloadInterface.ts +17 -5
- package/src/core/interfaces/llmResponseInterface.ts +28 -4
- package/src/core/interfaces/promptInterface.ts +20 -0
- package/src/core/interfaces/scriptGenrationDataInterface.ts +2 -2
- package/src/core/interfaces/simplifyAndFlattenInterface.ts +13 -0
- package/src/core/main/actionHandlerFactory.ts +1528 -53
- package/src/core/main/executionContext.ts +5 -1
- package/src/core/main/runAutomationScript.ts +528 -123
- package/src/core/main/stepProcessor.ts +4 -2
- package/src/core/types/llmResponseType.ts +7 -3
- package/src/core/types/promptMap.ts +7 -4
- package/src/core/types/promptType.ts +6 -0
- package/src/core/types/scriptTypesType.ts +1 -0
- package/src/domAnalysis/getRelaventElements.ts +10 -1
- package/src/domAnalysis/relativeElementsFromDom.ts +205 -0
- package/src/domAnalysis/searchBest.ts +130 -17
- package/src/domAnalysis/simplifyAndFlatten.ts +139 -10
- package/src/fireflinkData/fireflinkLocators/getListOfLocators.ts +1 -2
- package/src/fireflinkData/fireflinkScript/scriptGenrationData.ts +70 -21
- package/src/imageAnalysisMobile/annotatedScreenshotMobile.ts +137 -0
- package/src/imageAnalysisMobile/annotatedScreenshotMobileInterface.ts +6 -0
- package/src/imageAnalysisWeb/annotateScreenshot.ts +196 -0
- package/src/imageAnalysisWeb/generateAnnotatedScreenshots.ts +43 -0
- package/src/imageAnalysisWeb/screenshotInterface.ts +18 -0
- package/src/index.ts +2 -2
- package/src/service/{fireflinkApi.service.ts → api/fireflinkApi.service.ts} +5 -7
- package/src/service/kafka/fireflinkKafka.service.ts +25 -0
- package/src/service/scriptRunner.service.ts +23 -42
- package/src/utils/DomExtraction/jsForAttributeInjection.ts +68 -12
- package/src/utils/InstancesDetails/getInstancesInfo.ts +12 -0
- package/src/utils/alertPopup/isAlertPresent.ts +20 -0
- package/src/utils/alertPopup/isAlertPresentInterface.ts +6 -0
- package/src/utils/helpers/enterActionHelper.ts +88 -2
- package/src/utils/helpers/imageUtils.ts +10 -0
- package/src/utils/helpers/sameActionsHelper.ts +52 -0
- package/src/utils/helpers/xpathcreation.ts +59 -0
- package/src/utils/iframesExtraction/findElementUsingFF.ts +45 -0
- package/src/utils/iframesExtraction/iframeInterface.ts +22 -0
- package/src/utils/iframesExtraction/switchToIframeByMeta.ts +23 -0
- package/src/utils/javascript/jsFindElement.ts +39 -31
- package/src/utils/javascript/jsForShadowRoot.ts +9 -9
- package/src/utils/javascript/jsForVision.ts +151 -0
- package/src/utils/logger/logData.ts +126 -47
- package/src/utils/mobileXpath/findXpathFromIndex.ts +87 -0
- package/src/utils/mobileXpath/findXpathFromIndexInterface.ts +4 -0
- package/src/utils/newTab/newTabTracker.ts +62 -0
- package/src/automation/actions/interaction/click.ts +0 -25
- package/src/automation/actions/interaction/enterInput.ts +0 -36
- package/src/automation/actions/navigation/getTitle.ts +0 -9
- package/src/automation/actions/navigation/goBack.ts +0 -9
- package/src/automation/actions/navigation/navigate.ts +0 -10
- package/src/automation/actions/navigation/refresh.ts +0 -9
- package/src/automation/actions/wait/wait.ts +0 -10
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { VerifyIfAudioIsMutedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfAudioIsMuted(
|
|
5
|
+
args: VerifyIfAudioIsMutedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
if (!(await element.isExisting())) {
|
|
12
|
+
throw new Error("Audio element does not exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isMuted = await args.driver.execute(
|
|
16
|
+
(el) => (el as unknown as HTMLAudioElement).muted,
|
|
17
|
+
element
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (!isMuted) {
|
|
21
|
+
logger.info("Audio muted status:", isMuted);
|
|
22
|
+
throw new Error("Audio is not muted.");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
args.scriptDataAppender.add(async () => {
|
|
28
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
29
|
+
args.pageDOM,
|
|
30
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
nlpName: 'VerifyIfAudioIsMuted',
|
|
34
|
+
stepInputs: [],
|
|
35
|
+
elementsData: [{
|
|
36
|
+
name: args.elementName,
|
|
37
|
+
type: args.elementType,
|
|
38
|
+
locators: ffElement.locators,
|
|
39
|
+
platform: args.platform
|
|
40
|
+
}]
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
} catch (error: any) {
|
|
45
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfAudioIsMuted");
|
|
46
|
+
throw new Error("VerifyIfAudioIsMuted action failed", { cause: error });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { VerifyIfAudioIsPausedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfAudioIsPaused(
|
|
5
|
+
args: VerifyIfAudioIsPausedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
if (!(await element.isExisting())) {
|
|
12
|
+
throw new Error("Audio element does not exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isPaused = await args.driver.execute(
|
|
16
|
+
(el) => (el as unknown as HTMLAudioElement).paused,
|
|
17
|
+
element
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (!isPaused) {
|
|
21
|
+
logger.info("Audio paused status:", isPaused);
|
|
22
|
+
throw new Error("Audio is not paused.");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
args.scriptDataAppender.add(async () => {
|
|
28
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
29
|
+
args.pageDOM,
|
|
30
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
31
|
+
);
|
|
32
|
+
return {
|
|
33
|
+
nlpName: 'VerifyIfAudioIsPaused',
|
|
34
|
+
stepInputs: [],
|
|
35
|
+
elementsData: [{
|
|
36
|
+
name: args.elementName,
|
|
37
|
+
type: args.elementType,
|
|
38
|
+
locators: ffElement.locators,
|
|
39
|
+
platform: args.platform
|
|
40
|
+
}]
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
} catch (error: any) {
|
|
45
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfAudioIsPaused");
|
|
46
|
+
throw new Error("VerifyIfAudioIsPaused action failed", { cause: error });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { VerifyIfAudioIsPlayingInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfAudioIsPlaying(
|
|
5
|
+
args: VerifyIfAudioIsPlayingInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
if (!(await element.isExisting())) {
|
|
12
|
+
throw new Error("Audio element does not exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isPlaying = await args.driver.execute(
|
|
16
|
+
(el) => {
|
|
17
|
+
const audio = el as unknown as HTMLAudioElement;
|
|
18
|
+
return (
|
|
19
|
+
!audio.paused &&
|
|
20
|
+
!audio.ended &&
|
|
21
|
+
audio.currentTime > 0 &&
|
|
22
|
+
audio.readyState > 2
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
element
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
logger.info("Audio playing status:", isPlaying);
|
|
29
|
+
|
|
30
|
+
if (!isPlaying) {
|
|
31
|
+
logger.error("Audio is not playing.");
|
|
32
|
+
throw new Error("Audio is not playing.");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
args.scriptDataAppender.add(async () => {
|
|
37
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
38
|
+
args.pageDOM,
|
|
39
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
40
|
+
);
|
|
41
|
+
return {
|
|
42
|
+
nlpName: 'VerifyIfAudioIsPlaying',
|
|
43
|
+
stepInputs: [],
|
|
44
|
+
elementsData: [{
|
|
45
|
+
name: args.elementName,
|
|
46
|
+
type: args.elementType,
|
|
47
|
+
locators: ffElement.locators,
|
|
48
|
+
platform: args.platform
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
} catch (error: any) {
|
|
54
|
+
args.scriptDataAppender.setErrorNLP("VerifyAudioIsPlaying");
|
|
55
|
+
throw new Error("VerifyAudioIsPlaying action failed", { cause: error });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VerifyIfBrowserWindowIsClosedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfBrowserWindowIsClosed(
|
|
5
|
+
args: VerifyIfBrowserWindowIsClosedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
try {
|
|
10
|
+
await args.driver.getWindowHandle();
|
|
11
|
+
logger.info("Browser window is still open.");
|
|
12
|
+
throw new Error("Browser window is still open.");
|
|
13
|
+
} catch {
|
|
14
|
+
logger.info("Browser window is closed as expected.");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
args.scriptDataAppender.add(async () => ({
|
|
18
|
+
nlpName: 'VerifyIfBrowserWindowIsClosed',
|
|
19
|
+
stepInputs: [],
|
|
20
|
+
elementsData: []
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
} catch (error: any) {
|
|
24
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfBrowserWindowIsClosed");
|
|
25
|
+
throw new Error("VerifyIfBrowserWindowIsClosed action failed", { cause: error });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { VerifyIfCookieNameIsAddedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfCookieNameIsAdded(
|
|
4
|
+
args: VerifyIfCookieNameIsAddedInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const cookieName = args.value.trim();
|
|
11
|
+
const cookies = await args.driver.getCookies();
|
|
12
|
+
logger.info("Current cookies:", { cookies });
|
|
13
|
+
|
|
14
|
+
const isMatched = cookies.some(
|
|
15
|
+
(cookie: any) => cookie.name === cookieName
|
|
16
|
+
);
|
|
17
|
+
if (isMatched === false) {
|
|
18
|
+
throw new Error(`Cookie name is not added. Expected: ${cookieName}, Actual: Cookie not found`);
|
|
19
|
+
}
|
|
20
|
+
logger.info("Cookie added verification result:", {
|
|
21
|
+
isMatched,
|
|
22
|
+
cookieName
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
args.scriptDataAppender.add(async () => ({
|
|
26
|
+
nlpName: 'VerifyIfCookieNameIsAdded',
|
|
27
|
+
stepInputs: [cookieName],
|
|
28
|
+
elementsData: []
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
} catch (error: any) {
|
|
35
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfCookieNameIsAdded");
|
|
36
|
+
throw new Error(`VerifyIfCookieNameIsAdded action failed`, { cause: error });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { VerifyIfCookieNameIsDeletedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfCookieNameIsDeleted(
|
|
4
|
+
args: VerifyIfCookieNameIsDeletedInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const cookie = await args.driver.getCookies([args.value.trim()]);
|
|
11
|
+
const isMatched = cookie.length === 0;
|
|
12
|
+
|
|
13
|
+
logger.info("Cookie deleted verification result:", {
|
|
14
|
+
isMatched
|
|
15
|
+
});
|
|
16
|
+
if (isMatched === false) {
|
|
17
|
+
throw new Error(`Cookie name is not deleted. Expected: ${args.value.trim()}, Actual: Cookie still exists`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
args.scriptDataAppender.add(async () => ({
|
|
21
|
+
nlpName: 'VerifyIfCookieNameIsDeleted',
|
|
22
|
+
stepInputs: [args.value.trim()],
|
|
23
|
+
elementsData: []
|
|
24
|
+
}));
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
} catch (error: any) {
|
|
30
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfCookieNameIsDeleted");
|
|
31
|
+
throw new Error(`VerifyIfCookieNameIsDeleted action failed`, { cause: error });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VerifyIfCookieObjectIsPresentInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfCookieObjectIsPresent(
|
|
5
|
+
args: VerifyIfCookieObjectIsPresentInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const cookies = await args.driver.getCookies();
|
|
10
|
+
logger.info("Available Cookies:", cookies);
|
|
11
|
+
|
|
12
|
+
let cookieName: string | undefined;
|
|
13
|
+
let cookieValue: string | undefined;
|
|
14
|
+
|
|
15
|
+
// Try parsing JSON cookie object
|
|
16
|
+
try {
|
|
17
|
+
const parsed = args.value.split(',')
|
|
18
|
+
cookieName = parsed[0].trim();
|
|
19
|
+
cookieValue = parsed[1].trim();
|
|
20
|
+
} catch {
|
|
21
|
+
// If not JSON, treat input as cookie name
|
|
22
|
+
cookieName = args.value.trim();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Check cookie existence
|
|
26
|
+
const matchedCookie = cookies.find(cookie => {
|
|
27
|
+
if (cookieValue !== undefined) {
|
|
28
|
+
return cookie.name === cookieName && cookie.value === cookieValue;
|
|
29
|
+
}
|
|
30
|
+
return cookie.name === cookieName;
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (!matchedCookie) {
|
|
34
|
+
throw new Error(`Cookie '${cookieName}' is not present.`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
logger.info("Matched Cookie:", matchedCookie);
|
|
38
|
+
|
|
39
|
+
args.scriptDataAppender.add(async () => ({
|
|
40
|
+
nlpName: 'VerifyIfCookieObjectIsPresent',
|
|
41
|
+
stepInputs: [args.value],
|
|
42
|
+
elementsData: []
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfCookieObjectIsPresent");
|
|
47
|
+
throw new Error("VerifyIfCookieObjectIsPresent action failed", { cause: error });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { VerifyIfGivenOptionIsDuplicateInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfGivenOptionIsDuplicate(
|
|
4
|
+
args: VerifyIfGivenOptionIsDuplicateInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const expectedText = args.value.trim();
|
|
11
|
+
|
|
12
|
+
const element = await args.driver.$(args.selector);
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const options = await element.$$("option");
|
|
16
|
+
|
|
17
|
+
let count = 0;
|
|
18
|
+
|
|
19
|
+
for (const option of options) {
|
|
20
|
+
const text = await option.getText();
|
|
21
|
+
if (text.trim() === expectedText) {
|
|
22
|
+
count++;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
logger.info("Duplicate count:", { expectedText, count });
|
|
27
|
+
if (count > 1) {
|
|
28
|
+
throw new Error(`Option "${expectedText}" is duplicated ${count} times in the dropdown.`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
args.scriptDataAppender.add(async () => {
|
|
33
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
34
|
+
args.pageDOM,
|
|
35
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
36
|
+
);
|
|
37
|
+
return {
|
|
38
|
+
nlpName: 'VerifyIfGivenOptionIsDuplicate',
|
|
39
|
+
stepInputs: [expectedText],
|
|
40
|
+
elementsData: [{
|
|
41
|
+
name: args.elementName,
|
|
42
|
+
type: args.elementType,
|
|
43
|
+
locators: ffElement.locators,
|
|
44
|
+
platform: args.platform
|
|
45
|
+
}]
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
} catch (error: any) {
|
|
52
|
+
args.scriptDataAppender.setErrorNLP(
|
|
53
|
+
"VerifyIfGivenOptionIsDuplicate"
|
|
54
|
+
);
|
|
55
|
+
throw new Error(
|
|
56
|
+
"VerifyIfGivenOptionIsDuplicate failed",
|
|
57
|
+
{ cause: error }
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VerifyIfImageIsBrokenInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfImageIsBroken(
|
|
5
|
+
args: VerifyIfImageIsBrokenInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const imageUrl = args.value.trim();
|
|
10
|
+
|
|
11
|
+
let response;
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
response = await fetch(imageUrl, {
|
|
15
|
+
method: "HEAD",
|
|
16
|
+
redirect: "follow"
|
|
17
|
+
});
|
|
18
|
+
} catch {
|
|
19
|
+
logger.info("ImageUrl request failed (considered broken):", imageUrl);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (response) {
|
|
23
|
+
logger.info("Checking imageUrl:", imageUrl, "Status:", response.status);
|
|
24
|
+
|
|
25
|
+
if (response.status < 400) {
|
|
26
|
+
throw new Error(`Working image found: ${imageUrl}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
args.scriptDataAppender.add(async () => ({
|
|
31
|
+
nlpName: 'VerifyIfImageIsBroken',
|
|
32
|
+
stepInputs: [args.value],
|
|
33
|
+
elementsData: []
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
} catch (error: any) {
|
|
37
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfImageIsBroken");
|
|
38
|
+
throw new Error("VerifyIfImageIsBroken action failed", { cause: error });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { VerifyIfLinkIsBrokenInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfLinkIsBroken(
|
|
4
|
+
args: VerifyIfLinkIsBrokenInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const link = args.value.trim();
|
|
8
|
+
|
|
9
|
+
let response;
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
response = await fetch(link, {
|
|
13
|
+
method: "HEAD",
|
|
14
|
+
redirect: "follow"
|
|
15
|
+
});
|
|
16
|
+
} catch {
|
|
17
|
+
logger.info("link request failed (considered broken):", link);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (response) {
|
|
21
|
+
logger.info("Checking link:", link, "Status:", response.status);
|
|
22
|
+
|
|
23
|
+
if (response.status < 400) {
|
|
24
|
+
throw new Error(`Working link found: ${link}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
args.scriptDataAppender.add(async () => ({
|
|
28
|
+
nlpName: 'VerifyIfLinkIsBroken',
|
|
29
|
+
stepInputs: [args.value.trim()],
|
|
30
|
+
elementsData: []
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
} catch (error: any) {
|
|
35
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfLinkIsBroken")
|
|
36
|
+
throw new Error(`VerifyIfLinkIsBroken action failed`, { cause: error });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { VerifyIfLinkIsWorkingInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfLinkIsWorking(
|
|
5
|
+
args: VerifyIfLinkIsWorkingInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
const url = args.value.trim();
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
|
|
12
|
+
const response = await fetch(url, {
|
|
13
|
+
method: "HEAD",
|
|
14
|
+
redirect: "follow"
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
logger.info("Checking link:", url, "Status:", response.status);
|
|
18
|
+
|
|
19
|
+
if (response.status >= 400) {
|
|
20
|
+
throw new Error(`Broken link found: ${url}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} catch {
|
|
24
|
+
throw new Error(`Link request failed: ${url}`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
args.scriptDataAppender.add(async () => ({
|
|
28
|
+
nlpName: 'VerifyIfLinkIsWorking',
|
|
29
|
+
stepInputs: [args.value],
|
|
30
|
+
elementsData: []
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
} catch (error: any) {
|
|
34
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfLinkIsWorking");
|
|
35
|
+
throw new Error("VerifyIfLinkIsWorking action failed", { cause: error });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { VerifyIfLinksAreBrokenInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfLinksAreBroken(
|
|
5
|
+
args: VerifyIfLinksAreBrokenInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
const links = args.value.split(",").map((link: string) => link.trim()).filter((link: string) => link.length > 0);
|
|
9
|
+
|
|
10
|
+
if (links.length === 0) {
|
|
11
|
+
throw new Error("No valid links provided.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
for (const link of links) {
|
|
15
|
+
|
|
16
|
+
let response;
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
response = await fetch(link, {
|
|
20
|
+
method: "HEAD",
|
|
21
|
+
redirect: "follow"
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
} catch {
|
|
25
|
+
logger.info("Link request failed (considered broken):", link);
|
|
26
|
+
continue; // treat as broken
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
logger.info("Checking imageUrl:", link, "Status:", response.status);
|
|
30
|
+
|
|
31
|
+
if (response.status < 400) {
|
|
32
|
+
throw new Error(`Working link found: ${link}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
args.scriptDataAppender.add(async () => ({
|
|
37
|
+
nlpName: "VerifyIfLinksAreBroken",
|
|
38
|
+
stepInputs: [args.value],
|
|
39
|
+
elementsData: []
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
} catch (error: any) {
|
|
43
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfLinksAreBroken");
|
|
44
|
+
throw new Error("VerifyIfLinksAreBroken action failed", { cause: error });
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VerifyIfLinksAreWorkingInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfLinksAreWorking(
|
|
5
|
+
args: VerifyIfLinksAreWorkingInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
const links = args.value.split(",").map((link: string) => link.trim()).filter((link: string) => link.length > 0);
|
|
9
|
+
|
|
10
|
+
if (links.length === 0) {
|
|
11
|
+
throw new Error("No valid links provided.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
for (const link of links) {
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
|
|
18
|
+
const response = await fetch(link, {
|
|
19
|
+
method: "HEAD",
|
|
20
|
+
redirect: "follow"
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
logger.info("Checking link:", link, "Status:", response.status);
|
|
24
|
+
|
|
25
|
+
if (response.status >= 400) {
|
|
26
|
+
throw new Error(`Broken link found: ${link}`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
} catch {
|
|
30
|
+
throw new Error(`Link request failed: ${link}`);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
args.scriptDataAppender.add(async () => ({
|
|
36
|
+
nlpName: "VerifyIfLinksAreWorking",
|
|
37
|
+
stepInputs: [args.value],
|
|
38
|
+
elementsData: []
|
|
39
|
+
}));
|
|
40
|
+
|
|
41
|
+
} catch (error: any) {
|
|
42
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfLinksAreWorking");
|
|
43
|
+
throw new Error("VerifyIfLinksAreWorking action failed", { cause: error });
|
|
44
|
+
}
|
|
45
|
+
}
|
package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsDeselectedInElement.ts
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
import { VerifyIfOptionWithIndexIsDeselectedInElementInterface } from "../../interface/verifyActionInterface.js";
|
|
4
|
+
|
|
5
|
+
export async function verifyIfOptionWithIndexIsDeselectedInElement(
|
|
6
|
+
args: VerifyIfOptionWithIndexIsDeselectedInElementInterface
|
|
7
|
+
): Promise<void> {
|
|
8
|
+
try {
|
|
9
|
+
let result = true
|
|
10
|
+
|
|
11
|
+
const expectedIndex = parseInt(args.value, 10);
|
|
12
|
+
|
|
13
|
+
const element = await args.driver.$(args.selector);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Get all <option> elements
|
|
17
|
+
const options = await element.$$("option");
|
|
18
|
+
|
|
19
|
+
if (!options || options.length === 0) {
|
|
20
|
+
logger.info("No options found in dropdown.");
|
|
21
|
+
result = false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// If index is within range
|
|
25
|
+
if (expectedIndex < options.length && expectedIndex >= 0) {
|
|
26
|
+
|
|
27
|
+
const targetOption = options[expectedIndex];
|
|
28
|
+
const isSelected = await targetOption.isSelected();
|
|
29
|
+
|
|
30
|
+
const isDeselected = !isSelected;
|
|
31
|
+
|
|
32
|
+
logger.info("Option index deselection verification result:", {
|
|
33
|
+
expectedIndex,
|
|
34
|
+
isDeselected
|
|
35
|
+
});
|
|
36
|
+
result = isDeselected
|
|
37
|
+
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
logger.info("Index out of range. Returning true as per logic.", {
|
|
41
|
+
expectedIndex,
|
|
42
|
+
totalOptions: options.length
|
|
43
|
+
});
|
|
44
|
+
if (result === false) {
|
|
45
|
+
throw new Error(`Option with index ${expectedIndex} is not deselected in the dropdown.`);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
args.scriptDataAppender.add(async () => {
|
|
49
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
50
|
+
args.pageDOM,
|
|
51
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
52
|
+
);
|
|
53
|
+
return {
|
|
54
|
+
nlpName: 'VerifyIfOptionWithIndexIsDeselectedInElement',
|
|
55
|
+
stepInputs: [expectedIndex],
|
|
56
|
+
elementsData: [{
|
|
57
|
+
name: args.elementName,
|
|
58
|
+
type: args.elementType,
|
|
59
|
+
locators: ffElement.locators,
|
|
60
|
+
platform: args.platform
|
|
61
|
+
}]
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
} catch (error: any) {
|
|
67
|
+
args.scriptDataAppender?.setErrorNLP(
|
|
68
|
+
"VerifyIfOptionWithIndexIsDeselectedInElement"
|
|
69
|
+
);
|
|
70
|
+
throw new Error(
|
|
71
|
+
"VerifyIfOptionWithIndexIsDeselectedInElement action failed",
|
|
72
|
+
{ cause: error }
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
}
|