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,58 @@
|
|
|
1
|
+
import { VerifyIfVideoPlayingInMuteInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfVideoPlayingInMute(
|
|
5
|
+
args: VerifyIfVideoPlayingInMuteInterface
|
|
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 isPlaying = await args.driver.execute(
|
|
16
|
+
(el) => {
|
|
17
|
+
const video = el as unknown as HTMLVideoElement;
|
|
18
|
+
return (
|
|
19
|
+
!video.paused &&
|
|
20
|
+
!video.ended &&
|
|
21
|
+
video.currentTime > 0 &&
|
|
22
|
+
video.readyState > 2 &&
|
|
23
|
+
video.muted
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
element
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
logger.info("Video playing in mute:", isPlaying);
|
|
30
|
+
|
|
31
|
+
if (!isPlaying) {
|
|
32
|
+
throw new Error("Video is not playing in mute mode.");
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
args.scriptDataAppender.add(async () => {
|
|
38
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
39
|
+
args.pageDOM,
|
|
40
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
41
|
+
);
|
|
42
|
+
return {
|
|
43
|
+
nlpName: 'VerifyIfVideoPlayingInMute',
|
|
44
|
+
stepInputs: [],
|
|
45
|
+
elementsData: [{
|
|
46
|
+
name: args.elementName,
|
|
47
|
+
type: args.elementType,
|
|
48
|
+
locators: ffElement.locators,
|
|
49
|
+
platform: args.platform
|
|
50
|
+
}]
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
} catch (error: any) {
|
|
55
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfVideoPlayingInMute");
|
|
56
|
+
throw new Error("VerifyIfVideoPlayingInMute action failed", { cause: error });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { VerifyIfVideoPlayingInUnmuteInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyIfVideoPlayingInUnmute(
|
|
5
|
+
args: VerifyIfVideoPlayingInUnmuteInterface
|
|
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 isPlaying = await args.driver.execute(
|
|
16
|
+
(el) => {
|
|
17
|
+
const video = el as unknown as HTMLVideoElement;
|
|
18
|
+
return (
|
|
19
|
+
!video.paused &&
|
|
20
|
+
!video.ended &&
|
|
21
|
+
video.currentTime > 0 &&
|
|
22
|
+
video.readyState > 2 &&
|
|
23
|
+
!video.muted
|
|
24
|
+
);
|
|
25
|
+
},
|
|
26
|
+
element
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
logger.info("Video playing in unmute:", isPlaying);
|
|
30
|
+
|
|
31
|
+
if (!isPlaying) {
|
|
32
|
+
throw new Error("Video is not playing in unmute mode.");
|
|
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
|
+
|
|
43
|
+
nlpName: 'VerifyIfVideoPlayingInUnmute',
|
|
44
|
+
stepInputs: [],
|
|
45
|
+
elementsData: [{
|
|
46
|
+
name: args.elementName,
|
|
47
|
+
type: args.elementType,
|
|
48
|
+
locators: ffElement.locators,
|
|
49
|
+
platform: args.platform
|
|
50
|
+
}]
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
} catch (error: any) {
|
|
55
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfVideoPlayingInUnmute");
|
|
56
|
+
throw new Error("VerifyVideoPlayingInUnmute action failed", { cause: error });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { VerifyIfXAndYCoordinateOfElementInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyIfXAndYCoordinateOfElement(
|
|
4
|
+
args: VerifyIfXAndYCoordinateOfElementInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
switch (args.platform) {
|
|
7
|
+
case "android":
|
|
8
|
+
try {
|
|
9
|
+
|
|
10
|
+
const element = await args.driver.$(args.selector);
|
|
11
|
+
|
|
12
|
+
if (!(await element.isExisting())) {
|
|
13
|
+
throw new Error(`Element with selector '${args.selector}' does not exist.`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const parts = args.value.split(",");
|
|
17
|
+
if (parts.length < 2) {
|
|
18
|
+
throw new Error("Invalid coordinate format. Expected 'x,y'.");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const expectedX = parseInt(parts[0].trim(), 10);
|
|
22
|
+
const expectedY = parseInt(parts[1].trim(), 10);
|
|
23
|
+
|
|
24
|
+
const location = await element.getLocation();
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if (location.x !== expectedX || location.y !== expectedY) {
|
|
28
|
+
throw new Error("Element coordinates do not match expected values.");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
args.scriptDataAppender.add(async () => {
|
|
32
|
+
|
|
33
|
+
return {
|
|
34
|
+
|
|
35
|
+
nlpName: 'MOB_VerifyIfXAndYCoordinateOfElement',
|
|
36
|
+
stepInputs: [expectedX, expectedY],
|
|
37
|
+
elementsData: [{
|
|
38
|
+
name: args.elementName,
|
|
39
|
+
type: args.elementType,
|
|
40
|
+
locators: [{ "xpath": args.selector }],
|
|
41
|
+
platform: args.platform
|
|
42
|
+
}]
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
} catch (error: any) {
|
|
47
|
+
args.scriptDataAppender.setErrorNLP("MOB_VerifyIfXAndYCoordinateOfElement");
|
|
48
|
+
throw new Error("VerifyIfXAndYCoordinateOfElement action failed", { cause: error });
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
case "web":
|
|
52
|
+
default:
|
|
53
|
+
try {
|
|
54
|
+
|
|
55
|
+
const element = await args.driver.$(args.selector);
|
|
56
|
+
|
|
57
|
+
if (!(await element.isExisting())) {
|
|
58
|
+
throw new Error(`Element with selector '${args.selector}' does not exist.`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const parts = args.value.split(",");
|
|
62
|
+
if (parts.length < 2) {
|
|
63
|
+
throw new Error("Invalid coordinate format. Expected 'x,y'.");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const expectedX = parseInt(parts[0].trim(), 10);
|
|
67
|
+
const expectedY = parseInt(parts[1].trim(), 10);
|
|
68
|
+
|
|
69
|
+
const location = await element.getLocation();
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
if (location.x !== expectedX || location.y !== expectedY) {
|
|
73
|
+
throw new Error("Element coordinates do not match expected values.");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
args.scriptDataAppender.add(async () => {
|
|
77
|
+
|
|
78
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
79
|
+
args.pageDOM,
|
|
80
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
81
|
+
);
|
|
82
|
+
return {
|
|
83
|
+
|
|
84
|
+
nlpName: 'VerifyIfXAndYCoordinateOfElement',
|
|
85
|
+
stepInputs: [expectedX, expectedY],
|
|
86
|
+
elementsData: [{
|
|
87
|
+
name: args.elementName,
|
|
88
|
+
type: args.elementType,
|
|
89
|
+
locators: ffElement.locators,
|
|
90
|
+
platform: args.platform
|
|
91
|
+
}]
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
} catch (error: any) {
|
|
96
|
+
args.scriptDataAppender.setErrorNLP("VerifyIfXAndYCoordinateOfElement");
|
|
97
|
+
throw new Error("VerifyIfXAndYCoordinateOfElement action failed", { cause: error });
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { VerifyLinkNavigatesToTitleInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyLinkNavigatesToTitle(
|
|
4
|
+
args: VerifyLinkNavigatesToTitleInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const parts = args.value.split(",");
|
|
11
|
+
|
|
12
|
+
const linkUrl = parts[0].trim();
|
|
13
|
+
const expectedTitle = parts[1].trim().toLowerCase();
|
|
14
|
+
|
|
15
|
+
await args.driver.url(linkUrl);
|
|
16
|
+
|
|
17
|
+
await args.driver.pause(3000); // wait for load
|
|
18
|
+
|
|
19
|
+
const actualTitle = (await args.driver.getTitle()).toLowerCase();
|
|
20
|
+
const isMatched = actualTitle === expectedTitle;
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if (isMatched === false) {
|
|
24
|
+
throw new Error(`Navigated page title does not match expected. URL: ${linkUrl}, Expected Title: ${expectedTitle}, Actual Title: ${actualTitle}`);
|
|
25
|
+
}
|
|
26
|
+
args.scriptDataAppender.add(async () => ({
|
|
27
|
+
nlpName: 'VerifyLinkNavigatesToTitle',
|
|
28
|
+
stepInputs: [expectedTitle, linkUrl],
|
|
29
|
+
elementsData: []
|
|
30
|
+
}));
|
|
31
|
+
|
|
32
|
+
} catch (error: any) {
|
|
33
|
+
args.scriptDataAppender?.setErrorNLP(
|
|
34
|
+
"VerifyLinkNavigatesToTitle"
|
|
35
|
+
);
|
|
36
|
+
throw new Error(
|
|
37
|
+
"VerifyLinkNavigatesToTitle failed",
|
|
38
|
+
{ cause: error }
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { VerifyListBoxOptionsAreSortedInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyListBoxOptionsAreSorted(
|
|
5
|
+
args: VerifyListBoxOptionsAreSortedInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const element = await args.driver.$(args.selector);
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Get all <option> elements
|
|
14
|
+
const options = await element.$$("option");
|
|
15
|
+
|
|
16
|
+
if (!options || options.length === 0) {
|
|
17
|
+
logger.info("No dropdown options found.");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Extract visible text safely (avoids Promise.all typing issue)
|
|
21
|
+
const optionTexts: string[] = [];
|
|
22
|
+
|
|
23
|
+
for (const option of options) {
|
|
24
|
+
const text = await option.getText();
|
|
25
|
+
optionTexts.push(text.trim());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
logger.info("Dropdown options:", optionTexts);
|
|
29
|
+
|
|
30
|
+
// Create sorted copy (case-insensitive alphabetical sort)
|
|
31
|
+
const sortedOptions = [...optionTexts].sort((a, b) =>
|
|
32
|
+
a.localeCompare(b, undefined, { sensitivity: "base" })
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const isSorted =
|
|
36
|
+
JSON.stringify(optionTexts) === JSON.stringify(sortedOptions);
|
|
37
|
+
|
|
38
|
+
logger.info("Sorted verification result:", {
|
|
39
|
+
isSorted,
|
|
40
|
+
actual: optionTexts,
|
|
41
|
+
expectedSorted: sortedOptions
|
|
42
|
+
});
|
|
43
|
+
if (isSorted === false) {
|
|
44
|
+
throw new Error(`Dropdown options are not sorted alphabetically. Actual order: ${optionTexts.join(", ")}`);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
args.scriptDataAppender.add(async () => {
|
|
48
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
49
|
+
args.pageDOM,
|
|
50
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
51
|
+
);
|
|
52
|
+
return {
|
|
53
|
+
nlpName: 'VerifyListBoxOptionsAreSorted',
|
|
54
|
+
stepInputs: [],
|
|
55
|
+
elementsData: [{
|
|
56
|
+
name: args.elementName,
|
|
57
|
+
type: args.elementType,
|
|
58
|
+
locators: ffElement.locators,
|
|
59
|
+
platform: args.platform
|
|
60
|
+
}]
|
|
61
|
+
};
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
} catch (error: any) {
|
|
66
|
+
args.scriptDataAppender?.setErrorNLP("VerifyListBoxOptionsAreSorted");
|
|
67
|
+
throw new Error(
|
|
68
|
+
"VerifyListBoxOptionsAreSorted action failed",
|
|
69
|
+
{ cause: error }
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { VerifyNavigateURLInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyNavigateUrl(
|
|
4
|
+
args: VerifyNavigateURLInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const expectedUrl = args.value.trim();
|
|
11
|
+
const actualUrl = await args.driver.getUrl();
|
|
12
|
+
|
|
13
|
+
const isMatched = actualUrl === expectedUrl;
|
|
14
|
+
|
|
15
|
+
logger.info("Navigate URL verification result:", {
|
|
16
|
+
isMatched,
|
|
17
|
+
actualUrl,
|
|
18
|
+
expectedUrl
|
|
19
|
+
});
|
|
20
|
+
if (isMatched === false) {
|
|
21
|
+
throw new Error(`Current URL does not match expected. Expected: ${expectedUrl}, Actual: ${actualUrl}`);
|
|
22
|
+
}
|
|
23
|
+
args.scriptDataAppender.add(async () => ({
|
|
24
|
+
nlpName: 'VerifyNavigateURL',
|
|
25
|
+
stepInputs: [args.value],
|
|
26
|
+
elementsData: []
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
} catch (error: any) {
|
|
31
|
+
args.scriptDataAppender.setErrorNLP("VerifyNavigateUrl");
|
|
32
|
+
throw new Error(`VerifyNavigateUrl action failed`, { cause: error });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { VerifyNumberOfElementsByTagNameInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyNumberOfElementsByTagName(
|
|
4
|
+
args: VerifyNumberOfElementsByTagNameInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
const parts = args.value.split(",");
|
|
9
|
+
const tagName = parts[0].trim();
|
|
10
|
+
const expectedCount = parseInt(parts[1], 10);
|
|
11
|
+
|
|
12
|
+
const elements = await args.driver.$$(tagName);
|
|
13
|
+
const ismatched = elements.length === expectedCount;
|
|
14
|
+
|
|
15
|
+
logger.info("Number of elements by tag name verification result:", {
|
|
16
|
+
ismatched,
|
|
17
|
+
tagName,
|
|
18
|
+
actualCount: elements.length,
|
|
19
|
+
expectedCount
|
|
20
|
+
});
|
|
21
|
+
if (ismatched === false) {
|
|
22
|
+
throw new Error(`Number of <${tagName}> elements does not match expected. Expected: ${expectedCount}, Actual: ${elements.length}`);
|
|
23
|
+
}
|
|
24
|
+
args.scriptDataAppender.add(async () => ({
|
|
25
|
+
nlpName: 'VerifyNumberOfElementsByTagName',
|
|
26
|
+
stepInputs: [tagName, expectedCount.toString()],
|
|
27
|
+
elementsData: []
|
|
28
|
+
}));
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
} catch (error: any) {
|
|
32
|
+
args.scriptDataAppender.setErrorNLP("VerifyNumberOfElementsByTagName");
|
|
33
|
+
throw new Error(`VerifyNumberOfElementsByTagName action failed`, { cause: error });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { VerifyNumberOfElementsByXpathInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
|
|
4
|
+
export async function verifyNumberOfElementsByXpath(
|
|
5
|
+
args: VerifyNumberOfElementsByXpathInterface
|
|
6
|
+
): Promise<void> {
|
|
7
|
+
try {
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
const parts = args.value.split(",");
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const xpath = parts[0].trim();
|
|
15
|
+
const expectedCount = parseInt(parts[1], 10);
|
|
16
|
+
|
|
17
|
+
let elements;
|
|
18
|
+
|
|
19
|
+
try {
|
|
20
|
+
elements = await args.driver.$$(`xpath=${xpath}`);
|
|
21
|
+
} catch {
|
|
22
|
+
elements = [];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const actualCount = elements.length;
|
|
26
|
+
const ismatched = actualCount === expectedCount;
|
|
27
|
+
|
|
28
|
+
logger.info("Number of elements by XPath verification result:", {
|
|
29
|
+
ismatched,
|
|
30
|
+
xpath,
|
|
31
|
+
actualCount,
|
|
32
|
+
expectedCount
|
|
33
|
+
});
|
|
34
|
+
if (ismatched === false) {
|
|
35
|
+
throw new Error(`Number of elements matching XPath "${xpath}" does not match expected. Expected: ${expectedCount}, Actual: ${actualCount}`);
|
|
36
|
+
}
|
|
37
|
+
args.scriptDataAppender.add(async () => ({
|
|
38
|
+
nlpName: 'VerifyNumberOfElementsByXpath',
|
|
39
|
+
stepInputs: [xpath, expectedCount.toString()],
|
|
40
|
+
elementsData: []
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
} catch (error: any) {
|
|
45
|
+
// Only unexpected framework-level errors reach here
|
|
46
|
+
args.scriptDataAppender?.setErrorNLP("VerifyNumberOfElementsByXpath");
|
|
47
|
+
throw new Error(
|
|
48
|
+
`VerifyNumberOfElementsByXpath action failed`,
|
|
49
|
+
{ cause: error }
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { VerifyPartialAttributeValueInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyPartialAttributeValue(
|
|
4
|
+
args: VerifyPartialAttributeValueInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
switch (args.platform) {
|
|
7
|
+
case "android":
|
|
8
|
+
try {
|
|
9
|
+
const element = await args.driver.$(args.selector);
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
const parts = args.value.split(",");
|
|
13
|
+
|
|
14
|
+
const attrName = parts[0].trim();
|
|
15
|
+
const expectedValue = parts[1].trim();
|
|
16
|
+
const caseSensitive = false
|
|
17
|
+
|
|
18
|
+
const actualValue =
|
|
19
|
+
(await element.getAttribute(attrName)) ||
|
|
20
|
+
(await element.getText()) ||
|
|
21
|
+
"";
|
|
22
|
+
const isMatched = actualValue.toLowerCase().includes(expectedValue.toLowerCase());
|
|
23
|
+
|
|
24
|
+
logger.info("Attribute value verification result:", { isMatched, actualValue, expectedValue });
|
|
25
|
+
if (isMatched === false) {
|
|
26
|
+
throw new Error(`Attribute "${attrName}" value does not contain expected text. Expected to contain: "${expectedValue}", Actual: "${actualValue}"`);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
args.scriptDataAppender.add(async () => {
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
nlpName: 'MOB_VerifyPartialAttributeValue',
|
|
33
|
+
stepInputs: [attrName, expectedValue, caseSensitive],
|
|
34
|
+
elementsData: [{
|
|
35
|
+
name: args.elementName,
|
|
36
|
+
type: args.elementType,
|
|
37
|
+
locators: [{ "xpath": args.selector }],
|
|
38
|
+
platform: args.platform
|
|
39
|
+
}]
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
} catch (error: any) {
|
|
44
|
+
args.scriptDataAppender.setErrorNLP("MOB_VerifyPartialAttributeValue")
|
|
45
|
+
throw new Error(`VerifyPartialAttributeValue action failed `, { cause: error });
|
|
46
|
+
}
|
|
47
|
+
break;
|
|
48
|
+
case "web":
|
|
49
|
+
default:
|
|
50
|
+
try {
|
|
51
|
+
const element = await args.driver.$(args.selector);
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
const parts = args.value.split(",");
|
|
55
|
+
|
|
56
|
+
const attrName = parts[0].trim();
|
|
57
|
+
const expectedValue = parts[1].trim();
|
|
58
|
+
const caseSensitive = false
|
|
59
|
+
|
|
60
|
+
const actualValue =
|
|
61
|
+
(await element.getAttribute(attrName)) ||
|
|
62
|
+
(await element.getText()) ||
|
|
63
|
+
"";
|
|
64
|
+
const isMatched = actualValue.toLowerCase().includes(expectedValue.toLowerCase());
|
|
65
|
+
|
|
66
|
+
logger.info("Attribute value verification result:", { isMatched, actualValue, expectedValue });
|
|
67
|
+
if (isMatched === false) {
|
|
68
|
+
throw new Error(`Attribute "${attrName}" value does not contain expected text. Expected to contain: "${expectedValue}", Actual: "${actualValue}"`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
args.scriptDataAppender.add(async () => {
|
|
72
|
+
const ffElement: any = await args.elementGetter.getFireFlinkElement(
|
|
73
|
+
args.pageDOM,
|
|
74
|
+
`[ff-inspect="${args.fireflinkIndex}"]`
|
|
75
|
+
);
|
|
76
|
+
return {
|
|
77
|
+
nlpName: 'VerifyPartialAttributeValue',
|
|
78
|
+
stepInputs: [attrName, expectedValue, caseSensitive],
|
|
79
|
+
elementsData: [{
|
|
80
|
+
name: args.elementName,
|
|
81
|
+
type: args.elementType,
|
|
82
|
+
locators: ffElement.locators,
|
|
83
|
+
platform: args.platform
|
|
84
|
+
}]
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
} catch (error: any) {
|
|
89
|
+
args.scriptDataAppender.setErrorNLP("VerifyPartialAttributeValue")
|
|
90
|
+
throw new Error(`VerifyPartialAttributeValue action failed `, { cause: error });
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { VerifyPartialTitleOfCurrentPageInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
import { logger } from "../../../../utils/logger/logData.js";
|
|
3
|
+
export async function verifyPartialTitleOfCurrentPage(
|
|
4
|
+
args: VerifyPartialTitleOfCurrentPageInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
const expectedTitle = args.value.trim();
|
|
11
|
+
const actualTitle = await args.driver.getTitle();
|
|
12
|
+
const isMatched = actualTitle.toLowerCase().includes(expectedTitle.toLowerCase());
|
|
13
|
+
const caseSensitive = false;
|
|
14
|
+
const time = 2000;
|
|
15
|
+
logger.info("Title verification result:", { isMatched, actualTitle, expectedTitle });
|
|
16
|
+
if (isMatched === false) {
|
|
17
|
+
throw new Error(`Page title does not contain expected text. Expected to contain: "${expectedTitle}", Actual: "${actualTitle}"`);
|
|
18
|
+
}
|
|
19
|
+
args.scriptDataAppender.add(async () => ({
|
|
20
|
+
nlpName: 'VerifyPartialTitleOfCurrentPage',
|
|
21
|
+
stepInputs: [expectedTitle, caseSensitive, time],
|
|
22
|
+
elementsData: []
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
} catch (error: any) {
|
|
26
|
+
args.scriptDataAppender.setErrorNLP("VerifyPartialTitleOfCurrentPage")
|
|
27
|
+
throw new Error(`VerifyPartialTitleOfCurrentPage action failed `, { cause: error });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { VerifyLighthouseScoreInterface } from "../../interface/verifyActionInterface.js";
|
|
2
|
+
|
|
3
|
+
export async function verifyPerformanceScore(
|
|
4
|
+
args: VerifyLighthouseScoreInterface
|
|
5
|
+
): Promise<void> {
|
|
6
|
+
try {
|
|
7
|
+
const inputs = args.value.split(',');
|
|
8
|
+
const url = inputs[0];
|
|
9
|
+
const device = inputs[1];
|
|
10
|
+
const minScore = parseFloat(inputs[2]);
|
|
11
|
+
if (!args.value) {
|
|
12
|
+
throw new Error("Input value is missing");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Navigate only if URL is provided
|
|
16
|
+
if (url && url.startsWith("http")) {
|
|
17
|
+
await args.driver.url(url);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// -------- Performance metrics --------
|
|
21
|
+
const metrics = await args.driver.execute(() => {
|
|
22
|
+
|
|
23
|
+
const timing = performance.timing;
|
|
24
|
+
const paintEntries = performance.getEntriesByType('paint');
|
|
25
|
+
|
|
26
|
+
const fcpEntry = paintEntries.find(p => p.name === 'first-contentful-paint');
|
|
27
|
+
const fcpTime = fcpEntry ? fcpEntry.startTime : null;
|
|
28
|
+
|
|
29
|
+
const resources = performance.getEntriesByType('resource') as PerformanceResourceTiming[];
|
|
30
|
+
|
|
31
|
+
const transferSize = resources
|
|
32
|
+
.reduce((total, r) => total + (r.transferSize || 0), 0);
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
domContentLoaded: timing.domContentLoadedEventEnd - timing.navigationStart,
|
|
36
|
+
loadTime: timing.loadEventEnd - timing.navigationStart,
|
|
37
|
+
firstContentfulPaint: fcpTime,
|
|
38
|
+
resourceCount: resources.length,
|
|
39
|
+
transferSize: transferSize
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const checks = {
|
|
44
|
+
fcp_good:
|
|
45
|
+
metrics.firstContentfulPaint !== null &&
|
|
46
|
+
metrics.firstContentfulPaint <= 2500,
|
|
47
|
+
|
|
48
|
+
dom_ready_fast:
|
|
49
|
+
metrics.domContentLoaded <= 3000,
|
|
50
|
+
|
|
51
|
+
load_fast:
|
|
52
|
+
metrics.loadTime <= 5000,
|
|
53
|
+
|
|
54
|
+
resource_count_ok:
|
|
55
|
+
metrics.resourceCount <= 150,
|
|
56
|
+
|
|
57
|
+
payload_ok:
|
|
58
|
+
metrics.transferSize <= 5 * 1024 * 1024
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const values = Object.values(checks);
|
|
62
|
+
const passed = values.filter(v => v).length;
|
|
63
|
+
const total = values.length;
|
|
64
|
+
|
|
65
|
+
const actualScore = Math.floor((passed / total) * 100);
|
|
66
|
+
|
|
67
|
+
if (actualScore < minScore) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
`Performance score ${actualScore} is less than expected ${minScore}`
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
args.scriptDataAppender.add(async () => ({
|
|
74
|
+
nlpName: 'VerifyPerformanceScore',
|
|
75
|
+
stepInputs: [url, device, minScore.toString()],
|
|
76
|
+
elementsData: []
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
} catch (error: any) {
|
|
80
|
+
args.scriptDataAppender.setErrorNLP("VerifyPerformanceScore")
|
|
81
|
+
throw new Error(`VerifyPerformanceScore action failed `, { cause: error });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
}
|