@coveo/quantic 3.44.0 → 3.44.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.
Files changed (205) hide show
  1. package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
  2. package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
  3. package/force-app/main/default/lwc/quanticNumberButton/quanticNumberButton.js +5 -1
  4. package/force-app/main/default/lwc/quanticPager/quanticPager.html +8 -5
  5. package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
  6. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  8. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  9. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  10. package/package.json +37 -34
  11. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  15. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  16. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  17. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  18. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  21. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  22. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  23. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  26. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  27. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  28. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  29. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  30. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  33. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  34. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  35. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  38. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  39. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  42. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  43. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  44. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  45. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  46. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  47. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  48. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  49. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  50. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  53. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  54. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  55. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  56. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  57. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  58. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  60. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  61. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  68. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  69. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  75. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  76. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  77. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  78. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  79. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  80. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  81. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  82. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  84. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  85. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  86. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  89. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  90. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  91. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  92. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  93. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  94. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  95. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  97. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  98. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  99. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  102. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  103. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  104. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  106. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  107. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  108. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  110. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  111. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  112. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  113. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  114. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  115. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  116. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  119. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  120. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  121. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  122. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  123. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  124. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  125. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  126. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  127. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  128. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  129. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  130. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  131. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  132. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  134. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  135. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  136. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  137. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  138. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  140. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  141. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  142. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  144. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  145. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  146. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  149. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  150. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  151. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  154. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  155. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  156. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  157. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  161. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  162. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  163. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  164. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  165. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  166. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  167. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  170. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  171. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  172. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  173. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  174. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  175. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  176. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  177. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  178. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  180. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  181. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  182. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  186. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  187. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  188. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  189. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  190. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  191. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  192. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  196. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  197. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  203. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  204. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  205. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,341 +0,0 @@
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
- });
@@ -1,21 +0,0 @@
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;
@@ -1,93 +0,0 @@
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 search.mockSearchWithSmartSnippetResponse(data);
47
- await page.goto(pageUrl);
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 search.mockSearchWithSmartSnippetResponse(data);
81
- await page.goto(pageUrl);
82
-
83
- configuration.configure({...options, useCase: useCaseEnum.insight});
84
- await insightSetup.waitForInsightInterfaceInitialization();
85
- await Promise.all([
86
- search.waitForSearchResponse(),
87
- search.performSearch(),
88
- ]);
89
- await use(smartSnippetObject);
90
- },
91
- });
92
-
93
- export {expect} from '@playwright/test';
@@ -1,196 +0,0 @@
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
- }