@coveo/quantic 3.16.0 → 3.16.1-pre.9c01cf606f

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 (109) hide show
  1. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  2. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  3. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  4. package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
  5. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
  6. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  7. package/package.json +5 -3
  8. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -604
  9. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -76
  10. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  11. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -167
  12. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  13. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  14. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  15. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  16. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  17. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  18. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -327
  19. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -269
  20. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  21. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -321
  22. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -199
  23. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -341
  24. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  25. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  26. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -63
  27. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  28. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  29. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -392
  30. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  31. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  32. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -814
  33. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  34. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -87
  35. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -283
  36. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -199
  37. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -151
  38. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  39. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  40. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -335
  41. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -343
  42. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -63
  43. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  44. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -101
  45. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  46. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  47. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  48. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  49. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -501
  50. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  51. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  52. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  53. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  54. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  55. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  56. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -261
  57. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  58. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  59. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  60. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -171
  61. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  62. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -404
  63. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -74
  64. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  65. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  66. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -168
  67. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -823
  68. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  69. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  70. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -91
  71. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  72. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  73. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  74. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  75. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  76. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  77. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -93
  78. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  79. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  80. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  81. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -61
  82. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -89
  83. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -91
  84. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -123
  85. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -186
  86. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  87. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -287
  88. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -62
  89. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -67
  90. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -77
  91. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  92. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -61
  93. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  94. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -173
  95. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -339
  96. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  97. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  98. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  99. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  100. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  101. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  102. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  103. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  104. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  105. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  106. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  107. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -71
  108. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -223
  109. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,56 +0,0 @@
