@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.
- package/force-app/main/default/classes/OrganizationEndpointsTest.cls +71 -15
- package/force-app/main/default/classes/RecommendationsControllerTest.cls +1 -1
- package/force-app/main/default/lwc/quanticTabBar/quanticTabBar.js +148 -125
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +16 -16
- package/package.json +33 -31
- package/force-app/main/default/lwc/quanticAriaLive/__tests__/quanticAriaLive.test.js +0 -106
- package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -752
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/data.ts +0 -130
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -87
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
- package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -208
- package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
- package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
- package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -1183
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/data.ts +0 -91
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/fixture.ts +0 -79
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticCategoryFacet/e2e/quanticCategoryFacet.e2e.ts +0 -219
- package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -581
- package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -688
- package/force-app/main/default/lwc/quanticDateFacet/e2e/data.ts +0 -44
- package/force-app/main/default/lwc/quanticDateFacet/e2e/fixture.ts +0 -72
- package/force-app/main/default/lwc/quanticDateFacet/e2e/pageObject.ts +0 -27
- package/force-app/main/default/lwc/quanticDateFacet/e2e/quanticDateFacet.e2e.ts +0 -167
- package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -348
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/data.ts +0 -48
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/fixture.ts +0 -84
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/pageObject.ts +0 -173
- package/force-app/main/default/lwc/quanticDidYouMean/e2e/quanticDidYouMean.e2e.ts +0 -219
- package/force-app/main/default/lwc/quanticDocumentSuggestion/__tests__/quanticDocumentSuggestion.test.js +0 -404
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/fixture.ts +0 -38
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/pageObject.ts +0 -52
- package/force-app/main/default/lwc/quanticDocumentSuggestion/e2e/quanticDocumentSuggestion.e2e.ts +0 -102
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -1105
- package/force-app/main/default/lwc/quanticFacet/e2e/data.ts +0 -62
- package/force-app/main/default/lwc/quanticFacet/e2e/fixture.ts +0 -78
- package/force-app/main/default/lwc/quanticFacet/e2e/pageObject.ts +0 -67
- package/force-app/main/default/lwc/quanticFacet/e2e/quanticFacet.e2e.ts +0 -242
- package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
- package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
- package/force-app/main/default/lwc/quanticFacetManager/e2e/data.ts +0 -59
- package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -75
- package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
- package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
- package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -403
- package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
- package/force-app/main/default/lwc/quanticFoldedResultList/__tests__/quanticFoldedResultList.test.js +0 -323
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/fixture.ts +0 -74
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/pageObject.ts +0 -81
- package/force-app/main/default/lwc/quanticFoldedResultList/e2e/quanticFoldedResultList.e2e.ts +0 -69
- package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -1575
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/agentData.ts +0 -279
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture-agent.ts +0 -77
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -194
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -599
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -333
- package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswerAgent.e2e.ts +0 -298
- package/force-app/main/default/lwc/quanticGeneratedAnswerBody/__tests__/quanticGeneratedAnswerBody.test.js +0 -418
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -447
- package/force-app/main/default/lwc/quanticGeneratedAnswerCopyToClipboard/__tests__/quanticGeneratedAnswerCopyToClipboard.test.js +0 -129
- package/force-app/main/default/lwc/quanticGeneratedAnswerFollowUpInput/__tests__/quanticGeneratedAnswerFollowUpInput.test.js +0 -466
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/quanticGeneratedAnswerStreamOfThought.test.js +0 -402
- package/force-app/main/default/lwc/quanticGeneratedAnswerStreamOfThought/__tests__/stepsUtils.test.js +0 -118
- package/force-app/main/default/lwc/quanticGeneratedAnswerThread/__tests__/quanticGeneratedAnswerThread.test.js +0 -285
- package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
- package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
- package/force-app/main/default/lwc/quanticInsightInterface/__tests__/quanticInsightInterface.test.js +0 -194
- package/force-app/main/default/lwc/quanticInsightSummary/__tests__/quanticInsightSummary.test.js +0 -230
- package/force-app/main/default/lwc/quanticModal/__tests__/quanticModal.test.js +0 -205
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -309
- package/force-app/main/default/lwc/quanticNotifications/e2e/fixture.ts +0 -62
- package/force-app/main/default/lwc/quanticNotifications/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticNotifications/e2e/quanticNotifications.e2e.ts +0 -47
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -953
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/data.ts +0 -48
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/fixture.ts +0 -75
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/pageObject.ts +0 -59
- package/force-app/main/default/lwc/quanticNumericFacet/e2e/quanticNumericFacet.e2e.ts +0 -186
- package/force-app/main/default/lwc/quanticPager/__tests__/quanticPager.test.js +0 -430
- package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -65
- package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
- package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -106
- package/force-app/main/default/lwc/quanticPlaceholder/__tests__/quanticPlaceholder.test.js +0 -47
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
- package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
- package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
- package/force-app/main/default/lwc/quanticRecentQueriesList/__tests__/quanticRecentQueriesList.test.js +0 -448
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/fixture.ts +0 -43
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/pageObject.ts +0 -55
- package/force-app/main/default/lwc/quanticRecentQueriesList/e2e/quanticRecentQueriesList.e2e.ts +0 -93
- package/force-app/main/default/lwc/quanticRecentResultsList/__tests__/quanticRecentResultsList.test.js +0 -516
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/fixture.ts +0 -43
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/pageObject.ts +0 -61
- package/force-app/main/default/lwc/quanticRecentResultsList/e2e/quanticRecentResultsList.e2e.ts +0 -48
- package/force-app/main/default/lwc/quanticRecommendationList/__tests__/quanticRecommendationList.test.js +0 -491
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/fixture.ts +0 -36
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/pageObject.ts +0 -52
- package/force-app/main/default/lwc/quanticRecommendationList/e2e/quanticRecommendationList.e2e.ts +0 -53
- package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -747
- package/force-app/main/default/lwc/quanticRefineToggle/__tests__/quanticRefineToggle.test.js +0 -544
- package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
- package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
- package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/__tests__/quanticResultCopyToClipboard.test.js +0 -300
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/fixture.ts +0 -49
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/pageObject.ts +0 -49
- package/force-app/main/default/lwc/quanticResultCopyToClipboard/e2e/quanticResultCopyToClipboard.e2e.ts +0 -40
- package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
- package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
- package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -302
- package/force-app/main/default/lwc/quanticResultList/__tests__/quanticResultList.test.js +0 -342
- package/force-app/main/default/lwc/quanticResultList/e2e/fixture.ts +0 -70
- package/force-app/main/default/lwc/quanticResultList/e2e/pageObject.ts +0 -81
- package/force-app/main/default/lwc/quanticResultList/e2e/quanticResultList.e2e.ts +0 -69
- package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
- package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
- package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
- package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -308
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/fixture.ts +0 -85
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/pageObject.ts +0 -38
- package/force-app/main/default/lwc/quanticResultQuickview/e2e/quanticResultQuickView.e2e.ts +0 -66
- package/force-app/main/default/lwc/quanticResultTemplate/__tests__/quanticResultTemplate.test.js +0 -90
- package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
- package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -464
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -78
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
- package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
- package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -487
- package/force-app/main/default/lwc/quanticSearchBox/e2e/fixture.ts +0 -86
- package/force-app/main/default/lwc/quanticSearchBox/e2e/pageObject.ts +0 -45
- package/force-app/main/default/lwc/quanticSearchBox/e2e/quanticSearchBox.e2e.ts +0 -159
- package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -743
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/__tests__/quanticSearchBoxSuggestionsList.test.js +0 -571
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/fixture.ts +0 -113
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/pageObject.ts +0 -113
- package/force-app/main/default/lwc/quanticSearchBoxSuggestionsList/e2e/quanticSearchBoxSuggestionsList.e2e.ts +0 -282
- package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -93
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
- package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
- package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
- package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -95
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
- package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
- package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
- package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -62
- package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -100
- package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -86
- package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -156
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -387
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/fixture.ts +0 -54
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/pageObject.ts +0 -54
- package/force-app/main/default/lwc/quanticStandaloneSearchBox/e2e/quanticStandaloneSearchBox.e2e.ts +0 -72
- package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
- package/force-app/main/default/lwc/quanticSummary/__tests__/quanticSummary.test.js +0 -244
- package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -333
- package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -60
- package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -68
- package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -72
- package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
- package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -65
- package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
- package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -172
- package/force-app/main/default/lwc/quanticThreadItem/__tests__/quanticThreadItem.test.js +0 -314
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -1059
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/data.ts +0 -66
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/fixture.ts +0 -74
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/pageObject.ts +0 -43
- package/force-app/main/default/lwc/quanticTimeframeFacet/e2e/quanticTimeframeFacet.e2e.ts +0 -184
- package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
- package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
- package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
- package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
- package/force-app/main/default/lwc/quanticUtils/__tests__/accessibilityUtils.test.js +0 -214
- package/force-app/main/default/lwc/quanticUtils/__tests__/citationAnchoringUtils.test.js +0 -84
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
- package/force-app/main/default/lwc/quanticUtils/__tests__/facetStoreUtils.test.js +0 -86
- package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -109
- package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -233
- package/force-app/main/default/lwc/quanticUtils/__tests__/timeAndDateUtils.test.js +0 -22
- package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import {testSearch, testInsight} from './fixture';
|
|
2
|
-
import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
|
|
3
|
-
import smartSnippetSuggestionsData from './data';
|
|
4
|
-
|
|
5
|
-
const fixtures = {
|
|
6
|
-
search: testSearch,
|
|
7
|
-
insight: testInsight,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
useCaseTestCases.forEach((useCase) => {
|
|
11
|
-
let test = fixtures[useCase.value];
|
|
12
|
-
|
|
13
|
-
test.describe(`quantic smart snippet suggestions ${useCase.label}`, () => {
|
|
14
|
-
test.use({
|
|
15
|
-
smartSnippetSuggestionsData,
|
|
16
|
-
});
|
|
17
|
-
test.describe('when expanding and collapsing the smart snippet suggestions', () => {
|
|
18
|
-
test('should send the expand and collapse analytics events', async ({
|
|
19
|
-
smartSnippetSuggestions,
|
|
20
|
-
}) => {
|
|
21
|
-
const smartSnippetSuggestionIndex = 0;
|
|
22
|
-
const {question, answerSnippet} =
|
|
23
|
-
smartSnippetSuggestionsData.relatedQuestions[
|
|
24
|
-
smartSnippetSuggestionIndex
|
|
25
|
-
];
|
|
26
|
-
const expandSmartSnippetSuggestionsPromise =
|
|
27
|
-
smartSnippetSuggestions.waitForExpandSmartSnippetSuggestionUaAnalytics(
|
|
28
|
-
{
|
|
29
|
-
question,
|
|
30
|
-
answerSnippet,
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionHeading(
|
|
35
|
-
smartSnippetSuggestionIndex
|
|
36
|
-
);
|
|
37
|
-
await expandSmartSnippetSuggestionsPromise;
|
|
38
|
-
|
|
39
|
-
const collapseSmartSnippetSuggestionsPromise =
|
|
40
|
-
smartSnippetSuggestions.waitForCollapseSmartSnippetSuggestionUaAnalytics(
|
|
41
|
-
{
|
|
42
|
-
question,
|
|
43
|
-
answerSnippet,
|
|
44
|
-
}
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionHeading(
|
|
48
|
-
smartSnippetSuggestionIndex
|
|
49
|
-
);
|
|
50
|
-
await collapseSmartSnippetSuggestionsPromise;
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test.describe('when clicking on elements of the smart snippet suggestion', () => {
|
|
55
|
-
test.beforeEach(async ({smartSnippetSuggestions}) => {
|
|
56
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionHeading(0);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('should send the source title analytics event when the title is clicked', async ({
|
|
60
|
-
smartSnippetSuggestions,
|
|
61
|
-
}) => {
|
|
62
|
-
const smartSnippetSuggestionIndex = 0;
|
|
63
|
-
const {question, answerSnippet} =
|
|
64
|
-
smartSnippetSuggestionsData.relatedQuestions[
|
|
65
|
-
smartSnippetSuggestionIndex
|
|
66
|
-
];
|
|
67
|
-
const smartSnippetSuggestionsTitleClickPromise =
|
|
68
|
-
smartSnippetSuggestions.waitForSmartSnippetSuggestionSourceClickUaAnalytics(
|
|
69
|
-
{
|
|
70
|
-
question,
|
|
71
|
-
answerSnippet,
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionSourceTitle(
|
|
76
|
-
smartSnippetSuggestionIndex
|
|
77
|
-
);
|
|
78
|
-
await smartSnippetSuggestionsTitleClickPromise;
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
test('should send the source uri analytics event when the uri is clicked', async ({
|
|
82
|
-
smartSnippetSuggestions,
|
|
83
|
-
}) => {
|
|
84
|
-
const smartSnippetSuggestionIndex = 0;
|
|
85
|
-
const {question, answerSnippet} =
|
|
86
|
-
smartSnippetSuggestionsData.relatedQuestions[
|
|
87
|
-
smartSnippetSuggestionIndex
|
|
88
|
-
];
|
|
89
|
-
|
|
90
|
-
const smartSnippetSuggestionsSourceUriClickPromise =
|
|
91
|
-
smartSnippetSuggestions.waitForSmartSnippetSuggestionSourceClickUaAnalytics(
|
|
92
|
-
{
|
|
93
|
-
question,
|
|
94
|
-
answerSnippet,
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionSourceUri(
|
|
99
|
-
smartSnippetSuggestionIndex
|
|
100
|
-
);
|
|
101
|
-
await smartSnippetSuggestionsSourceUriClickPromise;
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test('should send the inline link analytics event when an inline link is clicked', async ({
|
|
105
|
-
smartSnippetSuggestions,
|
|
106
|
-
}) => {
|
|
107
|
-
const smartSnippetSuggestionIndex = 0;
|
|
108
|
-
const {question, answerSnippet} =
|
|
109
|
-
smartSnippetSuggestionsData.relatedQuestions[
|
|
110
|
-
smartSnippetSuggestionIndex
|
|
111
|
-
];
|
|
112
|
-
const smartSnippetSuggestionsInlineLinkClickPromise =
|
|
113
|
-
smartSnippetSuggestions.waitForSmartSnippetSuggestionInlineLinkClickUaAnalytics(
|
|
114
|
-
{
|
|
115
|
-
question,
|
|
116
|
-
answerSnippet,
|
|
117
|
-
}
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
await smartSnippetSuggestions.clickOnSmartSnippetSuggestionInlineLink(
|
|
121
|
-
smartSnippetSuggestionIndex
|
|
122
|
-
);
|
|
123
|
-
await smartSnippetSuggestionsInlineLinkClickPromise;
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
});
|
|
@@ -1,416 +0,0 @@
|
|
|
1
|
-
/* eslint-disable jest/no-conditional-expect */
|
|
2
|
-
/* eslint-disable no-import-assign */
|
|
3
|
-
import QuanticSort from 'c/quanticSort';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import {createElement} from 'lwc';
|
|
6
|
-
import * as mockHeadlessLoader from 'c/quanticHeadlessLoader';
|
|
7
|
-
|
|
8
|
-
const selectors = {
|
|
9
|
-
lightningCombobox: 'lightning-combobox',
|
|
10
|
-
componentError: 'c-quantic-component-error',
|
|
11
|
-
sortDropdown: '[data-testid="sort-dropdown"]',
|
|
12
|
-
initializationError: 'c-quantic-component-error',
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const sortVariants = {
|
|
16
|
-
default: {
|
|
17
|
-
name: 'default',
|
|
18
|
-
labelContainerSelector: '.sort__header',
|
|
19
|
-
labelSelector: 'lightning-formatted-text',
|
|
20
|
-
dropdownContainerSelector: '.sort__container',
|
|
21
|
-
},
|
|
22
|
-
wide: {
|
|
23
|
-
name: 'wide',
|
|
24
|
-
labelContainerSelector: '.sort__container',
|
|
25
|
-
labelSelector: '[data-testid="filters-title"]',
|
|
26
|
-
dropdownContainerSelector: 'lightning-layout-item',
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
const sortByLabel = 'Sort By';
|
|
31
|
-
|
|
32
|
-
jest.mock('c/quanticHeadlessLoader');
|
|
33
|
-
jest.mock(
|
|
34
|
-
'@salesforce/label/c.quantic_SortBy',
|
|
35
|
-
() => ({default: sortByLabel}),
|
|
36
|
-
{
|
|
37
|
-
virtual: true,
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
function mockBueno(shouldError = false) {
|
|
42
|
-
// @ts-ignore
|
|
43
|
-
mockHeadlessLoader.getBueno = () => {
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
global.Bueno = {
|
|
46
|
-
isString: jest
|
|
47
|
-
.fn()
|
|
48
|
-
.mockImplementation(
|
|
49
|
-
(value) => Object.prototype.toString.call(value) === '[object String]'
|
|
50
|
-
),
|
|
51
|
-
StringValue: jest.fn(),
|
|
52
|
-
RecordValue: jest.fn(),
|
|
53
|
-
Schema: jest.fn(() => ({
|
|
54
|
-
validate: () => {
|
|
55
|
-
if (shouldError) {
|
|
56
|
-
throw new Error();
|
|
57
|
-
}
|
|
58
|
-
jest.fn();
|
|
59
|
-
},
|
|
60
|
-
})),
|
|
61
|
-
};
|
|
62
|
-
return new Promise((resolve) => resolve());
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
let isInitialized = false;
|
|
67
|
-
|
|
68
|
-
const exampleEngine = {
|
|
69
|
-
id: 'exampleEngineId',
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
const defaultSearchStatusState = {
|
|
73
|
-
hasResults: true,
|
|
74
|
-
};
|
|
75
|
-
let searchStatusState = defaultSearchStatusState;
|
|
76
|
-
|
|
77
|
-
const functionsMocks = {
|
|
78
|
-
buildSort: jest.fn(() => ({
|
|
79
|
-
state: {},
|
|
80
|
-
subscribe: functionsMocks.sortStateSubscriber,
|
|
81
|
-
sortBy: functionsMocks.sortBy,
|
|
82
|
-
})),
|
|
83
|
-
buildSearchStatus: jest.fn(() => ({
|
|
84
|
-
state: searchStatusState,
|
|
85
|
-
subscribe: functionsMocks.searchStatusStateSubscriber,
|
|
86
|
-
})),
|
|
87
|
-
buildCriterionExpression: jest.fn((criterion) => criterion),
|
|
88
|
-
buildRelevanceSortCriterion: jest.fn(() => 'relevance'),
|
|
89
|
-
buildDateSortCriterion: jest.fn(() => 'date'),
|
|
90
|
-
sortStateSubscriber: jest.fn((cb) => {
|
|
91
|
-
cb();
|
|
92
|
-
return functionsMocks.sortStateUnsubscriber;
|
|
93
|
-
}),
|
|
94
|
-
searchStatusStateSubscriber: jest.fn((cb) => {
|
|
95
|
-
cb();
|
|
96
|
-
return functionsMocks.searchStatusStateUnsubscriber;
|
|
97
|
-
}),
|
|
98
|
-
sortStateUnsubscriber: jest.fn(),
|
|
99
|
-
searchStatusStateUnsubscriber: jest.fn(),
|
|
100
|
-
sortBy: jest.fn(),
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const defaultOptions = {
|
|
104
|
-
engineId: exampleEngine.id,
|
|
105
|
-
variant: 'default',
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Mocks the return value of the assignedNodes method.
|
|
110
|
-
* @param {Array<Element>} assignedElements
|
|
111
|
-
*/
|
|
112
|
-
function mockSlotAssignedNodes(assignedElements) {
|
|
113
|
-
HTMLSlotElement.prototype.assignedNodes = function () {
|
|
114
|
-
return assignedElements;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function createTestComponent(options = defaultOptions, assignedElements = []) {
|
|
119
|
-
prepareHeadlessState();
|
|
120
|
-
mockSlotAssignedNodes(assignedElements);
|
|
121
|
-
|
|
122
|
-
const element = createElement('c-quantic-sort', {
|
|
123
|
-
is: QuanticSort,
|
|
124
|
-
});
|
|
125
|
-
for (const [key, value] of Object.entries(options)) {
|
|
126
|
-
element[key] = value;
|
|
127
|
-
}
|
|
128
|
-
document.body.appendChild(element);
|
|
129
|
-
return element;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
function prepareHeadlessState() {
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
mockHeadlessLoader.getHeadlessBundle = () => {
|
|
135
|
-
return {
|
|
136
|
-
buildSort: functionsMocks.buildSort,
|
|
137
|
-
buildCriterionExpression: functionsMocks.buildCriterionExpression,
|
|
138
|
-
buildSearchStatus: functionsMocks.buildSearchStatus,
|
|
139
|
-
buildRelevanceSortCriterion: functionsMocks.buildRelevanceSortCriterion,
|
|
140
|
-
buildDateSortCriterion: functionsMocks.buildDateSortCriterion,
|
|
141
|
-
SortOrder: {
|
|
142
|
-
Descending: 'descending',
|
|
143
|
-
Ascending: 'ascending',
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
// Helper function to wait until the microtask queue is empty.
|
|
150
|
-
function flushPromises() {
|
|
151
|
-
// eslint-disable-next-line @lwc/lwc/no-async-operation
|
|
152
|
-
return new Promise((resolve) => setTimeout(resolve, 0));
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
function mockSuccessfulHeadlessInitialization() {
|
|
156
|
-
// @ts-ignore
|
|
157
|
-
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
158
|
-
if (element instanceof QuanticSort && !isInitialized) {
|
|
159
|
-
isInitialized = true;
|
|
160
|
-
initialize(exampleEngine);
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function mockErroneousHeadlessInitialization() {
|
|
166
|
-
// @ts-ignore
|
|
167
|
-
mockHeadlessLoader.initializeWithHeadless = (element) => {
|
|
168
|
-
if (element instanceof QuanticSort) {
|
|
169
|
-
element.setInitializationError();
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function cleanup() {
|
|
175
|
-
// The jsdom instance is shared across test cases in a single file so reset the DOM
|
|
176
|
-
while (document.body.firstChild) {
|
|
177
|
-
document.body.removeChild(document.body.firstChild);
|
|
178
|
-
}
|
|
179
|
-
jest.clearAllMocks();
|
|
180
|
-
isInitialized = false;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
describe('c-quantic-sort', () => {
|
|
184
|
-
beforeEach(() => {
|
|
185
|
-
mockSuccessfulHeadlessInitialization();
|
|
186
|
-
mockBueno();
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
afterEach(() => {
|
|
190
|
-
cleanup();
|
|
191
|
-
searchStatusState = defaultSearchStatusState;
|
|
192
|
-
});
|
|
193
|
-
|
|
194
|
-
describe('when an initialization error occurs', () => {
|
|
195
|
-
beforeEach(() => {
|
|
196
|
-
mockErroneousHeadlessInitialization();
|
|
197
|
-
});
|
|
198
|
-
|
|
199
|
-
it('should display the initialization error component', async () => {
|
|
200
|
-
const element = createTestComponent();
|
|
201
|
-
await flushPromises();
|
|
202
|
-
|
|
203
|
-
const initializationError = element.shadowRoot.querySelector(
|
|
204
|
-
selectors.initializationError
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
expect(initializationError).not.toBeNull();
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe('controller initialization', () => {
|
|
212
|
-
it('should subscribe to the headless sort and search status state changes', async () => {
|
|
213
|
-
createTestComponent();
|
|
214
|
-
await flushPromises();
|
|
215
|
-
|
|
216
|
-
expect(functionsMocks.sortStateSubscriber).toHaveBeenCalledTimes(1);
|
|
217
|
-
expect(functionsMocks.searchStatusStateSubscriber).toHaveBeenCalledTimes(
|
|
218
|
-
1
|
|
219
|
-
);
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
describe('when no results are found', () => {
|
|
224
|
-
beforeAll(() => {
|
|
225
|
-
searchStatusState = {...defaultSearchStatusState, hasResults: false};
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
it('should not display the sort dropdown', async () => {
|
|
229
|
-
const element = createTestComponent();
|
|
230
|
-
await flushPromises();
|
|
231
|
-
|
|
232
|
-
const sortDropdown = element.shadowRoot.querySelector(
|
|
233
|
-
selectors.sortDropdown
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
expect(sortDropdown).toBeNull();
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
describe('when a sort option is selected', () => {
|
|
241
|
-
it('should call the sortBy method of the sort controller', async () => {
|
|
242
|
-
const element = createTestComponent();
|
|
243
|
-
await flushPromises();
|
|
244
|
-
|
|
245
|
-
const lightningCombobox = element.shadowRoot.querySelector(
|
|
246
|
-
selectors.lightningCombobox
|
|
247
|
-
);
|
|
248
|
-
const exampleDefaultSortOptionValue = 'relevance';
|
|
249
|
-
expect(lightningCombobox).not.toBeNull();
|
|
250
|
-
|
|
251
|
-
lightningCombobox.dispatchEvent(
|
|
252
|
-
new CustomEvent('change', {
|
|
253
|
-
detail: {value: exampleDefaultSortOptionValue},
|
|
254
|
-
})
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
expect(functionsMocks.sortBy).toHaveBeenCalledTimes(1);
|
|
258
|
-
expect(functionsMocks.sortBy).toHaveBeenCalledWith(
|
|
259
|
-
exampleDefaultSortOptionValue
|
|
260
|
-
);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
describe('when custom sort options are passed', () => {
|
|
265
|
-
const exampleSlot = {
|
|
266
|
-
value: 'example value',
|
|
267
|
-
label: 'example label',
|
|
268
|
-
criterion: {
|
|
269
|
-
by: 'example field',
|
|
270
|
-
order: 'example order',
|
|
271
|
-
},
|
|
272
|
-
};
|
|
273
|
-
const exampleAssignedElements = [exampleSlot];
|
|
274
|
-
|
|
275
|
-
it('should build the controller with the correct sort option and display the custom sort options', async () => {
|
|
276
|
-
const element = createTestComponent(
|
|
277
|
-
defaultOptions,
|
|
278
|
-
exampleAssignedElements
|
|
279
|
-
);
|
|
280
|
-
await flushPromises();
|
|
281
|
-
|
|
282
|
-
expect(functionsMocks.buildSort).toHaveBeenCalledTimes(1);
|
|
283
|
-
expect(functionsMocks.buildSort).toHaveBeenCalledWith(exampleEngine, {
|
|
284
|
-
initialState: {
|
|
285
|
-
criterion: {
|
|
286
|
-
by: 'example field',
|
|
287
|
-
order: 'example order',
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
|
-
});
|
|
291
|
-
const lightningCombobox = element.shadowRoot.querySelector(
|
|
292
|
-
selectors.lightningCombobox
|
|
293
|
-
);
|
|
294
|
-
|
|
295
|
-
expect(lightningCombobox.options).toEqual([exampleSlot]);
|
|
296
|
-
});
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
describe('when invalid sort options are passed', () => {
|
|
300
|
-
beforeEach(() => {
|
|
301
|
-
mockBueno(true);
|
|
302
|
-
jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
const invalidExampleSlot = {
|
|
306
|
-
value: 'example value',
|
|
307
|
-
label: '',
|
|
308
|
-
criterion: {
|
|
309
|
-
by: 'example field',
|
|
310
|
-
order: 'example order',
|
|
311
|
-
},
|
|
312
|
-
};
|
|
313
|
-
const exampleAssignedElements = [invalidExampleSlot];
|
|
314
|
-
|
|
315
|
-
it('should display the component error', async () => {
|
|
316
|
-
const element = createTestComponent(
|
|
317
|
-
defaultOptions,
|
|
318
|
-
exampleAssignedElements
|
|
319
|
-
);
|
|
320
|
-
await flushPromises();
|
|
321
|
-
|
|
322
|
-
expect(functionsMocks.buildSort).toHaveBeenCalledTimes(1);
|
|
323
|
-
expect(functionsMocks.buildSort).toHaveBeenCalledWith(exampleEngine, {
|
|
324
|
-
initialState: {
|
|
325
|
-
criterion: {
|
|
326
|
-
by: 'example field',
|
|
327
|
-
order: 'example order',
|
|
328
|
-
},
|
|
329
|
-
},
|
|
330
|
-
});
|
|
331
|
-
const componentError = element.shadowRoot.querySelector(
|
|
332
|
-
selectors.componentError
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
expect(componentError).not.toBeNull();
|
|
336
|
-
expect(console.error).toHaveBeenCalledTimes(1);
|
|
337
|
-
});
|
|
338
|
-
});
|
|
339
|
-
|
|
340
|
-
describe('when passing the "default" variant', () => {
|
|
341
|
-
const variant = sortVariants.default;
|
|
342
|
-
|
|
343
|
-
it('should render the component with the default width', async () => {
|
|
344
|
-
const element = createTestComponent();
|
|
345
|
-
await flushPromises();
|
|
346
|
-
|
|
347
|
-
const defaultLabelContainer = element.shadowRoot.querySelector(
|
|
348
|
-
variant.labelContainerSelector
|
|
349
|
-
);
|
|
350
|
-
const defaultVariantDropdownContainer = element.shadowRoot.querySelector(
|
|
351
|
-
variant.dropdownContainerSelector
|
|
352
|
-
);
|
|
353
|
-
|
|
354
|
-
expect(defaultLabelContainer.classList).toContain(
|
|
355
|
-
'slds-var-p-right_small'
|
|
356
|
-
);
|
|
357
|
-
expect(defaultVariantDropdownContainer.classList).not.toContain(
|
|
358
|
-
'slds-size_1-of-1'
|
|
359
|
-
);
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
it('should properly render the label', async () => {
|
|
363
|
-
const element = createTestComponent({
|
|
364
|
-
...defaultOptions,
|
|
365
|
-
variant: variant.name,
|
|
366
|
-
});
|
|
367
|
-
await flushPromises();
|
|
368
|
-
|
|
369
|
-
const sortLabel = element.shadowRoot.querySelector(variant.labelSelector);
|
|
370
|
-
|
|
371
|
-
expect(sortLabel.value).toBe(sortByLabel);
|
|
372
|
-
});
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
describe('when passing the "wide" variant', () => {
|
|
376
|
-
const variant = sortVariants.wide;
|
|
377
|
-
|
|
378
|
-
it('should render the component with the wide width', async () => {
|
|
379
|
-
const element = createTestComponent({
|
|
380
|
-
...defaultOptions,
|
|
381
|
-
variant: variant.name,
|
|
382
|
-
});
|
|
383
|
-
await flushPromises();
|
|
384
|
-
|
|
385
|
-
const wideVariantLabelContainer = element.shadowRoot.querySelector(
|
|
386
|
-
variant.labelContainerSelector
|
|
387
|
-
);
|
|
388
|
-
const wideVariantDropdownContainer = element.shadowRoot.querySelector(
|
|
389
|
-
variant.dropdownContainerSelector
|
|
390
|
-
);
|
|
391
|
-
|
|
392
|
-
expect(wideVariantLabelContainer.classList).toContain(
|
|
393
|
-
'sort__container--wide'
|
|
394
|
-
);
|
|
395
|
-
expect(wideVariantDropdownContainer.classList).toContain(
|
|
396
|
-
'slds-size_1-of-1'
|
|
397
|
-
);
|
|
398
|
-
expect(wideVariantDropdownContainer.classList).not.toContain(
|
|
399
|
-
'slds-var-p-right_small'
|
|
400
|
-
);
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
it('should properly render the label', async () => {
|
|
404
|
-
const element = createTestComponent({
|
|
405
|
-
...defaultOptions,
|
|
406
|
-
variant: variant.name,
|
|
407
|
-
});
|
|
408
|
-
await flushPromises();
|
|
409
|
-
|
|
410
|
-
const sortLabel = element.shadowRoot.querySelector(variant.labelSelector);
|
|
411
|
-
|
|
412
|
-
expect(sortLabel.textContent).toBe(sortByLabel);
|
|
413
|
-
expect(sortLabel.classList).toContain('slds-text-heading_small');
|
|
414
|
-
});
|
|
415
|
-
});
|
|
416
|
-
});
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import {SortObject} from './pageObject';
|
|
2
|
-
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
|
|
3
|
-
import {SearchObject} from '../../../../../../playwright/page-object/searchObject';
|
|
4
|
-
import {
|
|
5
|
-
searchRequestRegex,
|
|
6
|
-
insightSearchRequestRegex,
|
|
7
|
-
} from '../../../../../../playwright/utils/requests';
|
|
8
|
-
import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
|
|
9
|
-
import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
|
|
10
|
-
|
|
11
|
-
const sortUrl = 's/quantic-sort';
|
|
12
|
-
|
|
13
|
-
interface SortOptions {}
|
|
14
|
-
|
|
15
|
-
type QuanticSortE2EFixtures = {
|
|
16
|
-
sort: SortObject;
|
|
17
|
-
search: SearchObject;
|
|
18
|
-
options: Partial<SortOptions>;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
type QuanticSortE2ESearchFixtures = QuanticSortE2EFixtures & {
|
|
22
|
-
urlHash: string;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
type QuanticSortE2EInsightFixtures = QuanticSortE2EFixtures & {
|
|
26
|
-
insightSetup: InsightSetupObject;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export const testSearch = quanticBase.extend<QuanticSortE2ESearchFixtures>({
|
|
30
|
-
options: {},
|
|
31
|
-
urlHash: '',
|
|
32
|
-
search: async ({page}, use) => {
|
|
33
|
-
await use(new SearchObject(page, searchRequestRegex));
|
|
34
|
-
},
|
|
35
|
-
sort: async ({page, options, configuration, search, urlHash}, use) => {
|
|
36
|
-
await search.mockSearchWithBaseResponse();
|
|
37
|
-
await page.goto(urlHash ? `${sortUrl}#${urlHash}` : sortUrl);
|
|
38
|
-
configuration.configure(options);
|
|
39
|
-
await search.waitForSearchResponse();
|
|
40
|
-
await use(new SortObject(page));
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
export const testInsight = quanticBase.extend<QuanticSortE2EInsightFixtures>({
|
|
45
|
-
options: {},
|
|
46
|
-
search: async ({page}, use) => {
|
|
47
|
-
await use(new SearchObject(page, insightSearchRequestRegex));
|
|
48
|
-
},
|
|
49
|
-
insightSetup: async ({page}, use) => {
|
|
50
|
-
await use(new InsightSetupObject(page));
|
|
51
|
-
},
|
|
52
|
-
sort: async ({page, options, search, configuration, insightSetup}, use) => {
|
|
53
|
-
await search.mockSearchWithBaseResponse();
|
|
54
|
-
await page.goto(sortUrl);
|
|
55
|
-
configuration.configure({...options, useCase: useCaseEnum.insight});
|
|
56
|
-
await insightSetup.waitForInsightInterfaceInitialization();
|
|
57
|
-
await Promise.all([search.waitForSearchResponse(), search.performSearch()]);
|
|
58
|
-
await use(new SortObject(page));
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
export {expect} from '@playwright/test';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import {expect, type Locator, type Page, type Request} from '@playwright/test';
|
|
2
|
-
import {isUaSearchEvent} from '../../../../../../playwright/utils/requests';
|
|
3
|
-
|
|
4
|
-
export class SortObject {
|
|
5
|
-
constructor(public page: Page) {
|
|
6
|
-
this.page = page;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
get sortDropDown(): Locator {
|
|
10
|
-
return this.page.getByRole('combobox', {name: 'Sort by'});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
sortButton(buttonName: string): Locator {
|
|
14
|
-
return this.page.getByRole('option', {name: buttonName});
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async clickSortDropDown(): Promise<void> {
|
|
18
|
-
await this.sortDropDown.click();
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async focusSortDropDown(): Promise<void> {
|
|
22
|
-
await this.sortDropDown.focus();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async clickSortButton(buttonName: string): Promise<void> {
|
|
26
|
-
await this.sortButton(buttonName).click();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async openSortDropdownUsingKeyboardEnter(useEnter = true): Promise<void> {
|
|
30
|
-
if (useEnter) {
|
|
31
|
-
await this.sortDropDown.press('Enter');
|
|
32
|
-
} else {
|
|
33
|
-
await this.sortDropDown.press('Space');
|
|
34
|
-
}
|
|
35
|
-
const overlay = this.page.locator('div[part="dropdown overlay"]');
|
|
36
|
-
await overlay.waitFor({state: 'visible'});
|
|
37
|
-
await overlay
|
|
38
|
-
.locator('[role="option"]')
|
|
39
|
-
.first()
|
|
40
|
-
.waitFor({state: 'visible'});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async selectNextSortOptionUsingKeyboard(
|
|
44
|
-
expectedLabel: string
|
|
45
|
-
): Promise<void> {
|
|
46
|
-
const previousDescendant =
|
|
47
|
-
await this.sortDropDown.getAttribute('aria-activedescendant');
|
|
48
|
-
await this.sortDropDown.press('ArrowDown');
|
|
49
|
-
await expect(this.sortDropDown).not.toHaveAttribute(
|
|
50
|
-
'aria-activedescendant',
|
|
51
|
-
previousDescendant ?? ''
|
|
52
|
-
);
|
|
53
|
-
await this.sortDropDown.press('Enter');
|
|
54
|
-
await expect(this.sortDropDown).toHaveText(expectedLabel);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async waitForSortUaAnalytics(eventValue: any): Promise<Request> {
|
|
58
|
-
const uaRequest = this.page.waitForRequest((request) => {
|
|
59
|
-
if (isUaSearchEvent(request)) {
|
|
60
|
-
const requestBody = request.postDataJSON();
|
|
61
|
-
const expectedFields = {
|
|
62
|
-
actionCause: 'resultsSort',
|
|
63
|
-
customData: {
|
|
64
|
-
resultsSortBy: eventValue,
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const validateObject = (obj: any, expectedResult: any): boolean =>
|
|
69
|
-
Object.entries(expectedResult).every(([key, value]) =>
|
|
70
|
-
value && typeof value === 'object'
|
|
71
|
-
? validateObject(obj?.[key], value)
|
|
72
|
-
: obj?.[key] === value
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
return validateObject(requestBody, expectedFields);
|
|
76
|
-
}
|
|
77
|
-
return false;
|
|
78
|
-
});
|
|
79
|
-
return uaRequest;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async getSortLabelValue(): Promise<{label: string; value: string | null}[]> {
|
|
83
|
-
const sortOptions = this.page.locator(
|
|
84
|
-
'div[part="dropdown overlay"] [role="option"]'
|
|
85
|
-
);
|
|
86
|
-
await sortOptions.first().waitFor({state: 'visible'});
|
|
87
|
-
|
|
88
|
-
return sortOptions.evaluateAll((options) =>
|
|
89
|
-
options.map((option) => ({
|
|
90
|
-
label: (
|
|
91
|
-
(option as HTMLElement).innerText ||
|
|
92
|
-
option.getAttribute('aria-label') ||
|
|
93
|
-
option.getAttribute('title') ||
|
|
94
|
-
''
|
|
95
|
-
).trim(),
|
|
96
|
-
value: option.getAttribute('data-value'),
|
|
97
|
-
}))
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
}
|