@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,599 +0,0 @@
|
|
|
1
|
-
import type {Locator, Page, Request} from '@playwright/test';
|
|
2
|
-
import {
|
|
3
|
-
AnalyticsMode,
|
|
4
|
-
AnalyticsModeEnum,
|
|
5
|
-
} from '../../../../../../playwright/utils/analyticsMode';
|
|
6
|
-
import {AnalyticsObject} from '../../../../../../playwright/page-object/analytics';
|
|
7
|
-
import {isRgaEvaluationRequest} from '../../../../../../playwright/utils/requests';
|
|
8
|
-
import type {AgentMessage} from './agentData';
|
|
9
|
-
|
|
10
|
-
const minimumCitationTooltipDisplayDurationMs = 1500;
|
|
11
|
-
const removeUnknownFields = (object: Record<string, unknown>) => {
|
|
12
|
-
return Object.fromEntries(
|
|
13
|
-
Object.entries(object).filter(([, value]) => value !== 'unknown')
|
|
14
|
-
);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const selectors = {
|
|
18
|
-
addFacetsButton: 'c-action-add-facets button',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const facetElementsSelectors = {
|
|
22
|
-
timeframeFacet: {
|
|
23
|
-
component: 'c-quantic-timeframe-facet',
|
|
24
|
-
facetValueComponent: 'c-quantic-facet-value',
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export interface GeneratedAnswerObjectConfig {
|
|
29
|
-
answerApiEnabled?: boolean;
|
|
30
|
-
headAnswerRequestRegex?: RegExp;
|
|
31
|
-
agentFollowUpRequestRegex?: RegExp;
|
|
32
|
-
withFacets?: boolean;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export class GeneratedAnswerObject {
|
|
36
|
-
private analyticsMode: AnalyticsMode;
|
|
37
|
-
private answerApiEnabled: boolean;
|
|
38
|
-
private headAnswerRequestRegex?: RegExp;
|
|
39
|
-
private agentFollowUpRequestRegex?: RegExp;
|
|
40
|
-
private withFacets: boolean;
|
|
41
|
-
|
|
42
|
-
constructor(
|
|
43
|
-
private page: Page,
|
|
44
|
-
private streamId: string,
|
|
45
|
-
private analytics: AnalyticsObject,
|
|
46
|
-
config: GeneratedAnswerObjectConfig = {}
|
|
47
|
-
) {
|
|
48
|
-
this.page = page;
|
|
49
|
-
this.streamId = streamId;
|
|
50
|
-
this.analytics = analytics;
|
|
51
|
-
this.analyticsMode = this.analytics.analyticsMode;
|
|
52
|
-
this.answerApiEnabled = config.answerApiEnabled ?? false;
|
|
53
|
-
this.headAnswerRequestRegex = config.headAnswerRequestRegex;
|
|
54
|
-
this.agentFollowUpRequestRegex = config.agentFollowUpRequestRegex;
|
|
55
|
-
this.withFacets = config.withFacets ?? false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
get likeButton(): Locator {
|
|
59
|
-
return this.page.getByRole('button', {name: 'Like', exact: true});
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get dislikeButton(): Locator {
|
|
63
|
-
return this.page.getByRole('button', {name: 'Dislike', exact: true});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
get copyToClipboardButton(): Locator {
|
|
67
|
-
return this.page.getByRole('button', {name: 'Copy'});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
get toggleButton(): Locator {
|
|
71
|
-
return this.page.getByTestId('generated-answer__toggle-button');
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
get firstTimeframeFacet(): Locator {
|
|
75
|
-
return this.page
|
|
76
|
-
.locator(facetElementsSelectors.timeframeFacet.component)
|
|
77
|
-
.first();
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
get firstTimeframeFacetValue(): Promise<string | null> {
|
|
81
|
-
return this.firstTimeframeFacet
|
|
82
|
-
.locator(facetElementsSelectors.timeframeFacet.facetValueComponent)
|
|
83
|
-
.first()
|
|
84
|
-
.locator('.facet__value-text')
|
|
85
|
-
.textContent();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
get addFacetsButton(): Locator {
|
|
89
|
-
return this.page.locator(selectors.addFacetsButton);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async clickAddFacetsButton(): Promise<void> {
|
|
93
|
-
await this.addFacetsButton.click();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async clickFirstTimeframeFacetLink(): Promise<void> {
|
|
97
|
-
await this.firstTimeframeFacet.click();
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
questionContainer(questionId: string): Locator {
|
|
101
|
-
return this.page.getByTestId(questionId);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
answerOption(questionId: string, answerValue: string): Locator {
|
|
105
|
-
return this.questionContainer(questionId).locator('.slds-radio_button', {
|
|
106
|
-
hasText: new RegExp(`^${answerValue}$`),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
get feedbackDocumentUrlInput(): Locator {
|
|
111
|
-
return this.page.locator(
|
|
112
|
-
'.feedback-modal-qna__body input[name="documentUrl"]'
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
get feedbackDetailsInput(): Locator {
|
|
117
|
-
return this.page
|
|
118
|
-
.locator('.feedback-modal-qna__body [data-name="details"]')
|
|
119
|
-
.getByRole('textbox');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
get submitFeedbackButton(): Locator {
|
|
123
|
-
return this.page.getByRole('button', {name: /Send feedback/i});
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
get completeFeedbackButton(): Locator {
|
|
127
|
-
return this.page.getByRole('button', {name: /Done/i});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
get citationLink(): Locator {
|
|
131
|
-
return this.page
|
|
132
|
-
.getByTestId('generated-answer-body__citations')
|
|
133
|
-
.locator('.citation__link');
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
get showMoreButton(): Locator {
|
|
137
|
-
return this.page.getByTestId('generated-answer__answer-toggle');
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
get showPreviousAnswersButton(): Locator {
|
|
141
|
-
return this.page.getByTestId('show-previous-button');
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
get threadItems(): Locator {
|
|
145
|
-
return this.page.locator('c-quantic-thread-item');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
get threadItemTitleButton(): Locator {
|
|
149
|
-
return this.threadItems.getByTestId('thread-item-title-button');
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
get generatedAnswerBody(): Locator {
|
|
153
|
-
return this.page.locator('c-quantic-generated-answer-body');
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
async hoverOverCitation(index: number): Promise<void> {
|
|
157
|
-
// waiting 1000ms to allow the component to render completely, cause any re-rendering abort the hover action.
|
|
158
|
-
await this.page.waitForTimeout(1000);
|
|
159
|
-
await this.citationLink.nth(index).hover();
|
|
160
|
-
await this.page.waitForTimeout(minimumCitationTooltipDisplayDurationMs);
|
|
161
|
-
await this.page.mouse.move(0, 0);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
async clickOnCitation(index: number): Promise<void> {
|
|
165
|
-
await this.citationLink.nth(index).click();
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
async typeInFeedbackDocumentUrlInput(text: string): Promise<void> {
|
|
169
|
-
await this.feedbackDocumentUrlInput.fill(text);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
async typeInFeedbackDetailsInput(text: string): Promise<void> {
|
|
173
|
-
await this.feedbackDetailsInput.fill(text);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async clickSubmitFeedbackButton(): Promise<void> {
|
|
177
|
-
await this.submitFeedbackButton.click();
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
async clickCompleteFeedbackButton(): Promise<void> {
|
|
181
|
-
await this.completeFeedbackButton.click();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async fillFeedbackForm(answers: Record<string, string>): Promise<void> {
|
|
185
|
-
for (const [questionId, answerValue] of Object.entries(answers)) {
|
|
186
|
-
const option = this.answerOption(questionId, answerValue);
|
|
187
|
-
// eslint-disable-next-line no-await-in-loop
|
|
188
|
-
await option.click();
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
async clickLikeButton(): Promise<void> {
|
|
193
|
-
await this.likeButton.click();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
async clickNthLikeButton(answerIndex: number): Promise<void> {
|
|
197
|
-
await this.likeButton.nth(answerIndex).click();
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
async clickDislikeButton(): Promise<void> {
|
|
201
|
-
await this.dislikeButton.click();
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
async clickNthDislikeButton(answerIndex: number): Promise<void> {
|
|
205
|
-
await this.dislikeButton.nth(answerIndex).click();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
async clickCopyToClipboardButton(): Promise<void> {
|
|
209
|
-
await this.copyToClipboardButton.click();
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
async clickToggleButton(): Promise<void> {
|
|
213
|
-
await this.toggleButton.click();
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
async clickShowPreviousAnswersButton(): Promise<void> {
|
|
217
|
-
await this.showPreviousAnswersButton.click();
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
async clickNthThreadItem(index: number): Promise<void> {
|
|
221
|
-
await this.threadItemTitleButton.nth(index).click();
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
async waitForHeadAnswerRequest(): Promise<Request> {
|
|
225
|
-
if (!this.headAnswerRequestRegex) {
|
|
226
|
-
throw new Error('headAnswerRequestRegex is not configured');
|
|
227
|
-
}
|
|
228
|
-
return this.page.waitForRequest(this.headAnswerRequestRegex);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
async waitForAgentFollowUpRequest(): Promise<Request> {
|
|
232
|
-
if (!this.agentFollowUpRequestRegex) {
|
|
233
|
-
throw new Error('agentFollowUpRequestRegex is not configured');
|
|
234
|
-
}
|
|
235
|
-
return this.page.waitForRequest(this.agentFollowUpRequestRegex);
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
async waitForStreamEndAnalytics(): Promise<Request | boolean> {
|
|
239
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
240
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
241
|
-
{
|
|
242
|
-
eventType: 'generatedAnswer',
|
|
243
|
-
eventValue: 'generatedAnswerStreamEnd',
|
|
244
|
-
},
|
|
245
|
-
(event) =>
|
|
246
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId
|
|
247
|
-
);
|
|
248
|
-
}
|
|
249
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
250
|
-
'Rga.AnswerReceived',
|
|
251
|
-
(event) => event.answerGenerated === true
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
async waitForLikeGeneratedAnswerAnalytics(): Promise<Request> {
|
|
256
|
-
return this.waitForLikeGeneratedAnswerAnalyticsForId(this.streamId);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
async waitForLikeGeneratedAnswerAnalyticsForId(
|
|
260
|
-
answerId: string
|
|
261
|
-
): Promise<Request> {
|
|
262
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
263
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
264
|
-
{
|
|
265
|
-
eventType: 'generatedAnswer',
|
|
266
|
-
eventValue: 'likeGeneratedAnswer',
|
|
267
|
-
},
|
|
268
|
-
(event) =>
|
|
269
|
-
event?.customData?.generativeQuestionAnsweringId === answerId
|
|
270
|
-
);
|
|
271
|
-
}
|
|
272
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
273
|
-
'Rga.AnswerAction',
|
|
274
|
-
(event) => event.action === 'like'
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
async waitForDislikeGeneratedAnswerAnalytics(): Promise<Request> {
|
|
279
|
-
return this.waitForDislikeGeneratedAnswerAnalyticsForId(this.streamId);
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
async waitForDislikeGeneratedAnswerAnalyticsForId(
|
|
283
|
-
answerId: string
|
|
284
|
-
): Promise<Request> {
|
|
285
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
286
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
287
|
-
{
|
|
288
|
-
eventType: 'generatedAnswer',
|
|
289
|
-
eventValue: 'dislikeGeneratedAnswer',
|
|
290
|
-
},
|
|
291
|
-
(event) =>
|
|
292
|
-
event?.customData?.generativeQuestionAnsweringId === answerId
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
296
|
-
'Rga.AnswerAction',
|
|
297
|
-
(event) => event.action === 'dislike'
|
|
298
|
-
);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
async waitForCopyToClipboardAnalytics(): Promise<Request> {
|
|
302
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
303
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
304
|
-
{
|
|
305
|
-
eventType: 'generatedAnswer',
|
|
306
|
-
eventValue: 'generatedAnswerCopyToClipboard',
|
|
307
|
-
},
|
|
308
|
-
(event) =>
|
|
309
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
313
|
-
'Rga.AnswerAction',
|
|
314
|
-
(event) => event.action === 'copyToClipboard'
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
async waitForShowAnswersAnalytics(): Promise<Request> {
|
|
319
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
320
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
321
|
-
{
|
|
322
|
-
eventType: 'generatedAnswer',
|
|
323
|
-
eventValue: 'generatedAnswerShowAnswers',
|
|
324
|
-
},
|
|
325
|
-
(event) =>
|
|
326
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
330
|
-
'Rga.AnswerAction',
|
|
331
|
-
(event) => event.action === 'show'
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
async waitForHideAnswersAnalytics(): Promise<Request> {
|
|
336
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
337
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
338
|
-
{
|
|
339
|
-
eventType: 'generatedAnswer',
|
|
340
|
-
eventValue: 'generatedAnswerHideAnswers',
|
|
341
|
-
},
|
|
342
|
-
(event) =>
|
|
343
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
347
|
-
'Rga.AnswerAction',
|
|
348
|
-
(event) => event.action === 'hide'
|
|
349
|
-
);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
async waitForSourceHoverAnalytics(
|
|
353
|
-
expectedPayload: Record<string, any>
|
|
354
|
-
): Promise<Request> {
|
|
355
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
356
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
357
|
-
{
|
|
358
|
-
eventType: 'generatedAnswer',
|
|
359
|
-
eventValue: 'generatedAnswerSourceHover',
|
|
360
|
-
},
|
|
361
|
-
(event) =>
|
|
362
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId &&
|
|
363
|
-
Object.keys(expectedPayload).every(
|
|
364
|
-
(key) => event?.customData?.[key] === expectedPayload[key]
|
|
365
|
-
)
|
|
366
|
-
);
|
|
367
|
-
}
|
|
368
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
369
|
-
'Rga.CitationHover',
|
|
370
|
-
(event) =>
|
|
371
|
-
event.citationId === expectedPayload.citationId &&
|
|
372
|
-
event.itemMetadata?.uniqueFieldName === 'permanentid' &&
|
|
373
|
-
event.itemMetadata?.uniqueFieldValue === expectedPayload.permanentId
|
|
374
|
-
);
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
async waitForEvaluationsRequest(
|
|
378
|
-
expectedPayload: Record<string, any>
|
|
379
|
-
): Promise<Request> {
|
|
380
|
-
const payloadToMatch = removeUnknownFields(expectedPayload);
|
|
381
|
-
|
|
382
|
-
const evaluationRequest = this.page.waitForRequest((request) => {
|
|
383
|
-
const event = request.postDataJSON?.();
|
|
384
|
-
if (isRgaEvaluationRequest(request)) {
|
|
385
|
-
return AnalyticsObject.isMatchingPayload(
|
|
386
|
-
{
|
|
387
|
-
correctTopic: event.details?.correctTopic ? 'yes' : 'no',
|
|
388
|
-
readable: event.details?.readable ? 'yes' : 'no',
|
|
389
|
-
hallucinationFree: event.details?.hallucinationFree ? 'yes' : 'no',
|
|
390
|
-
documented: event.details?.documented ? 'yes' : 'no',
|
|
391
|
-
helpful: event.helpful,
|
|
392
|
-
details: event.additionalNotes,
|
|
393
|
-
documentUrl: event.correctAnswerUrl,
|
|
394
|
-
},
|
|
395
|
-
payloadToMatch
|
|
396
|
-
);
|
|
397
|
-
}
|
|
398
|
-
return false;
|
|
399
|
-
});
|
|
400
|
-
return evaluationRequest;
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
async waitForFeedbackSubmitRequest(
|
|
404
|
-
expectedPayload: Record<string, any>
|
|
405
|
-
): Promise<Request> {
|
|
406
|
-
if (this.answerApiEnabled) {
|
|
407
|
-
return this.waitForEvaluationsRequest(expectedPayload);
|
|
408
|
-
}
|
|
409
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
410
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
411
|
-
{
|
|
412
|
-
eventType: 'generatedAnswer',
|
|
413
|
-
eventValue: 'generatedAnswerFeedbackSubmitV2',
|
|
414
|
-
},
|
|
415
|
-
(event) =>
|
|
416
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId &&
|
|
417
|
-
Object.keys(expectedPayload).every(
|
|
418
|
-
(key) => event?.customData?.[key] === expectedPayload[key]
|
|
419
|
-
)
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const payloadToMatch = removeUnknownFields(expectedPayload);
|
|
424
|
-
|
|
425
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
426
|
-
'Rga.SubmitFeedback',
|
|
427
|
-
(event) =>
|
|
428
|
-
AnalyticsObject.isMatchingPayload(
|
|
429
|
-
{
|
|
430
|
-
correctTopic: event.details?.correctTopic ? 'yes' : 'no',
|
|
431
|
-
readable: event.details?.readable ? 'yes' : 'no',
|
|
432
|
-
hallucinationFree: event.details?.hallucinationFree ? 'yes' : 'no',
|
|
433
|
-
documented: event.details?.documented ? 'yes' : 'no',
|
|
434
|
-
helpful: event.helpful,
|
|
435
|
-
details: event.additionalNotes,
|
|
436
|
-
documentUrl: event.correctAnswerUrl,
|
|
437
|
-
},
|
|
438
|
-
payloadToMatch
|
|
439
|
-
)
|
|
440
|
-
);
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
async waitForCitationClickAnalytics(
|
|
444
|
-
expectedPayload: Record<string, any>
|
|
445
|
-
): Promise<Request> {
|
|
446
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
447
|
-
return this.analytics.waitForClickUaAnalytics(
|
|
448
|
-
'generatedAnswerCitationClick',
|
|
449
|
-
(event) =>
|
|
450
|
-
event?.customData?.generativeQuestionAnsweringId === this.streamId &&
|
|
451
|
-
AnalyticsObject.isMatchingPayload(
|
|
452
|
-
{
|
|
453
|
-
documentTitle: event.documentTitle,
|
|
454
|
-
sourceName: event.sourceName,
|
|
455
|
-
documentPosition: event.documentPosition,
|
|
456
|
-
documentUri: event.documentUri,
|
|
457
|
-
documentUrl: event.documentUrl,
|
|
458
|
-
citationId: event.customData?.citationId,
|
|
459
|
-
contentIDKey: event.customData?.documentId?.contentIdKey,
|
|
460
|
-
contentIDValue: event.customData?.documentId?.contentIdValue,
|
|
461
|
-
},
|
|
462
|
-
expectedPayload
|
|
463
|
-
)
|
|
464
|
-
);
|
|
465
|
-
}
|
|
466
|
-
const payloadToMatch = {
|
|
467
|
-
citationId: expectedPayload.citationId,
|
|
468
|
-
uniqueFieldName: expectedPayload.contentIDKey,
|
|
469
|
-
uniqueFieldValue: expectedPayload.contentIDValue,
|
|
470
|
-
title: expectedPayload.documentTitle,
|
|
471
|
-
url: expectedPayload.documentUrl,
|
|
472
|
-
};
|
|
473
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
474
|
-
'Rga.CitationClick',
|
|
475
|
-
(event) =>
|
|
476
|
-
AnalyticsObject.isMatchingPayload(
|
|
477
|
-
{
|
|
478
|
-
citationId: event.citationId,
|
|
479
|
-
uniqueFieldName: event.itemMetadata?.uniqueFieldName,
|
|
480
|
-
uniqueFieldValue: event.itemMetadata?.uniqueFieldValue,
|
|
481
|
-
title: event.itemMetadata?.title,
|
|
482
|
-
url: event.itemMetadata?.url,
|
|
483
|
-
},
|
|
484
|
-
payloadToMatch
|
|
485
|
-
)
|
|
486
|
-
);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
async mockStreamResponse(
|
|
490
|
-
url: string,
|
|
491
|
-
body: Array<{payloadType: string; payload: string; finishReason?: string}>,
|
|
492
|
-
answerId?: string
|
|
493
|
-
) {
|
|
494
|
-
await this.page.route(url, (route) => {
|
|
495
|
-
let bodyText = '';
|
|
496
|
-
body.forEach((data) => {
|
|
497
|
-
bodyText += `data: ${JSON.stringify(data)} \n\n`;
|
|
498
|
-
});
|
|
499
|
-
|
|
500
|
-
route.fulfill({
|
|
501
|
-
status: 200,
|
|
502
|
-
body: bodyText,
|
|
503
|
-
headers: {
|
|
504
|
-
'content-type': 'text/event-stream',
|
|
505
|
-
...(answerId && {
|
|
506
|
-
'access-control-expose-headers': 'X-Answer-Id',
|
|
507
|
-
'x-answer-id': answerId,
|
|
508
|
-
}),
|
|
509
|
-
},
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
async mockAgentAnswerResponse(
|
|
515
|
-
body: Array<AgentMessage>
|
|
516
|
-
) {
|
|
517
|
-
await this.page.route('**/agents/*/answer', (route) => {
|
|
518
|
-
let bodyText = '';
|
|
519
|
-
body.forEach((data) => {
|
|
520
|
-
bodyText += `data:${JSON.stringify(data)} \n\n`;
|
|
521
|
-
});
|
|
522
|
-
route.fulfill({
|
|
523
|
-
status: 200,
|
|
524
|
-
body: bodyText,
|
|
525
|
-
headers: {'content-type': 'text/event-stream'},
|
|
526
|
-
});
|
|
527
|
-
});
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
async mockAgentFollowUpResponse(
|
|
531
|
-
bodies: Array<Array<AgentMessage>>
|
|
532
|
-
) {
|
|
533
|
-
let callCount = 0;
|
|
534
|
-
await this.page.route('**/agents/*/follow-up', (route) => {
|
|
535
|
-
// After all provided response bodies are used, keep returning the last one
|
|
536
|
-
// so any additional intercepted follow-up requests still receive a mocked stream.
|
|
537
|
-
const streams = bodies[Math.min(callCount, bodies.length - 1)];
|
|
538
|
-
callCount++;
|
|
539
|
-
|
|
540
|
-
let bodyText = '';
|
|
541
|
-
streams.forEach((data) => {
|
|
542
|
-
bodyText += `data:${JSON.stringify(data)} \n\n`;
|
|
543
|
-
});
|
|
544
|
-
route.fulfill({
|
|
545
|
-
status: 200,
|
|
546
|
-
body: bodyText,
|
|
547
|
-
headers: {'content-type': 'text/event-stream'},
|
|
548
|
-
});
|
|
549
|
-
});
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
async mockAgentFollowUpNetworkError() {
|
|
553
|
-
await this.page.route('**/agents/*/follow-up', (route) => {
|
|
554
|
-
route.abort('connectionrefused');
|
|
555
|
-
});
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
get followUpInput(): Locator {
|
|
559
|
-
return this.page.locator(
|
|
560
|
-
'c-quantic-generated-answer-follow-up-input textarea'
|
|
561
|
-
);
|
|
562
|
-
}
|
|
563
|
-
|
|
564
|
-
get followUpSubmitButton(): Locator {
|
|
565
|
-
return this.page
|
|
566
|
-
.locator('c-quantic-generated-answer-follow-up-input')
|
|
567
|
-
.getByRole('button', {name: 'Submit follow-up'});
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
async typeFollowUpQuestion(question: string): Promise<void> {
|
|
571
|
-
await this.followUpInput.fill(question);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
async submitFollowUp(): Promise<void> {
|
|
575
|
-
await this.followUpSubmitButton.click();
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
async waitForFollowUpStreamEndAnalytics(
|
|
579
|
-
followUpAnswerId: string
|
|
580
|
-
): Promise<Request | boolean> {
|
|
581
|
-
if (this.analyticsMode === AnalyticsModeEnum.legacy) {
|
|
582
|
-
return this.analytics.waitForCustomUaAnalytics(
|
|
583
|
-
{
|
|
584
|
-
eventType: 'generatedAnswer',
|
|
585
|
-
eventValue: 'generatedAnswerStreamEnd',
|
|
586
|
-
},
|
|
587
|
-
(event) =>
|
|
588
|
-
event?.customData?.generativeQuestionAnsweringId === followUpAnswerId
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
return this.analytics.waitForEventProtocolAnalytics(
|
|
592
|
-
'Rga.AnswerReceived',
|
|
593
|
-
(event) => event.answerGenerated === true
|
|
594
|
-
);
|
|
595
|
-
}
|
|
596
|
-
|
|
597
|
-
streamEndAnalyticRequestPromise!: Promise<boolean | Request>;
|
|
598
|
-
generateRequestPromise!: Promise<Request>;
|
|
599
|
-
}
|