1
- const exampleStreamId = '123';
2
- const genQaMarkdownTextPayload = {
3
- payloadType: 'genqa.messageType',
4
- payload: JSON.stringify({
5
- textDelta:
6
- 'THIS IS SOME LOREM IPSUM: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin accumsan felis vel nulla venenatis, vel volutpat mauris suscipit. Praesent aliquam, ex et dapibus fermentum, ligula metus condimentum nunc, non vehicula magna magna a nulla. Integer efficitur nunc eget semper facilisis. Quisque nec tortor at nunc blandit dictum sit amet vel mauris. Duis at tellus sit amet mi pharetra tincidunt. Nullam id risus eget risus accumsan molestie ac quis velit. Vivamus consectetur nisi vel enim finibus, nec laoreet risus facilisis. Integer a lacinia ligula. Etiam cursus urna nisi, ut tincidunt elit consectetur quis. Pellentesque nec sem vel neque malesuada euismod vitae nec augue. Suspendisse non ligula eu purus posuere dictum quis et magna. Curabitur dignissim, magna non feugiat consectetur, lorem orci fringilla sapien, sit amet vehicula eros nulla eget enim. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin accumsan felis vel nulla venenatis, vel volutpat mauris suscipit. Praesent aliquam, ex et dapibus fermentum, ligula metus condimentum nunc, non vehicula magna magna a nulla. Integer efficitur nunc eget semper facilisis. Quisque nec tortor at nunc blandit dictum sit amet vel mauris. Duis at tellus sit amet mi pharetra tincidunt. Nullam id risus eget risus accumsan molestie ac quis velit. Vivamus consectetur nisi vel enim finibus, nec laoreet risus facilisis. Integer a lacinia ligula. Etiam cursus urna nisi, ut tincidunt elit consectetur quis. Pellentesque nec sem vel neque malesuada euismod vitae nec augue. Suspendisse non ligula eu purus posuere dictum quis et magna. Curabitur dignissim, magna non feugiat consectetur, lorem orci fringilla sapien, sit amet vehicula eros nulla eget enim.',
7
- }),
8
- finishReason: 'COMPLETED',
9
- };
10
- const genQaMarkdownTypePayload = {
11
- payloadType: 'genqa.headerMessageType',
12
- payload: JSON.stringify({
13
- contentFormat: 'text/markdown',
14
- }),
15
- };
16
- const genQaStreamEndPayload = {
17
- payloadType: 'genqa.endOfStreamType',
18
- payload: JSON.stringify({
19
- answerGenerated: true,
20
- }),
21
- };
22
- const exampleCitation = {
23
- id: 'some-id-1',
24
- title: 'Some Title 1',
25
- uri: 'https://www.coveo.com',
26
- permanentid: 'some-permanent-id-1',
27
- clickUri: '#',
28
- text: 'example text 1',
29
- source: 'Some source 1',
30
- };
31
- const exampleCitations = [exampleCitation];
32
- const genQaCitationPayload = {
33
- payloadType: 'genqa.citationsType',
34
- payload: JSON.stringify({
35
- citations: exampleCitations,
36
- }),
37
- };
38
-
39
- export type GenQaData = {
40
- streamId: string;
41
- streams: Array<{payloadType: string; payload: string; finishReason?: string}>;
42
- citations: Array<Record<string, any>>;
43
- };
44
-
45
- const genQaData: GenQaData = {
46
- streamId: exampleStreamId,
47
- streams: [
48
- genQaMarkdownTypePayload,
49
- genQaMarkdownTextPayload,
50
- genQaCitationPayload,
51
- genQaStreamEndPayload,
52
- ],
53
- citations: exampleCitations,
54
- };
55
-
56
- export default genQaData;
@@ -1,87 +0,0 @@
1
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
2
- import {SearchObject} from '../../../../../../playwright/page-object/searchObject';
3
- import {
4
- searchRequestRegex,
5
- insightSearchRequestRegex,
6
- } from '../../../../../../playwright/utils/requests';
7
- import {InsightSetupObject} from '../../../../../../playwright/page-object/insightSetupObject';
8
- import {useCaseEnum} from '../../../../../../playwright/utils/useCase';
9
- import {GeneratedAnswerObject} from './pageObject';
10
- import genQaData from './data';
11
- import type {GenQaData} from './data';
12
-
13
- const pageUrl = 's/quantic-generated-answer';
14
-
15
- interface GeneratedAnswerOptions {
16
- fieldsToIncludeInCitations: string;
17
- collapsible: boolean;
18
- withToggle: boolean;
19
- useCase: string;
20
- }
21
-
22
- type QuanticGeneratedAnswerE2ESearchFixtures = {
23
- genQaData: GenQaData;
24
- generatedAnswer: GeneratedAnswerObject;
25
- search: SearchObject;
26
- options: Partial<GeneratedAnswerOptions>;
27
- };
28
-
29
- type QuanticGeneratedAnswerE2EInsightFixtures =
30
- QuanticGeneratedAnswerE2ESearchFixtures & {
31
- insightSetup: InsightSetupObject;
32
- };
33
-
34
- export const testSearch =
35
- quanticBase.extend<QuanticGeneratedAnswerE2ESearchFixtures>({
36
- genQaData,
37
- options: {},
38
- search: async ({page}, use) => {
39
- await use(new SearchObject(page, searchRequestRegex));
40
- },
41
- generatedAnswer: async (
42
- {page, options, configuration, search, genQaData: data},
43
- use
44
- ) => {
45
- const generatedAnswerObject = new GeneratedAnswerObject(
46
- page,
47
- data.streamId
48
- );
49
- await page.goto(pageUrl);
50
- await search.mockSearchWithGenerativeQuestionAnsweringId(data.streamId);
51
- await generatedAnswerObject.mockStreamResponse(data.streams);
52
- await configuration.configure(options);
53
- await search.waitForSearchResponse();
54
- await use(generatedAnswerObject);
55
- },
56
- });
57
-
58
- export const testInsight =
59
- quanticBase.extend<QuanticGeneratedAnswerE2EInsightFixtures>({
60
- genQaData,
61
- options: {},
62
- search: async ({page}, use) => {
63
- await use(new SearchObject(page, insightSearchRequestRegex));
64
- },
65
- insightSetup: async ({page}, use) => {
66
- await use(new InsightSetupObject(page));
67
- },
68
- generatedAnswer: async (
69
- {page, options, search, configuration, insightSetup, genQaData: data},
70
- use
71
- ) => {
72
- const generatedAnswerObject = new GeneratedAnswerObject(
73
- page,
74
- data.streamId
75
- );
76
- await page.goto(pageUrl);
77
- await search.mockSearchWithGenerativeQuestionAnsweringId(data.streamId);
78
- await generatedAnswerObject.mockStreamResponse(data.streams);
79
- configuration.configure({...options, useCase: useCaseEnum.insight});
80
- await insightSetup.waitForInsightInterfaceInitialization();
81
- await search.performSearch();
82
- await search.waitForSearchResponse();
83
- await use(generatedAnswerObject);
84
- },
85
- });
86
-
87
- export {expect} from '@playwright/test';
@@ -1,283 +0,0 @@
1
- import type {Locator, Page, Request} from '@playwright/test';
2
- import {
3
- isUaClickEvent,
4
- isUaCustomEvent,
5
- } from '../../../../../../playwright/utils/requests';
6
-
7
- const minimumCitationTooltipDisplayDurationMs = 1500;
8
-
9
- export class GeneratedAnswerObject {
10
- constructor(
11
- public page: Page,
12
- public streamId: string
13
- ) {
14
- this.page = page;
15
- this.streamId = streamId;
16
- }
17
-
18
- get likeButton(): Locator {
19
- return this.page.getByRole('button', {name: 'This answer was helpful'});
20
- }
21
-
22
- get dislikeButton(): Locator {
23
- return this.page.getByRole('button', {name: 'This answer was not helpful'});
24
- }
25
-
26
- get copyToClipboardButton(): Locator {
27
- return this.page.getByRole('button', {name: 'Copy'});
28
- }
29
-
30
- get toggleButton(): Locator {
31
- return this.page.getByTestId('generated-answer__toggle-button');
32
- }
33
-
34
- questionContainer(questionId: string): Locator {
35
- return this.page.getByTestId(questionId);
36
- }
37
-
38
- answerOption(questionId: string, answerValue: string): Locator {
39
- return this.questionContainer(questionId).locator('.slds-radio_button', {
40
- hasText: new RegExp(`^${answerValue}$`),
41
- });
42
- }
43
-
44
- get feedbackDocumentUrlInput(): Locator {
45
- return this.page.locator(
46
- '.feedback-modal-qna__body input[name="documentUrl"]'
47
- );
48
- }
49
-
50
- get feedbackDetailsInput(): Locator {
51
- return this.page
52
- .locator('.feedback-modal-qna__body [data-name="details"]')
53
- .getByRole('textbox');
54
- }
55
-
56
- get submitFeedbackButton(): Locator {
57
- return this.page.getByRole('button', {name: /Send feedback/i});
58
- }
59
-
60
- get citationLink(): Locator {
61
- return this.page
62
- .getByTestId('generated-answer__citations')
63
- .locator('.citation__link');
64
- }
65
-
66
- get showMoreButton(): Locator {
67
- return this.page.getByTestId('generated-answer__answer-toggle');
68
- }
69
-
70
- async hoverOverCitation(index: number): Promise<void> {
71
- // waiting 500ms to allow the component to render completely, cause any re-rendering abort the hover action.
72
- await this.page.waitForTimeout(500);
73
- await this.citationLink.nth(index).hover();
74
- await this.page.waitForTimeout(minimumCitationTooltipDisplayDurationMs);
75
- await this.page.mouse.move(0, 0);
76
- }
77
-
78
- async clickOnCitation(index: number): Promise<void> {
79
- await this.citationLink.nth(index).click();
80
- }
81
-
82
- async typeInFeedbackDocumentUrlInput(text: string): Promise<void> {
83
- await this.feedbackDocumentUrlInput.fill(text);
84
- }
85
-
86
- async typeInFeedbackDetailsInput(text: string): Promise<void> {
87
- await this.feedbackDetailsInput.fill(text);
88
- }
89
-
90
- async clickSubmitFeedbackButton(): Promise<void> {
91
- await this.submitFeedbackButton.click();
92
- }
93
-
94
- async fillFeedbackForm(answers: Record<string, string>): Promise<void> {
95
- for (const [questionId, answerValue] of Object.entries(answers)) {
96
- const option = this.answerOption(questionId, answerValue);
97
- // eslint-disable-next-line no-await-in-loop
98
- await option.click();
99
- }
100
- }
101
-
102
- async clickLikeButton(): Promise<void> {
103
- await this.likeButton.click();
104
- }
105
-
106
- async clickDislikeButton(): Promise<void> {
107
- await this.dislikeButton.click();
108
- }
109
-
110
- async clickCopyToClipboardButton(): Promise<void> {
111
- await this.copyToClipboardButton.click();
112
- }
113
-
114
- async clickToggleButton(): Promise<void> {
115
- await this.toggleButton.click();
116
- }
117
-
118
- async waitForStreamEndUaAnalytics(): Promise<Request> {
119
- return this.waitForGeneratedAnswerCustomUaAnalytics(
120
- 'generatedAnswerStreamEnd'
121
- );
122
- }
123
-
124
- async waitForLikeGeneratedAnswerUaAnalytics(): Promise<Request> {
125
- return this.waitForGeneratedAnswerCustomUaAnalytics('likeGeneratedAnswer');
126
- }
127
-
128
- async waitForDislikeGeneratedAnswerUaAnalytics(): Promise<Request> {
129
- return this.waitForGeneratedAnswerCustomUaAnalytics(
130
- 'dislikeGeneratedAnswer'
131
- );
132
- }
133
-
134
- async waitForCopyToClipboardUaAnalytics(): Promise<Request> {
135
- return this.waitForGeneratedAnswerCustomUaAnalytics(
136
- 'generatedAnswerCopyToClipboard'
137
- );
138
- }
139
-
140
- async waitForShowAnswersUaAnalytics(): Promise<Request> {
141
- return this.waitForGeneratedAnswerCustomUaAnalytics(
142
- 'generatedAnswerShowAnswers'
143
- );
144
- }
145
-
146
- async waitForHideAnswersUaAnalytics(): Promise<Request> {
147
- return this.waitForGeneratedAnswerCustomUaAnalytics(
148
- 'generatedAnswerHideAnswers'
149
- );
150
- }
151
-
152
- async waitForSourceHoverUaAnalytics(
153
- expectedFields: Record<string, any>
154
- ): Promise<Request> {
155
- return this.waitForGeneratedAnswerCustomUaAnalytics(
156
- 'generatedAnswerSourceHover',
157
- (customData: Record<string, any>) => {
158
- return Object.keys(expectedFields).every(
159
- (key) => customData?.[key] === expectedFields[key]
160
- );
161
- }
162
- );
163
- }
164
-
165
- async waitForFeedbackSubmitUaAnalytics(
166
- expectedFields: Record<string, any>
167
- ): Promise<Request> {
168
- return this.waitForGeneratedAnswerCustomUaAnalytics(
169
- 'generatedAnswerFeedbackSubmitV2',
170
- (customData: Record<string, any>) => {
171
- return Object.keys(expectedFields).every(
172
- (key) => customData?.[key] === expectedFields[key]
173
- );
174
- }
175
- );
176
- }
177
-
178
- async waitForCitationClickUaAnalytics(
179
- expectedFields: Record<string, any>,
180
- expectedCustomFields: Record<string, any>
181
- ): Promise<Request> {
182
- return this.waitForGeneratedAnswerClickUaAnalytics(
183
- 'generatedAnswerCitationClick',
184
- (data: Record<string, any>, customData: Record<string, any>) => {
185
- return (
186
- Object.keys(expectedFields).every(
187
- (key) => data?.[key] === expectedFields[key]
188
- ) &&
189
- Object.keys(expectedCustomFields).every(
190
- (key) => customData?.[key] === expectedCustomFields[key]
191
- )
192
- );
193
- }
194
- );
195
- }
196
-
197
- async waitForGeneratedAnswerClickUaAnalytics(
198
- actionCause: string,
199
- customChecker?: Function
200
- ): Promise<Request> {
201
- const uaRequest = this.page.waitForRequest((request) => {
202
- if (isUaClickEvent(request)) {
203
- const requestBody = request.postDataJSON?.();
204
- const requestData = JSON.parse(requestBody.clickEvent);
205
-
206
- const expectedFields: Record<string, any> = {
207
- actionCause,
208
- };
209
-
210
- const matchesExpectedFields = Object.keys(expectedFields).every(
211
- (key) => requestData?.[key] === expectedFields[key]
212
- );
213
-
214
- const customData = requestData?.customData;
215
-
216
- const matchesGenerativeId =
217
- customData?.generativeQuestionAnsweringId === this.streamId;
218
-
219
- return (
220
- matchesExpectedFields &&
221
- matchesGenerativeId &&
222
- (customChecker ? customChecker(requestData, customData) : true)
223
- );
224
- }
225
- return false;
226
- });
227
- return uaRequest;
228
- }
229
-
230
- async waitForGeneratedAnswerCustomUaAnalytics(
231
- eventValue: string,
232
- customChecker?: Function
233
- ): Promise<Request> {
234
- const uaRequest = this.page.waitForRequest((request) => {
235
- if (isUaCustomEvent(request)) {
236
- const requestBody = request.postDataJSON?.();
237
- const expectedFields: Record<string, any> = {
238
- eventType: 'generatedAnswer',
239
- eventValue: eventValue,
240
- };
241
-
242
- const matchesExpectedFields = Object.keys(expectedFields).every(
243
- (key) => requestBody?.[key] === expectedFields[key]
244
- );
245
-
246
- const customData = requestBody?.customData;
247
-
248
- const matchesGenerativeId =
249
- customData?.generativeQuestionAnsweringId === this.streamId;
250
-
251
- return (
252
- matchesExpectedFields &&
253
- matchesGenerativeId &&
254
- (customChecker ? customChecker(customData) : true)
255
- );
256
- }
257
- return false;
258
- });
259
- return uaRequest;
260
- }
261
-
262
- async mockStreamResponse(
263
- body: Array<{payloadType: string; payload: string; finishReason?: string}>
264
- ) {
265
- await this.page.route(
266
- `**/machinelearning/streaming/${this.streamId}`,
267
- (route) => {
268
- let bodyText = '';
269
- body.forEach((data) => {
270
- bodyText += `data: ${JSON.stringify(data)} \n\n`;
271
- });
272
-
273
- route.fulfill({
274
- status: 200,
275
- body: bodyText,
276
- headers: {
277
- 'content-type': 'text/event-stream',
278
- },
279
- });
280
- }
281
- );
282
- }
283
- }
@@ -1,199 +0,0 @@
1
- import {testSearch, testInsight, expect} from './fixture';
2
- import {useCaseTestCases} from '../../../../../../playwright/utils/useCase';
3
- import genQaData 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 generated answer ${useCase.label}`, () => {
14
- test.use({
15
- genQaData,
16
- });
17
-
18
- test.describe('when the answer has been generated', () => {
19
- test('should send a stream end analytics event', async ({
20
- generatedAnswer,
21
- }) => {
22
- await generatedAnswer.waitForStreamEndUaAnalytics();
23
- });
24
- });
25
-
26
- test.describe('when providing positive feedback', () => {
27
- test('should send positive feedback analytics containing all details', async ({
28
- generatedAnswer,
29
- }) => {
30
- const likeAnalyticRequestPromise =
31
- generatedAnswer.waitForLikeGeneratedAnswerUaAnalytics();
32
- await generatedAnswer.clickLikeButton();
33
- await likeAnalyticRequestPromise;
34
-
35
- const exampleDocumentUrl = 'https://www.coveo.com/';
36
- const exampleDetails = 'example details...';
37
- await generatedAnswer.fillFeedbackForm({
38
- correctTopic: 'Yes',
39
- hallucinationFree: 'Yes',
40
- documented: 'Not sure',
41
- readable: 'Yes',
42
- });
43
- await generatedAnswer.typeInFeedbackDocumentUrlInput(
44
- exampleDocumentUrl
45
- );
46
- await generatedAnswer.typeInFeedbackDetailsInput(exampleDetails);
47
-
48
- const feedbackAnalyticRequestPromise =
49
- generatedAnswer.waitForFeedbackSubmitUaAnalytics({
50
- correctTopic: 'yes',
51
- hallucinationFree: 'yes',
52
- documented: 'unknown',
53
- readable: 'yes',
54
- documentUrl: exampleDocumentUrl,
55
- details: exampleDetails,
56
- helpful: true,
57
- });
58
- await generatedAnswer.clickSubmitFeedbackButton();
59
- await feedbackAnalyticRequestPromise;
60
- });
61
- });
62
-
63
- test.describe('when providing negative feedback', () => {
64
- test('should send negative feedback analytics containing all details', async ({
65
- generatedAnswer,
66
- }) => {
67
- const dislikeAnalyticRequestPromise =
68
- generatedAnswer.waitForDislikeGeneratedAnswerUaAnalytics();
69
- await generatedAnswer.clickDislikeButton();
70
- await dislikeAnalyticRequestPromise;
71
-
72
- const exampleDocumentUrl = 'https://www.coveo.com/';
73
- const exampleDetails = 'example details...';
74
- await generatedAnswer.fillFeedbackForm({
75
- correctTopic: 'No',
76
- hallucinationFree: 'Not sure',
77
- documented: 'No',
78
- readable: 'No',
79
- });
80
- await generatedAnswer.typeInFeedbackDocumentUrlInput(
81
- exampleDocumentUrl
82
- );
83
- await generatedAnswer.typeInFeedbackDetailsInput(exampleDetails);
84
-
85
- const feedbackAnalyticRequestPromise =
86
- generatedAnswer.waitForFeedbackSubmitUaAnalytics({
87
- correctTopic: 'no',
88
- hallucinationFree: 'unknown',
89
- documented: 'no',
90
- readable: 'no',
91
- documentUrl: exampleDocumentUrl,
92
- details: exampleDetails,
93
- helpful: false,
94
- });
95
- await generatedAnswer.clickSubmitFeedbackButton();
96
- await feedbackAnalyticRequestPromise;
97
- });
98
- });
99
-
100
- test.describe('when copying the generated answer to clipboard', () => {
101
- test('should send a copy to clipboard analytics event', async ({
102
- generatedAnswer,
103
- }) => {
104
- const analyticRequestPromise =
105
- generatedAnswer.waitForCopyToClipboardUaAnalytics();
106
- await generatedAnswer.clickCopyToClipboardButton();
107
- await analyticRequestPromise;
108
- });
109
- });
110
-
111
- test.describe('when the property withToggle is set to true', () => {
112
- test.use({
113
- options: {
114
- withToggle: true,
115
- },
116
- });
117
-
118
- test('should allow toggling the generated OFF and ON and log analytics', async ({
119
- generatedAnswer,
120
- }) => {
121
- const hideAnswerAnalyticRequestPromise =
122
- generatedAnswer.waitForHideAnswersUaAnalytics();
123
- await generatedAnswer.clickToggleButton();
124
- await hideAnswerAnalyticRequestPromise;
125
-
126
- const showAnswerAnalyticRequestPromise =
127
- generatedAnswer.waitForShowAnswersUaAnalytics();
128
- await generatedAnswer.clickToggleButton();
129
- await showAnswerAnalyticRequestPromise;
130
- });
131
- });
132
-
133
- test.describe('when interacting with citations', () => {
134
- test.describe('when hovering over a citation', () => {
135
- test('should log citation hover analytics', async ({
136
- generatedAnswer,
137
- }) => {
138
- const citationIndex = 0;
139
- const {id, permanentid} = genQaData.citations[citationIndex];
140
- const citationHoverAnalyticRequestPromise =
141
- generatedAnswer.waitForSourceHoverUaAnalytics({
142
- citationId: id,
143
- permanentId: permanentid,
144
- });
145
- await generatedAnswer.hoverOverCitation(citationIndex);
146
- await citationHoverAnalyticRequestPromise;
147
- });
148
- });
149
-
150
- test.describe('when clicking on a citation', () => {
151
- test('should log citation click analytics', async ({
152
- generatedAnswer,
153
- }) => {
154
- const citationIndex = 0;
155
- const {id, title, source, uri, clickUri, permanentid} =
156
- genQaData.citations[citationIndex];
157
- const citationClickAnalyticRequestPromise =
158
- generatedAnswer.waitForCitationClickUaAnalytics(
159
- {
160
- documentTitle: title,
161
- sourceName: source,
162
- documentPosition: citationIndex + 1,
163
- documentUri: uri,
164
- documentUrl: clickUri,
165
- },
166
- {
167
- citationId: id,
168
- contentIDKey: 'permanentid',
169
- contentIDValue: permanentid,
170
- }
171
- );
172
- await generatedAnswer.clickOnCitation(citationIndex);
173
- await citationClickAnalyticRequestPromise;
174
- });
175
- });
176
- });
177
-
178
- test.describe('when the answer is generated in a single shot and the answer exceeds the maximum height', () => {
179
- test.use({
180
- options: {
181
- collapsible: true,
182
- },
183
- });
184
- test('should display the answer as collapsed', async ({
185
- generatedAnswer,
186
- }) => {
187
- const expectedShowMoreLabel = 'Show more';
188
- await generatedAnswer.waitForStreamEndUaAnalytics();
189
-
190
- const showMoreButton = generatedAnswer.showMoreButton;
191
- expect(showMoreButton).not.toBeNull();
192
-
193
- const showMoreButtonLabel = await showMoreButton.textContent();
194
- expect(showMoreButtonLabel).not.toBeNull();
195
- expect(showMoreButtonLabel).toEqual(expectedShowMoreLabel);
196
- });
197
- });
198
- });
199
- });