@coveo/quantic 3.44.1 → 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 (203) 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/quanticTabBar/quanticTabBar.js +148 -125
  4. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
  5. package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
  6. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
  7. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
  8. package/package.json +33 -31
  9. package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
  10. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
  11. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
  15. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  16. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  17. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  18. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  21. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
  22. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
  23. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
  24. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
  25. package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
  26. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
  27. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  28. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
  29. package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
  30. package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
  31. package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
  32. package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
  33. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
  34. package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
  35. package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
  36. package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
  37. package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
  38. package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
  39. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
  40. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
  41. package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
  42. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
  43. package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
  44. package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
  45. package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
  46. package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
  47. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  48. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  49. package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
  50. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
  51. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  52. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  53. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
  54. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  55. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  56. package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
  57. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
  58. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
  59. package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
  60. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
  61. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
  62. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  63. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
  64. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
  65. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
  66. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
  67. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
  68. package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
  69. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
  70. package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
  71. package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
  72. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
  73. package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
  74. package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
  75. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  76. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  77. package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
  78. package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
  79. package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
  80. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
  81. package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
  82. package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
  83. package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
  84. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
  85. package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
  86. package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
  87. package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
  88. package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
  89. package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
  90. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
  91. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  92. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
  93. package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
  94. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  95. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  96. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  97. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  98. package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
  99. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
  100. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
  101. package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
  102. package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
  103. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
  104. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
  105. package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
  106. package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
  107. package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
  108. package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
  109. package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
  110. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
  111. package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
  112. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  113. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  114. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  115. package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
  116. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
  117. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
  118. package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
  119. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  120. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  121. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  122. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
  123. package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
  124. package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
  125. package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
  126. package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
  127. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  128. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  129. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  130. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
  131. package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
  132. package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
  133. package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
  134. package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
  135. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  136. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
  137. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
  138. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  139. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  140. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
  141. package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
  142. package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
  143. package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
  144. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
  145. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
  146. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
  147. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
  148. package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
  149. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  150. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  151. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
  152. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  153. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  154. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  155. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  156. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  157. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  158. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
  159. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  160. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  161. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  162. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
  163. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
  164. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
  165. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
  166. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
  167. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
  168. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
  169. package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
  170. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  171. package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
  172. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
  173. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
  174. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
  175. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
  176. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  177. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
  178. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  179. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
  180. package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
  181. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
  182. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
  183. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
  184. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
  185. package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
  186. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  187. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  188. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  189. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  190. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  191. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  192. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  193. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  194. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  195. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  196. package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
  197. package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
  198. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  199. package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
  200. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
  201. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
  202. package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
  203. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,309 +0,0 @@
