@coveo/quantic 3.33.0 → 3.33.2
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/README.md +15 -15
- package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +106 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +752 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +76 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +282 -0
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +167 -0
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +262 -0
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +819 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +23 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +51 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +152 -0
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +269 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +1183 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +27 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +75 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +199 -0
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +371 -0
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +212 -0
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +688 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +24 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +68 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +27 -0
- package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +145 -0
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +348 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +48 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +80 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +173 -0
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +219 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +404 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +38 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +102 -0
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +1105 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +73 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +67 -0
- package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +208 -0
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +28 -0
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +178 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +64 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +23 -0
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +82 -0
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +392 -0
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +448 -0
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +298 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +323 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +70 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +1158 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +56 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +185 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +451 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +337 -0
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +151 -0
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +71 -0
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +651 -0
- package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +194 -0
- package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +230 -0
- package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +205 -0
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +309 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +47 -0
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +953 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +28 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +71 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +59 -0
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +164 -0
- package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +430 -0
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +65 -0
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +69 -0
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +106 -0
- package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +47 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +13 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +14 -0
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +82 -0
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +273 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +448 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +55 -0
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +93 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +516 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +42 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +61 -0
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +48 -0
- package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +491 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +35 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +52 -0
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +53 -0
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +747 -0
- package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +542 -0
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +262 -0
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +141 -0
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +340 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +300 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +46 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +49 -0
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +40 -0
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +120 -0
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +209 -0
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +261 -0
- package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +342 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +66 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +81 -0
- package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +69 -0
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +235 -0
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +144 -0
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +324 -0
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +301 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +81 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +38 -0
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +66 -0
- package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +90 -0
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +155 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +464 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +74 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +85 -0
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +97 -0
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +487 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +84 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +45 -0
- package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +159 -0
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +743 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +571 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +110 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +113 -0
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +299 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +341 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +21 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +91 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +196 -0
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +192 -0
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +126 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +290 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +329 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +31 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +93 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +160 -0
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +127 -0
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +416 -0
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +89 -0
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +91 -0
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +136 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +387 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +53 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +54 -0
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +222 -0
- package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +244 -0
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +333 -0
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +56 -0
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +68 -0
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +72 -0
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +331 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +61 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +80 -0
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +171 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +1037 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +58 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +43 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +160 -0
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +107 -0
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +427 -0
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +269 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +89 -0
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +511 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +229 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +71 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +39 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +84 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +92 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +71 -0
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +223 -0
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +131 -0
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/case-assist-engine/case-assist-engine.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.d.ts +16 -16
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/common-reducers.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/insight-engine/insight-engine.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/recommendation-engine/recommendation-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/search-engine/search-engine.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/facets/headless-core-commerce-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/core/facets/range-facet/headless-core-range-facet.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/actions-history/ipx-actions-history-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/advanced-search-queries/advanced-search-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/attached-results/attached-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-assist-configuration/case-assist-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-context/case-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-field/case-field-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/case-input/case-input-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/cart/cart-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/commerce-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/field-suggestions-order/field-suggestions-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/numeric-facet/manual-numeric-facet-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/instant-products/instant-products-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/parameters/parameters-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product/product-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/product-listing/product-listing-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/recommendations/recommendations-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/sort/sort-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/context/context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/debug-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/debug/version-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/dictionary-field-context/dictionary-field-context-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/did-you-mean/did-you-mean-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/excerpt-length/excerpt-length-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facet-options/facet-options-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/automatic-facet-set/automatic-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/category-facet-set/category-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-order/facet-order-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/generic/generic-facet-search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/date-facet-set/date-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-controller-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/range-facets/numeric-facet-set/numeric-facet-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/fields/fields-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/folding-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/folding/insight-folding-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/generated-answer/generated-answer-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-actions.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-slice.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-configuration/insight-configuration-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-interface/insight-interface-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/insight-search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-search/legacy/insight-search-actions.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/insight-user-actions/insight-user-actions-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/instant-results/instant-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pagination/pagination-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/pipeline/pipeline-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query/query-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-set/query-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/question-answering/question-answering-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-queries/recent-queries-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recent-results/recent-results-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/recommendation/recommendation-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/result-preview/result-preview-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-actions.d.ts +5 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +6 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-hub/search-hub-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/sort-criteria/sort-criteria-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/tab-set/tab-set-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/triggers/triggers-slice.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +6 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +4 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/engine/search-engine.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-ssr-controller-definitions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
- package/package.json +46 -44
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
/* eslint-disable jest/no-conditional-expect */
|
|
2
|
+
/* eslint-disable no-import-assign */
|
|
3
|
+
import QuanticSmartSnippet from '../quanticSmartSnippet';
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
import {createElement} from 'lwc';
|
|
6
|
+
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
7
|
+
|
|
8
|
+
let mockAnswerHeight = 300;
|
|
9
|
+
|
|
10
|
+
jest.mock('c/quanticHeadlessLoader');
|
|
11
|
+
jest.mock('c/quanticUtils', () => ({
|
|
12
|
+
getAbsoluteHeight: jest.fn(() => {
|
|
13
|
+
return mockAnswerHeight;
|
|
14
|
+
}),
|
|
15
|
+
I18nUtils: {
|
|
16
|
+
format: jest.fn(),
|
|
17
|
+
},
|
|
18
|
+
LinkUtils: {
|
|
19
|
+
bindAnalyticsToLink: jest.fn(),
|
|
20
|
+
},
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
jest.mock(
|
|
24
|
+
'@salesforce/label/c.quantic_SmartSnippetShowMore',
|
|
25
|
+
() => ({default: 'Show more'}),
|
|
26
|
+
{
|
|
27
|
+
virtual: true,
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
jest.mock(
|
|
32
|
+
'@salesforce/label/c.quantic_SmartSnippetShowLess',
|
|
33
|
+
() => ({default: 'Show less'}),
|
|
34
|
+
{
|
|
35
|
+
virtual: true,
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
let isInitialized = false;
|
|
40
|
+
|
|
41
|
+
const exampleEngine = {
|
|
42
|
+
id: 'exampleEngineId',
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const defaultOptions = {
|
|
46
|
+
engineId: exampleEngine.id,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const selectors = {
|
|
50
|
+
initializationError: 'c-quantic-component-error',
|
|
51
|
+
smartSnippet: 'c-quantic-smart-snippet',
|
|
52
|
+
smartSnippetAnswer: 'c-quantic-smart-snippet-answer',
|
|
53
|
+
smartSnippetToggleButton: '[data-testid="smart-snippet__toggle-button"]',
|
|
54
|
+
smartSnippetSource: 'c-quantic-smart-snippet-source',
|
|
55
|
+
smartSnippetFeedback: 'c-quantic-feedback',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const defaultSearchStatusState = {
|
|
59
|
+
hasResults: true,
|
|
60
|
+
firstSearchExecuted: true,
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
let searchStatusState = defaultSearchStatusState;
|
|
64
|
+
|
|
65
|
+
const mockSmartSnippetSource = {
|
|
66
|
+
title: 'The Lord of the Rings',
|
|
67
|
+
uri: 'https://en.wikipedia.org/wiki/The_Lord_of_the_Rings',
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
const defaultSmartSnippetState = {
|
|
71
|
+
question: 'Where was Gondor when Westfold fell?',
|
|
72
|
+
answer: 'Gondor was obviously busy with other things.',
|
|
73
|
+
documentId: '1',
|
|
74
|
+
expanded: false,
|
|
75
|
+
answerFound: true,
|
|
76
|
+
liked: false,
|
|
77
|
+
disliked: false,
|
|
78
|
+
feedbackModalOpen: false,
|
|
79
|
+
source: mockSmartSnippetSource,
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
let smartSnippetState = defaultSmartSnippetState;
|
|
83
|
+
|
|
84
|
+
const functionsMocks = {
|
|
85
|
+
buildSmartSnippet: jest.fn(() => ({
|
|
86
|
+
state: smartSnippetState,
|
|
87
|
+
subscribe: functionsMocks.smartSnippetStateSubscriber,
|
|
88
|
+
expand: functionsMocks.expand,
|
|
89
|
+
collapse: functionsMocks.collapse,
|
|
90
|
+
})),
|
|
91
|
+
buildSearchStatus: jest.fn(() => ({
|
|
92
|
+
state: searchStatusState,
|
|
93
|
+
subscribe: functionsMocks.searchStatusStateSubscriber,
|
|
94
|
+
})),
|
|
95
|
+
smartSnippetStateSubscriber: jest.fn((cb) => {
|
|
96
|
+
cb();
|
|
97
|
+
return functionsMocks.smartSnippetStateUnsubscriber;
|
|
98
|
+
}),
|
|
99
|
+
searchStatusStateSubscriber: jest.fn((cb) => {
|
|
100
|
+
cb();
|
|
101
|
+
return functionsMocks.searchStatusStateUnsubscriber;
|
|
102
|
+
}),
|
|
103
|
+
smartSnippetStateUnsubscriber: jest.fn(),
|
|
104
|
+
searchStatusStateUnsubscriber: jest.fn(),
|
|
105
|
+
expand: jest.fn(),
|
|
106
|
+
collapse: jest.fn(),
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
function createTestComponent(options = defaultOptions) {
|
|
110
|
+
const element = createElement('c-quantic-smart-snippet', {
|
|
111
|
+
is: QuanticSmartSnippet,
|
|
112
|
+
});
|
|
113
|
+
for (const [key, value] of Object.entries(options)) {
|
|
114
|
+
element[key] = value;
|
|
115
|
+
}
|
|
116
|
+
document.body.appendChild(element);
|
|
117
|
+
return element;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Helper function to wait until the microtask queue is empty.
|
|
121
|
+
function flushPromises() {
|
|
122
|
+
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function prepareHeadlessState() {
|
|
126
|
+
// @ts-ignore
|
|
127
|
+
mockHeadlessLoader.getHeadlessBundle = () => {
|
|
128
|
+
return {
|
|
129
|
+
buildSmartSnippet: functionsMocks.buildSmartSnippet,
|
|
130
|
+
buildSearchStatus: functionsMocks.buildSearchStatus,
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function mockSuccessfulHeadlessInitialization() {
|
|
136
|
+
// @ts-ignore
|
|
137
|
+
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
138
|
+
if (element instanceof QuanticSmartSnippet && !isInitialized) {
|
|
139
|
+
isInitialized = true;
|
|
140
|
+
initialize(exampleEngine);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function mockErroneousHeadlessInitialization() {
|
|
146
|
+
// @ts-ignore
|
|
147
|
+
mockHeadlessLoader.initializeWithHeadless = (element) => {
|
|
148
|
+
if (element instanceof QuanticSmartSnippet) {
|
|
149
|
+
element.setInitializationError();
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function cleanup() {
|
|
155
|
+
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
156
|
+
while (document.body.firstChild) {
|
|
157
|
+
document.body.removeChild(document.body.firstChild);
|
|
158
|
+
}
|
|
159
|
+
jest.clearAllMocks();
|
|
160
|
+
isInitialized = false;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
describe('c-quantic-smart-snippet', () => {
|
|
164
|
+
afterEach(() => {
|
|
165
|
+
smartSnippetState = defaultSmartSnippetState;
|
|
166
|
+
searchStatusState = defaultSearchStatusState;
|
|
167
|
+
cleanup();
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
describe('controller initialization', () => {
|
|
171
|
+
beforeEach(() => {
|
|
172
|
+
mockSuccessfulHeadlessInitialization();
|
|
173
|
+
prepareHeadlessState();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('should build the smart snippet controller with the proper parameters and subscribe to its state change', async () => {
|
|
177
|
+
createTestComponent();
|
|
178
|
+
await flushPromises();
|
|
179
|
+
|
|
180
|
+
expect(functionsMocks.buildSmartSnippet).toHaveBeenCalledTimes(1);
|
|
181
|
+
expect(functionsMocks.buildSmartSnippet).toHaveBeenCalledWith(
|
|
182
|
+
exampleEngine
|
|
183
|
+
);
|
|
184
|
+
expect(functionsMocks.smartSnippetStateSubscriber).toHaveBeenCalledTimes(
|
|
185
|
+
1
|
|
186
|
+
);
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
it('should build the search status controller with the proper parameters and subscribe to its state change', async () => {
|
|
190
|
+
createTestComponent();
|
|
191
|
+
await flushPromises();
|
|
192
|
+
|
|
193
|
+
expect(functionsMocks.buildSearchStatus).toHaveBeenCalledTimes(1);
|
|
194
|
+
expect(functionsMocks.buildSearchStatus).toHaveBeenCalledWith(
|
|
195
|
+
exampleEngine
|
|
196
|
+
);
|
|
197
|
+
expect(functionsMocks.searchStatusStateSubscriber).toHaveBeenCalledTimes(
|
|
198
|
+
1
|
|
199
|
+
);
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe('when an initialization error occurs', () => {
|
|
204
|
+
beforeEach(() => {
|
|
205
|
+
mockErroneousHeadlessInitialization();
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it('should display the initialization error component', async () => {
|
|
209
|
+
const element = createTestComponent();
|
|
210
|
+
await flushPromises();
|
|
211
|
+
|
|
212
|
+
const initializationError = element.shadowRoot.querySelector(
|
|
213
|
+
selectors.initializationError
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
expect(initializationError).not.toBeNull();
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
describe('when the query does not return a smart snippet', () => {
|
|
221
|
+
beforeAll(() => {
|
|
222
|
+
smartSnippetState = {...defaultSmartSnippetState, answerFound: false};
|
|
223
|
+
});
|
|
224
|
+
it('should not display the smart snippet component', async () => {
|
|
225
|
+
const element = createTestComponent();
|
|
226
|
+
await flushPromises();
|
|
227
|
+
|
|
228
|
+
const smartSnippet = element.shadowRoot.querySelector(
|
|
229
|
+
selectors.smartSnippet
|
|
230
|
+
);
|
|
231
|
+
expect(smartSnippet).toBeNull();
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
describe('when the query returns a smart snippet', () => {
|
|
236
|
+
beforeEach(() => {
|
|
237
|
+
mockSuccessfulHeadlessInitialization();
|
|
238
|
+
prepareHeadlessState();
|
|
239
|
+
smartSnippetState = defaultSmartSnippetState;
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
afterEach(() => {
|
|
243
|
+
smartSnippetState = defaultSmartSnippetState;
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
it('should properly display the smart snippet', async () => {
|
|
247
|
+
const element = createTestComponent();
|
|
248
|
+
await flushPromises();
|
|
249
|
+
|
|
250
|
+
const smartSnippetAnswer = element.shadowRoot.querySelector(
|
|
251
|
+
selectors.smartSnippetAnswer
|
|
252
|
+
);
|
|
253
|
+
|
|
254
|
+
expect(smartSnippetAnswer).not.toBeNull();
|
|
255
|
+
expect(smartSnippetAnswer.answer).toEqual(smartSnippetState.answer);
|
|
256
|
+
|
|
257
|
+
const smartSnippetSource = element.shadowRoot.querySelector(
|
|
258
|
+
selectors.smartSnippetSource
|
|
259
|
+
);
|
|
260
|
+
expect(smartSnippetSource).not.toBeNull();
|
|
261
|
+
expect(smartSnippetSource.source).toEqual(smartSnippetState.source);
|
|
262
|
+
|
|
263
|
+
const smartSnippetFeedback = element.shadowRoot.querySelector(
|
|
264
|
+
selectors.smartSnippetFeedback
|
|
265
|
+
);
|
|
266
|
+
expect(smartSnippetFeedback).not.toBeNull();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
describe('when the smart snippet exceeds the maximum height', () => {
|
|
270
|
+
describe('when the smart snippet is collapsed', () => {
|
|
271
|
+
it('should properly display the toggle button of the smart snippet component', async () => {
|
|
272
|
+
const expectedShowMoreLabel = 'Show more';
|
|
273
|
+
const expectedShowMoreIcon = 'utility:chevrondown';
|
|
274
|
+
const element = createTestComponent();
|
|
275
|
+
await flushPromises();
|
|
276
|
+
|
|
277
|
+
const smartSnippetToggleButton = element.shadowRoot.querySelector(
|
|
278
|
+
selectors.smartSnippetToggleButton
|
|
279
|
+
);
|
|
280
|
+
|
|
281
|
+
expect(smartSnippetToggleButton).not.toBeNull();
|
|
282
|
+
expect(smartSnippetToggleButton.label).toBe(expectedShowMoreLabel);
|
|
283
|
+
expect(smartSnippetToggleButton.iconName).toBe(expectedShowMoreIcon);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
describe('when clicking on the smart snippet toggle button', () => {
|
|
287
|
+
it('should call the expand method from the smartSnippet controller', async () => {
|
|
288
|
+
const element = createTestComponent();
|
|
289
|
+
await flushPromises();
|
|
290
|
+
|
|
291
|
+
const smartSnippetToggleButton = element.shadowRoot.querySelector(
|
|
292
|
+
selectors.smartSnippetToggleButton
|
|
293
|
+
);
|
|
294
|
+
expect(smartSnippetToggleButton).not.toBeNull();
|
|
295
|
+
|
|
296
|
+
await smartSnippetToggleButton.click();
|
|
297
|
+
await flushPromises();
|
|
298
|
+
|
|
299
|
+
expect(functionsMocks.expand).toHaveBeenCalledTimes(1);
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
describe('when the smart snippet is expanded', () => {
|
|
305
|
+
beforeEach(() => {
|
|
306
|
+
smartSnippetState = {...defaultSmartSnippetState, expanded: true};
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it('should properly display the smart snippet component', async () => {
|
|
310
|
+
const expectedShowLessLabel = 'Show less';
|
|
311
|
+
const expectedShowLessIcon = 'utility:chevronup';
|
|
312
|
+
const element = createTestComponent();
|
|
313
|
+
await flushPromises();
|
|
314
|
+
|
|
315
|
+
const smartSnippetToggleButton = element.shadowRoot.querySelector(
|
|
316
|
+
selectors.smartSnippetToggleButton
|
|
317
|
+
);
|
|
318
|
+
expect(smartSnippetToggleButton).not.toBeNull();
|
|
319
|
+
expect(smartSnippetToggleButton.label).toBe(expectedShowLessLabel);
|
|
320
|
+
expect(smartSnippetToggleButton.iconName).toBe(expectedShowLessIcon);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
describe('when clicking on the smart snippet toggle button', () => {
|
|
324
|
+
it('should call the collapse method from the smartSnippet controller', async () => {
|
|
325
|
+
const element = createTestComponent();
|
|
326
|
+
await flushPromises();
|
|
327
|
+
|
|
328
|
+
const smartSnippetToggleButton = element.shadowRoot.querySelector(
|
|
329
|
+
selectors.smartSnippetToggleButton
|
|
330
|
+
);
|
|
331
|
+
|
|
332
|
+
await smartSnippetToggleButton.click();
|
|
333
|
+
await flushPromises();
|
|
334
|
+
|
|
335
|
+
expect(functionsMocks.collapse).toHaveBeenCalledTimes(1);
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
});
|
|
341
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {QuestionAnswerData} from '../../../../../../playwright/page-object/searchObjectWithSmartSnippet';
|
|
2
|
+
|
|
3
|
+
const exampleQuestion = 'Where was Gondor when the Westfold fell?';
|
|
4
|
+
const exampleAnswerSnippet = `<a href="#">Gondor</a> was on the brink of destruction when the Westfold fell. Gondor did not come to Rohan's aid when the Westfold fell because it was overwhelmed by its own dire circumstances and unable to spare resources or manpower. The alliance between the two kingdoms, forged by the Oath of Eorl, was based on a promise of mutual defense in times of extreme need. However, by the time of the War of the Ring, Gondor was facing unprecedented threats from Sauron, whose forces in Mordor were massing for a full-scale assault on Minas Tirith. The Steward of Gondor, Denethor II, was deeply concerned about the security of his own kingdom and could not afford to weaken its defenses to send aid across the vast distances that separated Gondor from the Westfold. Even if assistance had been feasible, the logistical challenge of moving troops through potentially hostile territory would have delayed their arrival, rendering their efforts ineffective. Moreover, the threat to Rohan came not only from Sauron's influence but also from the unexpected betrayal of Saruman, who, until then, had been perceived as an ally. His treachery, combined with the swiftness and brutality of his attacks, left Rohan vulnerable and isolated, as neither Rohan nor Gondor had anticipated such aggression from Isengard. While the alliance between the two realms remained strong in spirit, Gondor's immediate need to safeguard its own survival against the growing shadow of Mordor took precedence, leaving Rohan to fend for itself during the fall of the Westfold.`;
|
|
5
|
+
const exampleScore = 0.42;
|
|
6
|
+
const exampleContentIdKey = 'permanentid';
|
|
7
|
+
const mockPermanentId = '1234';
|
|
8
|
+
const exampleContentIdValue = mockPermanentId;
|
|
9
|
+
|
|
10
|
+
const smartSnippetData: QuestionAnswerData = {
|
|
11
|
+
answerFound: true,
|
|
12
|
+
question: exampleQuestion,
|
|
13
|
+
answerSnippet: exampleAnswerSnippet,
|
|
14
|
+
documentId: {
|
|
15
|
+
contentIdKey: exampleContentIdKey,
|
|
16
|
+
contentIdValue: exampleContentIdValue,
|
|
17
|
+
},
|
|
18
|
+
score: exampleScore,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export default smartSnippetData;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import {SmartSnippetObject} from './pageObject';
|
|
2
|
+
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
|
|
3
|
+
import {
|
|
4
|
+
SearchObjectWithSmartSnippet,
|
|
5
|
+
QuestionAnswerData,
|
|
6
|
+
} from '../../../../../../playwright/page-object/searchObjectWithSmartSnippet';
|
|
7
|
+
import {
|
|
8
|
+
searchRequestRegex,
|
|
9
|
+
insightSearchRequestRegex,
|
|
10
|
+
} from '../../../../../../playwright/utils/requests';
|
|
11
|
+
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
|
|
12
|
+
import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
|
|
13
|
+
import smartSnippetData from './data';
|
|
14
|
+
|
|
15
|
+
const pageUrl = 's/quantic-smart-snippet';
|
|
16
|
+
|
|
17
|
+
interface SmartSnippetOptions {
|
|
18
|
+
maximumSnippetHeight: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type QuanticSmartSnippetE2ESearchFixtures = {
|
|
22
|
+
smartSnippetData: QuestionAnswerData;
|
|
23
|
+
smartSnippet: SmartSnippetObject;
|
|
24
|
+
search: SearchObjectWithSmartSnippet;
|
|
25
|
+
options: Partial<SmartSnippetOptions>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
type QuanticSmartSnippetE2EInsightFixtures =
|
|
29
|
+
QuanticSmartSnippetE2ESearchFixtures & {
|
|
30
|
+
insightSetup: InsightSetupObject;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const testSearch =
|
|
34
|
+
quanticBase.extend<QuanticSmartSnippetE2ESearchFixtures>({
|
|
35
|
+
smartSnippetData,
|
|
36
|
+
options: {},
|
|
37
|
+
search: async ({page}, use) => {
|
|
38
|
+
await use(new SearchObjectWithSmartSnippet(page, searchRequestRegex));
|
|
39
|
+
},
|
|
40
|
+
smartSnippet: async (
|
|
41
|
+
{page, options, configuration, search, smartSnippetData: data},
|
|
42
|
+
use
|
|
43
|
+
) => {
|
|
44
|
+
const smartSnippetObject = new SmartSnippetObject(page);
|
|
45
|
+
|
|
46
|
+
await page.goto(pageUrl);
|
|
47
|
+
await search.mockSearchWithSmartSnippetResponse(data);
|
|
48
|
+
|
|
49
|
+
configuration.configure(options);
|
|
50
|
+
await search.waitForSearchResponse();
|
|
51
|
+
await use(smartSnippetObject);
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const testInsight =
|
|
56
|
+
quanticBase.extend<QuanticSmartSnippetE2EInsightFixtures>({
|
|
57
|
+
smartSnippetData,
|
|
58
|
+
options: {},
|
|
59
|
+
search: async ({page}, use) => {
|
|
60
|
+
await use(
|
|
61
|
+
new SearchObjectWithSmartSnippet(page, insightSearchRequestRegex)
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
insightSetup: async ({page}, use) => {
|
|
65
|
+
await use(new InsightSetupObject(page));
|
|
66
|
+
},
|
|
67
|
+
smartSnippet: async (
|
|
68
|
+
{
|
|
69
|
+
page,
|
|
70
|
+
options,
|
|
71
|
+
search,
|
|
72
|
+
configuration,
|
|
73
|
+
insightSetup,
|
|
74
|
+
smartSnippetData: data,
|
|
75
|
+
},
|
|
76
|
+
use
|
|
77
|
+
) => {
|
|
78
|
+
const smartSnippetObject = new SmartSnippetObject(page);
|
|
79
|
+
|
|
80
|
+
await page.goto(pageUrl);
|
|
81
|
+
await search.mockSearchWithSmartSnippetResponse(data);
|
|
82
|
+
|
|
83
|
+
configuration.configure({...options, useCase: useCaseEnum.insight});
|
|
84
|
+
await insightSetup.waitForInsightInterfaceInitialization();
|
|
85
|
+
await search.performSearch();
|
|
86
|
+
await search.waitForSearchResponse();
|
|
87
|
+
await use(smartSnippetObject);
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
export {expect} from '@playwright/test';
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type {Locator, Page, Request} from '@playwright/test';
|
|
2
|
+
import {
|
|
3
|
+
isUaClickEvent,
|
|
4
|
+
isUaCustomEvent,
|
|
5
|
+
} from '../../../../../../playwright/utils/requests';
|
|
6
|
+
|
|
7
|
+
export class SmartSnippetObject {
|
|
8
|
+
constructor(public page: Page) {
|
|
9
|
+
this.page = page;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get smartSnippet(): Locator {
|
|
13
|
+
return this.page.locator('c-quantic-smart-snippet');
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get smartSnippetSourceTitle(): Locator {
|
|
17
|
+
return this.page.getByTestId('smart-snippet__source-title');
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
get smartSnippetSourceUri(): Locator {
|
|
21
|
+
return this.page.getByTestId('smart-snippet__source-uri');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
get smartSnippetAnwerInlineLink(): Locator {
|
|
25
|
+
return this.page.locator('[data-testid="smart-snippet-answer"] > a');
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get smartSnippetToggleButton(): Locator {
|
|
29
|
+
return this.page.getByTestId('smart-snippet__toggle-button');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get likeButton(): Locator {
|
|
33
|
+
return this.page.getByTestId('feedback__like-button');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get dislikeButton(): Locator {
|
|
37
|
+
return this.page.getByTestId('feedback__dislike-button');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get explainWhyButton(): Locator {
|
|
41
|
+
return this.page.getByTestId('feedback__explain-why-button');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
get feedbackModalCancelButton(): Locator {
|
|
45
|
+
return this.page.getByTestId('feedback-modal-footer__cancel');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get feedbackModalDoneButton(): Locator {
|
|
49
|
+
return this.page.getByTestId('feedback-modal-footer__done');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
get firstFeedbackOptionLabel(): Locator {
|
|
53
|
+
const labelFirstOption = "Didn't answer my question at all";
|
|
54
|
+
return this.page.getByText(labelFirstOption);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get feedbackSubmitButton(): Locator {
|
|
58
|
+
return this.page.getByTestId('feedback-modal-footer__submit');
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
async clickToggleButton(): Promise<void> {
|
|
62
|
+
await this.smartSnippetToggleButton.click();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async clickOnSourceTitle(): Promise<void> {
|
|
66
|
+
await this.smartSnippetSourceTitle.click();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async clickOnSourceUri(): Promise<void> {
|
|
70
|
+
await this.smartSnippetSourceUri.click();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async clickOnFirstInlineLink(): Promise<void> {
|
|
74
|
+
await this.smartSnippetAnwerInlineLink.first().click();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async clickLikeButton(): Promise<void> {
|
|
78
|
+
await this.likeButton.click();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async clickDislikeButton(): Promise<void> {
|
|
82
|
+
await this.dislikeButton.click();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
async clickExplainWhyButton(): Promise<void> {
|
|
86
|
+
await this.explainWhyButton.click();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async clickFeedbackModalCancelButton(): Promise<void> {
|
|
90
|
+
await this.feedbackModalCancelButton.click();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async selectFirstFeedbackOptionLabel(): Promise<void> {
|
|
94
|
+
await this.firstFeedbackOptionLabel.click({force: true});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
async clickFeedbackSubmitButton(): Promise<void> {
|
|
98
|
+
await this.feedbackSubmitButton.click();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
async clickFeedbackModalDoneButton(): Promise<void> {
|
|
102
|
+
await this.feedbackModalDoneButton.click();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async waitForExpandSmartSnippetUaAnalytics(): Promise<Request> {
|
|
106
|
+
return this.waitForSmartSnippetCustomUaAnalytics('expandSmartSnippet');
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async waitForCollapseSmartSnippetUaAnalytics(): Promise<Request> {
|
|
110
|
+
return this.waitForSmartSnippetCustomUaAnalytics('collapseSmartSnippet');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
async waitForLikeSmartSnippetUaAnalytics(): Promise<Request> {
|
|
114
|
+
return this.waitForSmartSnippetCustomUaAnalytics('likeSmartSnippet');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
async waitForDislikeSmartSnippetUaAnalytics(): Promise<Request> {
|
|
118
|
+
return this.waitForSmartSnippetCustomUaAnalytics('dislikeSmartSnippet');
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
async waitForOpenFeedbackModalUaAnalytics(): Promise<Request> {
|
|
122
|
+
return this.waitForSmartSnippetCustomUaAnalytics(
|
|
123
|
+
'openSmartSnippetFeedbackModal'
|
|
124
|
+
);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async waitForCloseFeedbackModalUaAnalytics(): Promise<Request> {
|
|
128
|
+
return this.waitForSmartSnippetCustomUaAnalytics(
|
|
129
|
+
'closeSmartSnippetFeedbackModal'
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
async waitForFeedbackSubmitUaAnalytics(
|
|
134
|
+
expectedReason: string
|
|
135
|
+
): Promise<Request> {
|
|
136
|
+
return this.waitForSmartSnippetCustomUaAnalytics(
|
|
137
|
+
'sendSmartSnippetReason',
|
|
138
|
+
expectedReason
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
async waitForSmartSnippetSourceClickUaAnalytics(): Promise<Request> {
|
|
143
|
+
return this.waitForSmartSnippetClickUaAnalytics('openSmartSnippetSource');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
async waitForSmartSnippetInlineLinkClickUaAnalytics(): Promise<Request> {
|
|
147
|
+
return this.waitForSmartSnippetClickUaAnalytics(
|
|
148
|
+
'openSmartSnippetInlineLink'
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
async waitForSmartSnippetClickUaAnalytics(
|
|
153
|
+
actionCause: string
|
|
154
|
+
): Promise<Request> {
|
|
155
|
+
const uaRequest = this.page.waitForRequest((request) => {
|
|
156
|
+
if (isUaClickEvent(request)) {
|
|
157
|
+
const requestBody = request.postDataJSON?.();
|
|
158
|
+
const requestData = JSON.parse(requestBody.clickEvent);
|
|
159
|
+
|
|
160
|
+
const expectedFields: Record<string, any> = {
|
|
161
|
+
actionCause,
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
return requestData?.actionCause === expectedFields.actionCause;
|
|
165
|
+
}
|
|
166
|
+
return false;
|
|
167
|
+
});
|
|
168
|
+
return uaRequest;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
async waitForSmartSnippetCustomUaAnalytics(
|
|
172
|
+
eventValue: any,
|
|
173
|
+
reason?: string
|
|
174
|
+
): Promise<Request> {
|
|
175
|
+
const uaRequest = this.page.waitForRequest((request) => {
|
|
176
|
+
if (isUaCustomEvent(request)) {
|
|
177
|
+
const requestBody = request.postDataJSON?.();
|
|
178
|
+
const expectedFields: Record<string, any> = {
|
|
179
|
+
eventType: 'smartSnippet',
|
|
180
|
+
eventValue: eventValue,
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
const matchesExpectedFields = Object.keys(expectedFields).every(
|
|
184
|
+
(key) => requestBody?.[key] === expectedFields[key]
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const customData = requestBody?.customData;
|
|
188
|
+
const matchesReason = customData?.reason === reason;
|
|
189
|
+
|
|
190
|
+
return matchesExpectedFields && matchesReason;
|
|
191
|
+
}
|
|
192
|
+
return false;
|
|
193
|
+
});
|
|
194
|
+
return uaRequest;
|
|
195
|
+
}
|
|
196
|
+
}
|