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
package/src/automation/actions/interaction/verify/VerifyIfOptionWithIndexIsSelectedInListBox.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
2
|
+
import { VerifyIfOptionWithIndexIsSelectedInListBoxInterface } from "../../interface/verifyActionInterface.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfOptionWithIndexIsSelectedInListBox(
|
|
5
|
+
args: VerifyIfOptionWithIndexIsSelectedInListBoxInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
let isSelected = false;
|
|
9
|
+
|
|
10
|
+
if (!args.selector || !args.value) {
|
|
11
|
+
logger.info("Selector or value is missing.");
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const expectedIndex = parseInt(args.value, 10);
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const element = await args.driver.$(args.selector);
|
|
18
|
+
if (!(await element.isExisting())) {
|
|
19
|
+
logger.info("Element does not exist for selector:");
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Get all <option> elements
|
|
23
|
+
const options = await element.$$("option");
|
|
24
|
+
|
|
25
|
+
if (!options || options.length === 0) {
|
|
26
|
+
logger.info("No options found in dropdown.");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// If index is within range
|
|
30
|
+
if (expectedIndex < options.length && expectedIndex >= 0) {
|
|
31
|
+
|
|
32
|
+
const targetOption = options[expectedIndex];
|
|
33
|
+
isSelected = await targetOption.isSelected();
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
logger.info("Option index deselection verification result:", {
|
|
37
|
+
expectedIndex,
|
|
38
|
+
isSelected
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
logger.info("Index out of range. Returning true as per logic.", {
|
|
42
|
+
expectedIndex,
|
|
43
|
+
totalOptions: options.length
|
|
44
|
+
});
|
|
45
|
+
if (isSelected === false) {
|
|
46
|
+
throw new Error(`Option with index ${expectedIndex} is not selected in the dropdown.`);
|
|
47
|
+
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
args.scriptDataAppender.add(async () => {
|
|
51
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
52
|
+
args.pageDOM,
|
|
53
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
54
|
+
);
|
|
55
|
+
return {
|
|
56
|
+
nlpName: 'VerifyIfOptionWithIndexIsSelectedInListBox',
|
|
57
|
+
stepInputs: [expectedIndex],
|
|
58
|
+
elementsData: [{
|
|
59
|
+
name: args.elementName,
|
|
60
|
+
type: args.elementType,
|
|
61
|
+
locators: ffElement.locators,
|
|
62
|
+
platform: args.platform
|
|
63
|
+
}]
|
|
64
|
+
};
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
} catch (error: any) {
|
|
69
|
+
args.scriptDataAppender?.setErrorNLP(
|
|
70
|
+
"VerifyIfOptionWithIndexIsSelectedInListBox"
|
|
71
|
+
);
|
|
72
|
+
throw new Error(
|
|
73
|
+
"VerifyIfOptionWithIndexIsSelectedInListBox action failed",
|
|
74
|
+
{ cause: error }
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VerifyOptionSelectionInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyIfOptionWithTextIsDeselected(
|
|
4
|
+
args: VerifyOptionSelectionInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const optionText = args.value;
|
|
8
|
+
const selectElement = await args.driver.$(args.selector);
|
|
9
|
+
const option = await selectElement.$(`//option[text()="${optionText}"]`);
|
|
10
|
+
|
|
11
|
+
const isSelected = await option.isSelected();
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
if (!isSelected) {
|
|
15
|
+
throw new Error(`Option with text ${optionText} is selected`);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
args.scriptDataAppender.add(async () => {
|
|
19
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
20
|
+
args.pageDOM,
|
|
21
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
22
|
+
);
|
|
23
|
+
return {
|
|
24
|
+
nlpName: 'VerifyIfOptionWithTextIsDeselected',
|
|
25
|
+
stepInputs: [optionText],
|
|
26
|
+
elementsData: [{
|
|
27
|
+
name: args.elementName,
|
|
28
|
+
type: args.elementType,
|
|
29
|
+
locators: ffElement.locators,
|
|
30
|
+
platform: args.platform
|
|
31
|
+
}]
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
} catch (error: any) {
|
|
37
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfOptionWithTextIsDeselected")
|
|
38
|
+
throw new Error(`VerifyIfOptionWithTextIsDeselected action failed `, { cause: error });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { VerifyIfOptionWithValueIsDeSelectedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfOptionWithValueIsDeselected(
|
|
4
|
+
args: VerifyIfOptionWithValueIsDeSelectedInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
let result = false;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const expectedValue = args.value.trim();
|
|
12
|
+
|
|
13
|
+
const element = await args.driver.$(args.selector);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const options = await element.$$("option");
|
|
17
|
+
|
|
18
|
+
for (const option of options) {
|
|
19
|
+
|
|
20
|
+
const optionValue = await option.getAttribute("value");
|
|
21
|
+
const isSelected = await option.isSelected();
|
|
22
|
+
|
|
23
|
+
if (optionValue === expectedValue && isSelected) {
|
|
24
|
+
|
|
25
|
+
result = true;
|
|
26
|
+
logger.info("Option with value is selected:", {
|
|
27
|
+
expectedValue, result
|
|
28
|
+
});
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
}
|
|
33
|
+
if (result === true) {
|
|
34
|
+
throw new Error(`Option with value "${expectedValue}" is not deselected in the dropdown.`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
args.scriptDataAppender.add(async () => {
|
|
40
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
41
|
+
args.pageDOM,
|
|
42
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
43
|
+
);
|
|
44
|
+
return {
|
|
45
|
+
nlpName: 'VerifyIfOptionWithValueIsDeselected',
|
|
46
|
+
stepInputs: [expectedValue],
|
|
47
|
+
elementsData: [{
|
|
48
|
+
name: args.elementName,
|
|
49
|
+
type: args.elementType,
|
|
50
|
+
locators: ffElement.locators,
|
|
51
|
+
platform: args.platform
|
|
52
|
+
}]
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
} catch (error: any) {
|
|
58
|
+
args.scriptDataAppender?.setErrorNLP("VerifyIfOptionWithValueIsDeselected");
|
|
59
|
+
throw new Error("VerifyIfOptionWithValueIsDeselected failed", { cause: error });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { VerifyIfOptionWithValueIsSelectedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfOptionWithValueIsSelected(
|
|
4
|
+
args: VerifyIfOptionWithValueIsSelectedInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
let result = false;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const expectedValue = args.value.trim();
|
|
12
|
+
|
|
13
|
+
const element = await args.driver.$(args.selector);
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
const options = await element.$$("option");
|
|
17
|
+
|
|
18
|
+
for (const option of options) {
|
|
19
|
+
|
|
20
|
+
const optionValue = await option.getAttribute("value");
|
|
21
|
+
const isSelected = await option.isSelected();
|
|
22
|
+
|
|
23
|
+
if (optionValue === expectedValue && isSelected) {
|
|
24
|
+
|
|
25
|
+
result = true;
|
|
26
|
+
logger.info("Option with value is selected:", {
|
|
27
|
+
expectedValue, result
|
|
28
|
+
});
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (result === false) {
|
|
33
|
+
throw new Error(`Option with value "${expectedValue}" is not selected in the dropdown.`);
|
|
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: 'VerifyIfOptionWithValueIsSelected',
|
|
43
|
+
stepInputs: [expectedValue],
|
|
44
|
+
elementsData: [{
|
|
45
|
+
name: args.elementName,
|
|
46
|
+
type: args.elementType,
|
|
47
|
+
locators: ffElement.locators,
|
|
48
|
+
platform: args.platform
|
|
49
|
+
}]
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
} catch (error: any) {
|
|
55
|
+
args.scriptDataAppender?.setErrorNLP("VerifyIfOptionWithValueIsSelected");
|
|
56
|
+
throw new Error("VerifyIfOptionWithValueIsSelected failed", { cause: error });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { VerifyOptionSelectionInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyIfOptionWithVisibleTextIsSelected(
|
|
4
|
+
args: VerifyOptionSelectionInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const optionText = args.value;
|
|
8
|
+
const selectElement = await args.driver.$(args.selector);
|
|
9
|
+
const option = await selectElement.$(`//option[text()="${optionText}"]`);
|
|
10
|
+
|
|
11
|
+
const isSelected = await option.isSelected();
|
|
12
|
+
if (!isSelected) {
|
|
13
|
+
throw new Error(`Option with visible text ${optionText} is not selected`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
args.scriptDataAppender.add(async () => {
|
|
19
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
20
|
+
args.pageDOM,
|
|
21
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
22
|
+
);
|
|
23
|
+
return {
|
|
24
|
+
nlpName: 'VerifyIfOptionWithVisibleTextIsSelected',
|
|
25
|
+
stepInputs: [optionText],
|
|
26
|
+
elementsData: [{
|
|
27
|
+
name: args.elementName,
|
|
28
|
+
type: args.elementType,
|
|
29
|
+
locators: ffElement.locators,
|
|
30
|
+
platform: args.platform
|
|
31
|
+
}]
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
} catch (error: any) {
|
|
37
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfOptionWithVisibleTextIsSelected")
|
|
38
|
+
throw new Error(`VerifyIfOptionWithVisibleTextIsSelected action failed `, { cause: error });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { VerifyIfSpecifiedOptionIsSelectedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfSpecifiedOptionIsSelected(
|
|
5
|
+
args: VerifyIfSpecifiedOptionIsSelectedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
let result = false
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
let parts = (args.value ?? "").split(",");
|
|
13
|
+
|
|
14
|
+
if (parts.length === 1) {
|
|
15
|
+
parts = [parts[0], "false"];
|
|
16
|
+
}
|
|
17
|
+
const expectedText = parts[0].trim();
|
|
18
|
+
const caseSensitive = parts[1].trim();
|
|
19
|
+
|
|
20
|
+
const element = await args.driver.$(args.selector);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
const options = await element.$$("option");
|
|
24
|
+
|
|
25
|
+
for (const option of options) {
|
|
26
|
+
|
|
27
|
+
if (!(await option.isSelected())) continue;
|
|
28
|
+
|
|
29
|
+
const optionText = await option.getText();
|
|
30
|
+
|
|
31
|
+
if (caseSensitive) {
|
|
32
|
+
if (optionText === expectedText) {
|
|
33
|
+
result = true
|
|
34
|
+
|
|
35
|
+
}
|
|
36
|
+
} else {
|
|
37
|
+
if (optionText.toLowerCase() === expectedText.toLowerCase()) {
|
|
38
|
+
result = true
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
logger.info("Option selection verification result: No matching selected option found", {
|
|
44
|
+
expectedText,
|
|
45
|
+
result
|
|
46
|
+
});
|
|
47
|
+
if (result === false) {
|
|
48
|
+
throw new Error(`Option with text "${expectedText}" is not selected in the dropdown.`);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
args.scriptDataAppender.add(async () => {
|
|
52
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
53
|
+
args.pageDOM,
|
|
54
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
55
|
+
);
|
|
56
|
+
return {
|
|
57
|
+
nlpName: 'VerifyIfSpecifiedOptionIsSelected',
|
|
58
|
+
stepInputs: [expectedText, caseSensitive],
|
|
59
|
+
elementsData: [{
|
|
60
|
+
name: args.elementName,
|
|
61
|
+
type: args.elementType,
|
|
62
|
+
locators: ffElement.locators,
|
|
63
|
+
platform: args.platform
|
|
64
|
+
}]
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
} catch (error: any) {
|
|
70
|
+
args.scriptDataAppender?.setErrorNLP(
|
|
71
|
+
"VerifyIfSpecifiedOptionIsSelected"
|
|
72
|
+
);
|
|
73
|
+
throw new Error(
|
|
74
|
+
"VerifyIfSpecifiedOptionIsSelected failed",
|
|
75
|
+
{ cause: error }
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { VerifyUrlStatusCodeInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyIfStatusCodeOfALinkIsStatusCode(
|
|
4
|
+
args: VerifyUrlStatusCodeInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const inputs = args.value.split(',');
|
|
8
|
+
const expectedStatusCode = parseInt(inputs[0]);
|
|
9
|
+
const url = inputs[1];
|
|
10
|
+
|
|
11
|
+
const actualStatus = await args.driver.execute(async (url) => {
|
|
12
|
+
try {
|
|
13
|
+
const response = await fetch(url, { method: 'HEAD' });
|
|
14
|
+
return response.status;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}, url);
|
|
19
|
+
|
|
20
|
+
if (actualStatus !== expectedStatusCode) {
|
|
21
|
+
throw new Error(
|
|
22
|
+
`Expected status ${expectedStatusCode} but received ${actualStatus} for ${url}`
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
args.scriptDataAppender.add(async () => ({
|
|
27
|
+
nlpName: 'VerifyIfStatusCodeOfALinkIsStatusCode',
|
|
28
|
+
stepInputs: [expectedStatusCode.toString(), url],
|
|
29
|
+
elementsData: []
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfStatusCodeOfALinkIsStatusCode")
|
|
34
|
+
throw new Error(`VerifyIfStatusCodeOfALinkIsStatusCode action failed `, { cause: error });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { VerifyAllLinksStatusCodeInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyIfStatusCodesOfLinks(
|
|
4
|
+
args: VerifyAllLinksStatusCodeInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const expectedStatusCode = parseInt(args.value);
|
|
8
|
+
|
|
9
|
+
const result = await args.driver.execute(async (expected) => {
|
|
10
|
+
const links = Array.from(document.querySelectorAll('a[href]'))
|
|
11
|
+
.map((a: any) => a.href)
|
|
12
|
+
.filter((url: string) => url && url.startsWith('http'));
|
|
13
|
+
|
|
14
|
+
const uniqueLinks = [...new Set(links)];
|
|
15
|
+
|
|
16
|
+
for (const url of uniqueLinks) {
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(url, { method: 'HEAD' });
|
|
19
|
+
if (response.status !== expected) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return true;
|
|
28
|
+
}, expectedStatusCode);
|
|
29
|
+
|
|
30
|
+
if (!result) {
|
|
31
|
+
throw new Error(`Not all links returned status code ${expectedStatusCode}`);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
args.scriptDataAppender.add(async () => ({
|
|
35
|
+
nlpName: 'VerifyIfStatusCodesOfLinks',
|
|
36
|
+
stepInputs: [expectedStatusCode.toString()],
|
|
37
|
+
elementsData: []
|
|
38
|
+
}));
|
|
39
|
+
|
|
40
|
+
} catch (error: any) {
|
|
41
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfStatusCodesOfLinks")
|
|
42
|
+
throw new Error(`VerifyIfStatusCodesOfLinks action failed `, { cause: error });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VerifyIfVideoEndedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfVideoEnded(
|
|
5
|
+
args: VerifyIfVideoEndedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
if (!(await element.isExisting())) {
|
|
12
|
+
throw new Error("Video element does not exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const hasEnded = await args.driver.execute(
|
|
16
|
+
(el) => (el as unknown as HTMLVideoElement).ended,
|
|
17
|
+
element
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
logger.info("Video ended status:", hasEnded);
|
|
21
|
+
|
|
22
|
+
if (!hasEnded) {
|
|
23
|
+
throw new Error("Video has not ended.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
args.scriptDataAppender.add(async () => {
|
|
29
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
30
|
+
args.pageDOM,
|
|
31
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
nlpName: 'VerifyIfVideoEnded',
|
|
35
|
+
stepInputs: [],
|
|
36
|
+
elementsData: [{
|
|
37
|
+
name: args.elementName,
|
|
38
|
+
type: args.elementType,
|
|
39
|
+
locators: ffElement.locators,
|
|
40
|
+
platform: args.platform
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfVideoEnded");
|
|
47
|
+
throw new Error("VerifyIfVideoEnded action failed", { cause: error });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VerifyIfVideoIsMutedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfVideoIsMuted(args:
|
|
5
|
+
VerifyIfVideoIsMutedInterface): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
const element = await args.driver.$(args.selector);
|
|
9
|
+
|
|
10
|
+
if (!(await element.isExisting())) {
|
|
11
|
+
throw new Error("Video element does not exist.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const isMuted = await args.driver.execute(
|
|
15
|
+
(el) => {
|
|
16
|
+
return (el as unknown as HTMLVideoElement).muted;
|
|
17
|
+
},
|
|
18
|
+
element
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
logger.info("Video muted status:", isMuted);
|
|
22
|
+
|
|
23
|
+
if (!isMuted) {
|
|
24
|
+
throw new Error("Video is not muted.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
args.scriptDataAppender.add(async () => {
|
|
29
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
30
|
+
args.pageDOM,
|
|
31
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
nlpName: 'VerifyIfVideoIsMuted',
|
|
35
|
+
stepInputs: [],
|
|
36
|
+
elementsData: [{
|
|
37
|
+
name: args.elementName,
|
|
38
|
+
type: args.elementType,
|
|
39
|
+
locators: ffElement.locators,
|
|
40
|
+
platform: args.platform
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfVideoIsMuted");
|
|
47
|
+
throw new Error("VerifyIfVideoIsMuted action failed", { cause: error });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { VerifyIfVideoIsPausedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfVideoIsPaused(
|
|
5
|
+
args: VerifyIfVideoIsPausedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
if (!(await element.isExisting())) {
|
|
12
|
+
throw new Error("Video element does not exist.");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const isPaused = await args.driver.execute(
|
|
16
|
+
(el) => (el as unknown as HTMLVideoElement).paused,
|
|
17
|
+
element
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
logger.info("Video paused status:", isPaused);
|
|
21
|
+
|
|
22
|
+
if (!isPaused) {
|
|
23
|
+
throw new Error("Video is not paused.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
args.scriptDataAppender.add(async () => {
|
|
29
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
30
|
+
args.pageDOM,
|
|
31
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
nlpName: 'VerifyIfVideoIsPaused',
|
|
35
|
+
stepInputs: [],
|
|
36
|
+
elementsData: [{
|
|
37
|
+
name: args.elementName,
|
|
38
|
+
type: args.elementType,
|
|
39
|
+
locators: ffElement.locators,
|
|
40
|
+
platform: args.platform
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
} catch (error: any) {
|
|
46
|
+
args.scriptDataAppender.setErrorNLP("VerifyVideoIsPaused");
|
|
47
|
+
throw new Error("VerifyVideoIsPaused action failed", { cause: error });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { VerifyIfVideoIsPlayingInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyIfVideoIsPlaying(
|
|
4
|
+
args: VerifyIfVideoIsPlayingInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
const element = await args.driver.$(args.selector);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const isPlaying = await args.driver.execute(
|
|
12
|
+
(el: any) => {
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
!el.paused &&
|
|
16
|
+
!el.ended &&
|
|
17
|
+
el.currentTime > 0 &&
|
|
18
|
+
el.readyState > 2
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
element
|
|
22
|
+
);
|
|
23
|
+
logger.info("Video playing verification result:", { isPlaying });
|
|
24
|
+
if (isPlaying === false) {
|
|
25
|
+
throw new Error(`Video is not playing for the selector: ${args.selector}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
args.scriptDataAppender.add(async () => {
|
|
29
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
30
|
+
args.pageDOM,
|
|
31
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
32
|
+
);
|
|
33
|
+
return {
|
|
34
|
+
nlpName: 'VerifyIfVideoIsPlaying',
|
|
35
|
+
stepInputs: [],
|
|
36
|
+
elementsData: [{
|
|
37
|
+
name: args.elementName,
|
|
38
|
+
type: args.elementType,
|
|
39
|
+
locators: ffElement.locators,
|
|
40
|
+
platform: args.platform
|
|
41
|
+
}]
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
} catch (error: any) {
|
|
47
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfVideoIsPlaying");
|
|
48
|
+
throw new Error(`VerifyIfVideoIsPlaying action failed`, { cause: error });
|
|
49
|
+
}
|
|
50
|
+
}
|