1
- /* eslint-disable no-import-assign */
2
- // @ts-ignore
3
- import QuanticNotifications from 'c/quanticNotifications';
4
- import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
5
- import {AriaLiveRegion} from 'c/quanticUtils';
6
- import {buildCreateTestComponent, cleanup, flushPromises} from 'c/testUtils';
7
-
8
- jest.mock('c/quanticHeadlessLoader');
9
- jest.mock('c/quanticUtils');
10
-
11
- const exampleNotifications = ['notification1', 'notification2'];
12
-
13
- let notificationsState = {
14
- notifications: exampleNotifications,
15
- };
16
- let isInitialized = false;
17
-
18
- const exampleEngine = {
19
- id: 'mock engine',
20
- };
21
-
22
- const mockSearchStatusState = {
23
- hasResults: true,
24
- hasError: false,
25
- };
26
-
27
- const functionsMocks = {
28
- buildNotifyTrigger: jest.fn(() => ({
29
- state: notificationsState,
30
- subscribe: functionsMocks.subscribe,
31
- })),
32
- dispatchMessage: jest.fn(() => {}),
33
- buildSearchStatus: jest.fn(() => ({
34
- state: mockSearchStatusState,
35
- subscribe: jest.fn((callback) => {
36
- functionsMocks.subscribe.callback = callback;
37
- return functionsMocks.unsubscribeSearchStatus;
38
- }),
39
- })),
40
- subscribe: jest.fn((callback) => {
41
- callback();
42
- return functionsMocks.unsubscribe;
43
- }),
44
- unsubscribe: jest.fn(() => {}),
45
- unsubscribeSearchStatus: jest.fn(() => {}),
46
- };
47
-
48
- // @ts-ignore
49
- AriaLiveRegion.mockImplementation(() => {
50
- return {
51
- dispatchMessage: functionsMocks.dispatchMessage,
52
- };
53
- });
54
-
55
- const selectors = {
56
- notifications: '[data-testid="notification"]',
57
- initializationError: 'c-quantic-component-error',
58
- notificationCloseButton: 'lightning-button-icon',
59
- };
60
-
61
- const defaultOptions = {
62
- engineId: 'exampleEngineId',
63
- };
64
-
65
- const createTestComponent = buildCreateTestComponent(
66
- QuanticNotifications,
67
- 'c-quantic-notifications',
68
- defaultOptions
69
- );
70
-
71
- function prepareHeadlessState() {
72
- // @ts-ignore
73
- mockHeadlessLoader.getHeadlessBundle = () => {
74
- return {
75
- buildNotifyTrigger: functionsMocks.buildNotifyTrigger,
76
- buildSearchStatus: functionsMocks.buildSearchStatus,
77
- };
78
- };
79
- }
80
-
81
- function mockSuccessfulHeadlessInitialization() {
82
- // @ts-ignore
83
- mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
84
- if (element instanceof QuanticNotifications && !isInitialized) {
85
- isInitialized = true;
86
- initialize(exampleEngine);
87
- }
88
- };
89
- }
90
-
91
- function mockErroneousHeadlessInitialization() {
92
- // @ts-ignore
93
- mockHeadlessLoader.initializeWithHeadless = (element) => {
94
- if (element instanceof QuanticNotifications) {
95
- element.setInitializationError();
96
- }
97
- };
98
- }
99
-
100
- describe('c-quantic-notifications', () => {
101
- beforeEach(() => {
102
- mockSuccessfulHeadlessInitialization();
103
- prepareHeadlessState();
104
- });
105
-
106
- afterEach(() => {
107
- cleanup();
108
- isInitialized = false;
109
- notificationsState = {
110
- notifications: exampleNotifications,
111
- };
112
- });
113
-
114
- describe('when an error occurs during initialization', () => {
115
- beforeEach(() => {
116
- mockErroneousHeadlessInitialization();
117
- });
118
-
119
- it('should display the initialization error component', async () => {
120
- const element = createTestComponent();
121
- await flushPromises();
122
-
123
- const initializationError = element.shadowRoot.querySelector(
124
- selectors.initializationError
125
- );
126
-
127
- const notification = element.shadowRoot.querySelector(
128
- selectors.notifications
129
- );
130
-
131
- expect(initializationError).not.toBeNull();
132
- expect(notification).toBeNull();
133
- });
134
- });
135
-
136
- describe('component initialization', () => {
137
- it('should build the notifyTrigger and searchStatus controllers with the proper parameters', async () => {
138
- createTestComponent();
139
- await flushPromises();
140
-
141
- expect(functionsMocks.buildNotifyTrigger).toHaveBeenCalledTimes(1);
142
- expect(functionsMocks.buildNotifyTrigger).toHaveBeenCalledWith(
143
- exampleEngine
144
- );
145
- expect(functionsMocks.buildSearchStatus).toHaveBeenCalledTimes(1);
146
- expect(functionsMocks.buildSearchStatus).toHaveBeenCalledWith(
147
- exampleEngine
148
- );
149
- });
150
-
151
- it('should subscribe to the headless notify trigger state changes', async () => {
152
- createTestComponent();
153
- await flushPromises();
154
-
155
- expect(functionsMocks.subscribe).toHaveBeenCalledTimes(1);
156
- });
157
-
158
- it('should call AriaLiveRegion with the right parameters', async () => {
159
- await createTestComponent();
160
- await flushPromises();
161
-
162
- expect(AriaLiveRegion).toHaveBeenCalledTimes(1);
163
- expect(AriaLiveRegion).toHaveBeenCalledWith(
164
- 'notifications',
165
- expect.anything()
166
- );
167
- });
168
- });
169
-
170
- describe('when the component is initialized successfully', () => {
171
- describe('when some notifications are present in the state', () => {
172
- it('should render the notifications component', async () => {
173
- const element = createTestComponent();
174
- await flushPromises();
175
-
176
- const notifications = element.shadowRoot.querySelectorAll(
177
- selectors.notifications
178
- );
179
-
180
- expect(notifications).not.toBeNull();
181
- expect(notifications.length).toBe(exampleNotifications.length);
182
- notifications.forEach((notification, index) => {
183
- expect(notification.textContent).toEqual(exampleNotifications[index]);
184
- });
185
- });
186
-
187
- it('should call dispatchMessage with the correct message', async () => {
188
- await createTestComponent();
189
- await flushPromises();
190
-
191
- const expectedMessage =
192
- ' Notification 1: notification1 Notification 2: notification2';
193
-
194
- expect(functionsMocks.dispatchMessage).toHaveBeenCalledTimes(1);
195
- expect(functionsMocks.dispatchMessage).toHaveBeenCalledWith(
196
- expectedMessage
197
- );
198
- });
199
- });
200
-
201
- describe('when no notifications are present in the state', () => {
202
- beforeEach(() => {
203
- notificationsState = {
204
- notifications: [],
205
- };
206
- });
207
-
208
- it('should not render the notifications component', async () => {
209
- const element = createTestComponent();
210
- await flushPromises();
211
-
212
- const notifications = element.shadowRoot.querySelectorAll(
213
- selectors.notifications
214
- );
215
-
216
- expect(notifications.length).toEqual(0);
217
- });
218
- });
219
-
220
- describe('when there is an error following a search', () => {
221
- it('should not render the notifications component', async () => {
222
- const element = createTestComponent();
223
- mockSearchStatusState.hasError = true;
224
- functionsMocks.subscribe.callback();
225
- await flushPromises();
226
-
227
- const notifications = element.shadowRoot.querySelectorAll(
228
- selectors.notifications
229
- );
230
-
231
- expect(notifications.length).toEqual(0);
232
- });
233
- });
234
- });
235
-
236
- describe('when clicking on a notification close button', () => {
237
- it('should properly dismiss that notification', async () => {
238
- const element = createTestComponent();
239
- await flushPromises();
240
-
241
- const notificationsBeforeClose = element.shadowRoot.querySelectorAll(
242
- selectors.notifications
243
- );
244
-
245
- const firstNotificationCloseButton =
246
- notificationsBeforeClose[0].querySelector(
247
- selectors.notificationCloseButton
248
- );
249
- firstNotificationCloseButton.click();
250
- await flushPromises();
251
-
252
- const notificationsAfterClose = element.shadowRoot.querySelectorAll(
253
- selectors.notifications
254
- );
255
-
256
- expect(notificationsAfterClose.length).toEqual(
257
- exampleNotifications.length - 1
258
- );
259
- expect(notificationsAfterClose[0].textContent).toEqual(
260
- exampleNotifications[1]
261
- );
262
- });
263
-
264
- describe('when triggering another search with the same query', () => {
265
- it('should reset the visibility of the notifications', async () => {
266
- const element = createTestComponent();
267
- await flushPromises();
268
-
269
- const notificationsBeforeClose = element.shadowRoot.querySelectorAll(
270
- selectors.notifications
271
- );
272
-
273
- expect(notificationsBeforeClose.length).toEqual(
274
- exampleNotifications.length
275
- );
276
-
277
- const firstNotificationCloseButton =
278
- notificationsBeforeClose[0].querySelector(
279
- selectors.notificationCloseButton
280
- );
281
- firstNotificationCloseButton.click();
282
- await flushPromises();
283
-
284
- const notificationsAfterClose = element.shadowRoot.querySelectorAll(
285
- selectors.notifications
286
- );
287
-
288
- expect(notificationsAfterClose.length).toEqual(
289
- exampleNotifications.length - 1
290
- );
291
-
292
- mockSearchStatusState.hasError = false;
293
- functionsMocks.subscribe.callback();
294
- await flushPromises();
295
-
296
- const notificationsAfterSearch = element.shadowRoot.querySelectorAll(
297
- selectors.notifications
298
- );
299
-
300
- expect(notificationsAfterSearch.length).toEqual(
301
- exampleNotifications.length
302
- );
303
- notificationsAfterSearch.forEach((notification, index) => {
304
- expect(notification.textContent).toEqual(exampleNotifications[index]);
305
- });
306
- });
307
- });
308
- });
309
- });
@@ -1,62 +0,0 @@
1
- import {NotificationsObject} from './pageObject';
2
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
3
- import {
4
- insightSearchRequestRegex,
5
- searchRequestRegex,
6
- } from '../../../../../../playwright/utils/requests';
7
- import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
8
-
9
- import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
10
- import {SearchObjectWithNotifyTrigger} from '../../../../../../playwright/page-object/searchObjectWithNotificationsTriggers';
11
-
12
- const pageUrl = 's/quantic-notifications';
13
-
14
- type QuanticNotificationsE2ESearchFixtures = {
15
- notifications: NotificationsObject;
16
- search: SearchObjectWithNotifyTrigger;
17
- };
18
-
19
- type QuanticNotificationsE2EInsightFixtures =
20
- QuanticNotificationsE2ESearchFixtures & {
21
- insightSetup: InsightSetupObject;
22
- };
23
-
24
- export const testSearch =
25
- quanticBase.extend<QuanticNotificationsE2ESearchFixtures>({
26
- search: async ({page}, use) => {
27
- await use(new SearchObjectWithNotifyTrigger(page, searchRequestRegex));
28
- },
29
- notifications: async ({page, configuration, search}, use) => {
30
- await search.mockSearchWithBaseResponse();
31
- await page.goto(pageUrl);
32
- configuration.configure();
33
- await search.waitForSearchResponse();
34
- await use(new NotificationsObject(page));
35
- },
36
- });
37
-
38
- export const testInsight =
39
- quanticBase.extend<QuanticNotificationsE2EInsightFixtures>({
40
- notificationsMessages: [],
41
- search: async ({page}, use) => {
42
- await use(
43
- new SearchObjectWithNotifyTrigger(page, insightSearchRequestRegex)
44
- );
45
- },
46
- insightSetup: async ({page}, use) => {
47
- await use(new InsightSetupObject(page));
48
- },
49
- notifications: async ({page, search, configuration, insightSetup}, use) => {
50
- await search.mockSearchWithBaseResponse();
51
- await page.goto(pageUrl);
52
- configuration.configure({useCase: useCaseEnum.insight});
53
- await insightSetup.waitForInsightInterfaceInitialization();
54
- await Promise.all([
55
- search.waitForSearchResponse(),
56
- search.performSearch(),
57
- ]);
58
- await use(new NotificationsObject(page));
59
- },
60
- });
61
-
62
- export {expect} from '@playwright/test';
@@ -1,55 +0,0 @@
1
- import type {Locator, Page, Request} from '@playwright/test';
2
- import {isUaCustomEvent} from '../../../../../../playwright/utils/requests';
3
-
4
- export class NotificationsObject {
5
- constructor(public page: Page) {
6
- this.page = page;
7
- }
8
-
9
- get notifications(): Promise<Array<Locator>> {
10
- return this.page.getByTestId('notification').all();
11
- }
12
-
13
- getNotification(index: number): Locator {
14
- return this.page.getByTestId('notification').nth(index);
15
- }
16
-
17
- async waitForNotifyTriggerCustomAnalytics(
18
- expectedNotifications?: string[]
19
- ): Promise<Request> {
20
- return this.waitForCustomUARequest(
21
- 'queryPipelineTriggers',
22
- 'notify',
23
- expectedNotifications
24
- );
25
- }
26
-
27
- async waitForCustomUARequest(
28
- eventType: string,
29
- eventValue: string,
30
- expectedNotifications?: string[]
31
- ): Promise<Request> {
32
- const uaRequest = this.page.waitForRequest((request) => {
33
- if (isUaCustomEvent(request)) {
34
- const requestBody = request.postDataJSON?.();
35
- const {customData} = requestBody;
36
- const expectedFields: Record<string, any> = {
37
- eventType,
38
- eventValue,
39
- };
40
- const matchesExpectedFields = Object.keys(expectedFields).every(
41
- (key) => requestBody?.[key] === expectedFields[key]
42
- );
43
- const matchesNotifications = Array.isArray(expectedNotifications)
44
- ? expectedNotifications.every((notification) =>
45
- customData?.notifications?.includes(notification)
46
- )
47
- : true;
48
-
49
- return matchesExpectedFields && matchesNotifications;
50
- }
51
- return false;
52
- });
53
- return uaRequest;
54
- }
55
- }
@@ -1,47 +0,0 @@
1
- import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
2
- import {testInsight, testSearch, expect} from './fixture';
3
-
4
- const fixtures = {
5
- search: testSearch,
6
- insight: testInsight,
7
- };
8
-
9
- useCaseTestCases.forEach((useCase) => {
10
- let test = fixtures[useCase.value];
11
-
12
- test.describe(`quantic notifications trigger ${useCase.label}`, () => {
13
- test.describe('when we have a notifications trigger', () => {
14
- test('should display the notifications trigger component and send the analytics', async ({
15
- notifications,
16
- search,
17
- }) => {
18
- const notificationsMessages = ['Notification 1'];
19
-
20
- await search.mockSearchWithNotifyTriggerResponse(notificationsMessages);
21
- const expectedUaRequest =
22
- notifications.waitForNotifyTriggerCustomAnalytics(
23
- notificationsMessages
24
- );
25
- await search.triggerSearchWithInput(notificationsMessages[0]);
26
- await expectedUaRequest;
27
-
28
- expect((await notifications.notifications).length).toBe(1);
29
- const firstNotification = notifications.getNotification(0);
30
- await expect(firstNotification).toContainText(notificationsMessages[0]);
31
- });
32
- });
33
-
34
- test.describe('without a notifications trigger', () => {
35
- test('should not display the notifications trigger component', async ({
36
- notifications,
37
- search,
38
- }) => {
39
- await search.triggerSearchWithInput('');
40
-
41
- expect((await notifications.notifications).length).toBe(0);
42
- const firstNotification = notifications.getNotification(0);
43
- await expect(firstNotification).not.toBeVisible();
44
- });
45
- });
46
- });
47
- });