@coveo/quantic 3.16.0 → 3.16.1-pre.17ed3a22d0

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 (112) hide show
  1. package/docs/out/quantic-docs.json +2 -2
  2. package/force-app/main/default/lwc/quanticNumberButton/quanticNumberButton.html +1 -1
  3. package/force-app/main/default/lwc/quanticResultsPerPage/quanticResultsPerPage.js +27 -17
  4. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  5. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  6. package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/recent-queries-list/headless-recent-queries-list.d.ts +5 -0
  7. package/force-app/main/default/staticresources/coveoheadless/headless.js +10 -10
  8. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
  9. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  10. package/package.json +6 -4
  11. package/force-app/main/default/lwc/quanticBreadcrumbManager/__tests__/quanticBreadcrumbManager.test.js +0 -604
  12. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/fixture.ts +0 -76
  13. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/pageObject.ts +0 -282
  14. package/force-app/main/default/lwc/quanticBreadcrumbManager/e2e/quanticBreadcrumbManager.e2e.ts +0 -167
  15. package/force-app/main/default/lwc/quanticCarousel/__tests__/quanticCarousel.test.js +0 -262
  16. package/force-app/main/default/lwc/quanticCaseClassification/__tests__/quanticCaseClassification.test.js +0 -819
  17. package/force-app/main/default/lwc/quanticCaseClassification/e2e/data.ts +0 -23
  18. package/force-app/main/default/lwc/quanticCaseClassification/e2e/fixture.ts +0 -51
  19. package/force-app/main/default/lwc/quanticCaseClassification/e2e/pageObject.ts +0 -152
  20. package/force-app/main/default/lwc/quanticCaseClassification/e2e/quanticCaseClassification.e2e.ts +0 -269
  21. package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +0 -327
  22. package/force-app/main/default/lwc/quanticCitation/__tests__/quanticCitation.test.js +0 -269
  23. package/force-app/main/default/lwc/quanticColoredResultBadge/__tests__/quanticColoredResultBadge.test.js +0 -212
  24. package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +0 -321
  25. package/force-app/main/default/lwc/quanticDidYouMean/__tests__/quanticDidYouMean.test.js +0 -199
  26. package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +0 -341
  27. package/force-app/main/default/lwc/quanticFacetCaption/__tests__/quanticFacetCaption.test.js +0 -28
  28. package/force-app/main/default/lwc/quanticFacetManager/__tests__/quanticFacetManager.test.js +0 -178
  29. package/force-app/main/default/lwc/quanticFacetManager/e2e/fixture.ts +0 -63
  30. package/force-app/main/default/lwc/quanticFacetManager/e2e/pageObject.ts +0 -23
  31. package/force-app/main/default/lwc/quanticFacetManager/e2e/quanticFacetManager.e2e.ts +0 -82
  32. package/force-app/main/default/lwc/quanticFeedback/__tests__/quanticFeedback.test.js +0 -392
  33. package/force-app/main/default/lwc/quanticFeedbackModal/__tests__/quanticFeedbackModal.test.js +0 -448
  34. package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +0 -298
  35. package/force-app/main/default/lwc/quanticGeneratedAnswer/__tests__/quanticGeneratedAnswer.test.js +0 -814
  36. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/data.ts +0 -56
  37. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/fixture.ts +0 -87
  38. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/pageObject.ts +0 -283
  39. package/force-app/main/default/lwc/quanticGeneratedAnswer/e2e/quanticGeneratedAnswer.e2e.ts +0 -199
  40. package/force-app/main/default/lwc/quanticGeneratedAnswerContent/__tests__/quanticGeneratedAnswerContent.test.js +0 -151
  41. package/force-app/main/default/lwc/quanticHeading/__tests__/quanticHeading.test.js +0 -71
  42. package/force-app/main/default/lwc/quanticHeadlessLoader/__tests__/quanticHeadlessLoader.test.js +0 -651
  43. package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +0 -335
  44. package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +0 -343
  45. package/force-app/main/default/lwc/quanticPager/e2e/fixture.ts +0 -63
  46. package/force-app/main/default/lwc/quanticPager/e2e/pageObject.ts +0 -69
  47. package/force-app/main/default/lwc/quanticPager/e2e/quanticPager.e2e.ts +0 -101
  48. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/defaultTestCase.json +0 -13
  49. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/data/youtubeTestCase.json +0 -14
  50. package/force-app/main/default/lwc/quanticQuickviewContent/__tests__/quanticQuickviewContent.test.js +0 -82
  51. package/force-app/main/default/lwc/quanticRadioButtonsGroup/__tests__/quanticRadioButtonsGroup.test.js +0 -273
  52. package/force-app/main/default/lwc/quanticRefineModalContent/__tests__/quanticRefineModalContent.test.js +0 -501
  53. package/force-app/main/default/lwc/quanticResultAction/__tests__/quanticResultAction.test.js +0 -262
  54. package/force-app/main/default/lwc/quanticResultActionBar/__tests__/quanticResultActionBar.test.js +0 -141
  55. package/force-app/main/default/lwc/quanticResultChildren/__tests__/quanticResultChildren.test.js +0 -340
  56. package/force-app/main/default/lwc/quanticResultDate/__tests__/quanticResultDate.test.js +0 -144
  57. package/force-app/main/default/lwc/quanticResultField/__tests__/quanticResultField.test.js +0 -120
  58. package/force-app/main/default/lwc/quanticResultHighlightedTextField/__tests__/quanticResultHighlightedTextField.test.js +0 -209
  59. package/force-app/main/default/lwc/quanticResultLink/__tests__/quanticResultLink.test.js +0 -261
  60. package/force-app/main/default/lwc/quanticResultMultiValueText/__tests__/quanticResultMultiValueText.test.js +0 -235
  61. package/force-app/main/default/lwc/quanticResultNumber/__tests__/quanticResultNumber.test.js +0 -144
  62. package/force-app/main/default/lwc/quanticResultPrintableUri/__tests__/quanticResultPrintableUri.test.js +0 -324
  63. package/force-app/main/default/lwc/quanticResultQuickview/__tests__/quanticResultQuickview.test.js +0 -171
  64. package/force-app/main/default/lwc/quanticResultText/__tests__/quanticResultText.test.js +0 -155
  65. package/force-app/main/default/lwc/quanticResultsPerPage/__tests__/quanticResultsPerPage.test.js +0 -404
  66. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/fixture.ts +0 -74
  67. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/pageObject.ts +0 -85
  68. package/force-app/main/default/lwc/quanticResultsPerPage/e2e/quanticResultsPerPage.e2e.ts +0 -97
  69. package/force-app/main/default/lwc/quanticSearchBox/__tests__/quanticSearchBox.test.js +0 -168
  70. package/force-app/main/default/lwc/quanticSearchBoxInput/__tests__/quanticSearchBoxInput.test.js +0 -823
  71. package/force-app/main/default/lwc/quanticSmartSnippet/__tests__/quanticSmartSnippet.test.js +0 -341
  72. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/data.ts +0 -21
  73. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/fixture.ts +0 -91
  74. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/pageObject.ts +0 -196
  75. package/force-app/main/default/lwc/quanticSmartSnippet/e2e/quanticSmartSnippet.e2e.ts +0 -168
  76. package/force-app/main/default/lwc/quanticSmartSnippetAnswer/__tests__/quanticSmartSnippetAnswer.test.js +0 -126
  77. package/force-app/main/default/lwc/quanticSmartSnippetSource/__tests__/quanticSmartSnippetSource.test.js +0 -290
  78. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/__tests__/quanticSmartSnippetSuggestions.test.js +0 -329
  79. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/data.ts +0 -31
  80. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/fixture.ts +0 -93
  81. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/pageObject.ts +0 -160
  82. package/force-app/main/default/lwc/quanticSmartSnippetSuggestions/e2e/quanticSmartSnippetSuggestions.e2e.ts +0 -127
  83. package/force-app/main/default/lwc/quanticSort/__tests__/quanticSort.test.js +0 -416
  84. package/force-app/main/default/lwc/quanticSort/e2e/fixture.ts +0 -61
  85. package/force-app/main/default/lwc/quanticSort/e2e/pageObject.ts +0 -89
  86. package/force-app/main/default/lwc/quanticSort/e2e/quanticSort.e2e.ts +0 -91
  87. package/force-app/main/default/lwc/quanticSourceCitations/__tests__/quanticSourceCitations.test.js +0 -123
  88. package/force-app/main/default/lwc/quanticStandaloneSearchBox/__tests__/quanticStandaloneSearchBox.test.js +0 -186
  89. package/force-app/main/default/lwc/quanticStatefulButton/__tests__/quanticStatefulButton.test.js +0 -222
  90. package/force-app/main/default/lwc/quanticTab/__tests__/quanticTab.test.js +0 -287
  91. package/force-app/main/default/lwc/quanticTab/e2e/fixture.ts +0 -62
  92. package/force-app/main/default/lwc/quanticTab/e2e/pageObject.ts +0 -67
  93. package/force-app/main/default/lwc/quanticTab/e2e/quanticTab.e2e.ts +0 -77
  94. package/force-app/main/default/lwc/quanticTabBar/__tests__/quanticTabBar.test.js +0 -331
  95. package/force-app/main/default/lwc/quanticTabBar/e2e/fixture.ts +0 -61
  96. package/force-app/main/default/lwc/quanticTabBar/e2e/pageObject.ts +0 -80
  97. package/force-app/main/default/lwc/quanticTabBar/e2e/quanticTabBar.e2e.ts +0 -173
  98. package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +0 -339
  99. package/force-app/main/default/lwc/quanticTooltip/__tests__/quanticTooltip.test.js +0 -107
  100. package/force-app/main/default/lwc/quanticUserAction/__tests__/quanticUserAction.test.js +0 -427
  101. package/force-app/main/default/lwc/quanticUserActionsSession/__tests__/quanticUserActionsSession.test.js +0 -269
  102. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/data/userActionsState.json +0 -89
  103. package/force-app/main/default/lwc/quanticUserActionsTimeline/__tests__/quanticUserActionsTimeline.test.js +0 -511
  104. package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +0 -229
  105. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +0 -32
  106. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +0 -32
  107. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +0 -71
  108. package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +0 -39
  109. package/force-app/main/default/lwc/quanticUtils/__tests__/facetDependenciesUtils.test.js +0 -92
  110. package/force-app/main/default/lwc/quanticUtils/__tests__/markdownUtils.test.js +0 -71
  111. package/force-app/main/default/lwc/quanticUtils/__tests__/quanticUtils.test.js +0 -223
  112. package/force-app/main/default/lwc/quanticViewedByCustomerBadge/__tests__/quanticViewedByCustomerBadge.test.js +0 -131
@@ -1,23 +0,0 @@
1
- export const allOptions = [
2
- {id: '0', value: 'Very low', label: 'Very low', validFor: []},
3
- {id: '1', value: 'Low', label: 'Low', validFor: []},
4
- {id: '2', value: 'Medium', label: 'Medium', validFor: []},
5
- {id: '3', value: 'High', label: 'High', validFor: []},
6
- {id: '4', value: 'Very high', label: 'Very high', validFor: []},
7
- ];
8
-
9
- export const caseClassificationSuggestions = [
10
- {
11
- value: 'Very low',
12
- confidence: 1,
13
- id: '0',
14
- },
15
- {
16
- value: 'Low',
17
- confidence: 1,
18
- id: '1',
19
- },
20
- ];
21
-
22
- export const sfDefaultField = 'Priority';
23
- export const coveoDefaultField = 'sfpriority';
@@ -1,51 +0,0 @@
1
- import {CaseClassificationObject} from './pageObject';
2
- import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
3
- import {CaseAssistObject} from '../../../../../../playwright/page-object/caseAssistObject';
4
- import {
5
- allOptions,
6
- caseClassificationSuggestions,
7
- coveoDefaultField,
8
- sfDefaultField,
9
- } from './data';
10
-
11
- const pageUrl = 's/quantic-case-classification';
12
-
13
- interface CaseClassificationOptions {
14
- fetchOnInit: boolean;
15
- fetchClassificationOnChange: boolean;
16
- fetchDocumentSuggestionOnChange: boolean;
17
- }
18
- type QuanticCaseClassificationE2EFixtures = {
19
- caseClassification: CaseClassificationObject;
20
- caseAssist: CaseAssistObject;
21
- options: Partial<CaseClassificationOptions>;
22
- };
23
-
24
- export const test = quanticBase.extend<QuanticCaseClassificationE2EFixtures>({
25
- options: {},
26
- caseAssist: async ({page}, use) => {
27
- await use(new CaseAssistObject(page));
28
- },
29
- caseClassification: async (
30
- {page, options, configuration, caseAssist},
31
- use
32
- ) => {
33
- const caseClassificationObject = new CaseClassificationObject(page);
34
- caseClassificationObject.mockSfPicklistValues(sfDefaultField, allOptions);
35
- caseClassificationObject.mockCaseClassification(
36
- coveoDefaultField,
37
- caseClassificationSuggestions
38
- );
39
- await page.goto(pageUrl);
40
- await configuration.configure({...options});
41
- await caseClassificationObject.allOptionsSelectInput.waitFor();
42
-
43
- const caseClassificationsResponsePromise =
44
- caseAssist.waitForCaseClassificationsResponse();
45
- await caseAssist.fetchClassifications();
46
- await caseClassificationsResponsePromise;
47
- await use(caseClassificationObject);
48
- },
49
- });
50
-
51
- export {expect} from '@playwright/test';
@@ -1,152 +0,0 @@
1
- import type {Locator, Page, Request} from '@playwright/test';
2
- import {isCollectEvent} from '../../../../../../playwright/utils/requests';
3
-
4
- const elementsSelectors = {
5
- component: 'c-quantic-case-classification',
6
- caseClassificationSuggestionTestId: 'case-classification-suggestion',
7
- showSelectInputButtonTestId: 'show-select-input-button',
8
- allOptionsSelectInputTestId: 'case-classification-all-options-combobox',
9
- selectInputOption: 'lightning-base-combobox-item',
10
- };
11
-
12
- export class CaseClassificationObject {
13
- constructor(public page: Page) {
14
- this.page = page;
15
- }
16
-
17
- get component(): Locator {
18
- return this.page.locator(elementsSelectors.component);
19
- }
20
-
21
- get caseClassificationSuggestions(): Locator {
22
- return this.component.locator(
23
- `[data-testid="${elementsSelectors.caseClassificationSuggestionTestId}"]:visible`
24
- );
25
- }
26
-
27
- get showSelectInputButton(): Locator {
28
- return this.component.getByTestId(
29
- elementsSelectors.showSelectInputButtonTestId
30
- );
31
- }
32
-
33
- get allOptionsSelectInput(): Locator {
34
- return this.component.getByTestId(
35
- elementsSelectors.allOptionsSelectInputTestId
36
- );
37
- }
38
-
39
- get allOptionsSelectInputValue(): Promise<null | string> {
40
- return this.allOptionsSelectInput.locator('button').textContent();
41
- }
42
-
43
- get selectInputOption(): Locator {
44
- return this.component.locator(elementsSelectors.selectInputOption);
45
- }
46
-
47
- get selectedSuggestion(): Locator {
48
- return this.component.locator(
49
- `[data-testid="${elementsSelectors.caseClassificationSuggestionTestId}"] > input:checked`
50
- );
51
- }
52
-
53
- async clickCaseClassificationSuggestionAtIndex(index: number): Promise<void> {
54
- await this.caseClassificationSuggestions.nth(index).click();
55
- }
56
-
57
- async clickShowSelectInputButton(): Promise<void> {
58
- await this.showSelectInputButton.click();
59
- }
60
-
61
- async clickallOptionsSelectInput(): Promise<void> {
62
- await this.allOptionsSelectInput.click();
63
- }
64
-
65
- async clickSelectInputOptionAtIndex(index: number): Promise<void> {
66
- await this.selectInputOption.nth(index).click();
67
- }
68
-
69
- async mockCaseClassification(
70
- field: string,
71
- value: Array<object>,
72
- responseId?: string
73
- ) {
74
- await this.page.route(
75
- '**/rest/organizations/*/caseassists/*/classify',
76
- async (route) => {
77
- await route.fulfill({
78
- status: 200,
79
- headers: {
80
- 'content-type': 'application/json',
81
- },
82
- body: JSON.stringify({
83
- fields: {
84
- [field]: {predictions: value},
85
- },
86
- responseId: responseId ?? '123',
87
- }),
88
- });
89
- }
90
- );
91
- }
92
-
93
- async mockSfPicklistValues(field: string, values: Array<object>) {
94
- await this.page.route(
95
- '**/aura?*aura.RecordUi.getPicklistValuesByRecordType=1',
96
- async (route) => {
97
- const response = await route.fetch();
98
- const responseBody = await response.json();
99
-
100
- responseBody.actions[0].returnValue.picklistFieldValues[field].values =
101
- values.map((value) => ({
102
- ...value,
103
- attributes: null,
104
- }));
105
-
106
- await route.fulfill({
107
- status: response.status(),
108
- headers: response.headers(),
109
- body: JSON.stringify(responseBody),
110
- });
111
- }
112
- );
113
- }
114
-
115
- async waitForCollectAnalytics(
116
- expectedAction: string,
117
- expectedData: Record<string, any>
118
- ): Promise<Request> {
119
- const uaRequest = this.page.waitForRequest((request) => {
120
- if (isCollectEvent(request)) {
121
- const requestBody = request.postDataJSON?.();
122
- if (requestBody.svc_action !== expectedAction) {
123
- return false;
124
- }
125
- const dataMatches = Object.keys(expectedData).every(
126
- (key) =>
127
- JSON.stringify(requestBody.svc_action_data[key]) ===
128
- JSON.stringify(expectedData[key])
129
- );
130
-
131
- return dataMatches;
132
- }
133
- return false;
134
- });
135
- return uaRequest;
136
- }
137
-
138
- async waitForTicketClassificationClickCollectAnalytics(
139
- expectedData: Record<string, any>
140
- ): Promise<Request> {
141
- return this.waitForCollectAnalytics(
142
- 'ticket_classification_click',
143
- expectedData
144
- );
145
- }
146
-
147
- async waitForTicketFieldUpdateCollectAnalytics(
148
- expectedData: Record<string, any>
149
- ): Promise<Request> {
150
- return this.waitForCollectAnalytics('ticket_field_update', expectedData);
151
- }
152
- }
@@ -1,269 +0,0 @@
1
- import {test, expect} from './fixture';
2
- import {
3
- caseClassificationSuggestions,
4
- coveoDefaultField,
5
- allOptions,
6
- } from './data';
7
-
8
- test.describe('quantic case classification', () => {
9
- test.describe('the analytics', () => {
10
- test.describe('when new case classifications suggestions are received', () => {
11
- test('should log the proper ticket classification click collect event for the automatically selected suggestion', async ({
12
- caseClassification,
13
- caseAssist,
14
- }) => {
15
- const indexOfNewSuggestion = 1;
16
- const {
17
- id: selectedSuggestionId,
18
- value: selectedSuggestionValue,
19
- confidence: selectedSuggestionConfidence,
20
- } = caseClassificationSuggestions[indexOfNewSuggestion];
21
- caseClassification.mockCaseClassification(coveoDefaultField, [
22
- caseClassificationSuggestions[indexOfNewSuggestion],
23
- ]);
24
-
25
- const automaticallySelectedSuggestionCollectEventPromise =
26
- caseClassification.waitForTicketClassificationClickCollectAnalytics({
27
- classificationId: selectedSuggestionId,
28
- responseId: '123',
29
- fieldName: coveoDefaultField,
30
- classification: {
31
- value: selectedSuggestionValue,
32
- confidence: selectedSuggestionConfidence,
33
- },
34
- autoSelection: true,
35
- });
36
-
37
- await caseAssist.fetchClassifications();
38
- await automaticallySelectedSuggestionCollectEventPromise;
39
- });
40
- });
41
-
42
- test.describe('clicking on a case classification suggestion', () => {
43
- test('should log the proper collect events', async ({
44
- caseClassification,
45
- }) => {
46
- const selectedSuggestionIndex = 1;
47
- const {
48
- id: selectedSuggestionId,
49
- value: selectedSuggestionValue,
50
- confidence: selectedSuggestionConfidence,
51
- } = caseClassificationSuggestions[selectedSuggestionIndex];
52
- const selectedSuggestionCollectEventPromise =
53
- caseClassification.waitForTicketClassificationClickCollectAnalytics({
54
- classificationId: selectedSuggestionId,
55
- responseId: '123',
56
- fieldName: coveoDefaultField,
57
- classification: {
58
- value: selectedSuggestionValue,
59
- confidence: selectedSuggestionConfidence,
60
- },
61
- });
62
- const fieldUpdateCollectEventPromise =
63
- caseClassification.waitForTicketFieldUpdateCollectAnalytics({
64
- fieldName: coveoDefaultField,
65
- });
66
- await caseClassification.clickCaseClassificationSuggestionAtIndex(
67
- selectedSuggestionIndex
68
- );
69
- await selectedSuggestionCollectEventPromise;
70
- await fieldUpdateCollectEventPromise;
71
- });
72
- });
73
-
74
- test.describe('clicking on a case classification option', () => {
75
- test('should log the proper collect events', async ({
76
- caseClassification,
77
- }) => {
78
- const fieldUpdateCollectEventPromise =
79
- caseClassification.waitForTicketFieldUpdateCollectAnalytics({
80
- fieldName: coveoDefaultField,
81
- });
82
-
83
- await caseClassification.clickShowSelectInputButton();
84
- await caseClassification.clickallOptionsSelectInput();
85
- await caseClassification.clickSelectInputOptionAtIndex(3);
86
- await fieldUpdateCollectEventPromise;
87
- });
88
- });
89
- });
90
-
91
- test.describe('when the property fetchClassificationOnChange is set to true', () => {
92
- test.use({
93
- options: {fetchClassificationOnChange: true},
94
- });
95
-
96
- test('should trigger a new classification request when a case classification suggestion is clicked', async ({
97
- caseClassification,
98
- caseAssist,
99
- }) => {
100
- const caseClassificationsResponsePromise =
101
- caseAssist.waitForCaseClassificationsResponse();
102
-
103
- await caseClassification.clickCaseClassificationSuggestionAtIndex(1);
104
-
105
- await caseClassificationsResponsePromise;
106
- });
107
-
108
- test('should trigger a new classification request when a case classification option is clicked', async ({
109
- caseClassification,
110
- caseAssist,
111
- }) => {
112
- const caseClassificationsResponsePromise =
113
- caseAssist.waitForCaseClassificationsResponse();
114
-
115
- await caseClassification.clickShowSelectInputButton();
116
- await caseClassification.clickallOptionsSelectInput();
117
- await caseClassification.clickSelectInputOptionAtIndex(3);
118
-
119
- await caseClassificationsResponsePromise;
120
- });
121
- });
122
-
123
- test.describe('when the property fetchDocumentSuggestionOnChange is set to true', () => {
124
- test.use({
125
- options: {fetchDocumentSuggestionOnChange: true},
126
- });
127
-
128
- test('should trigger a new document suggestions request when a case classification suggestion is clicked', async ({
129
- caseClassification,
130
- caseAssist,
131
- }) => {
132
- const documentSuggestionResponsePromise =
133
- caseAssist.waitForDocumentSuggestionResponse();
134
-
135
- await caseClassification.clickCaseClassificationSuggestionAtIndex(1);
136
-
137
- await documentSuggestionResponsePromise;
138
- });
139
-
140
- test('should trigger a new document suggestions request when a case classification option is clicked', async ({
141
- caseClassification,
142
- caseAssist,
143
- }) => {
144
- const documentSuggestionResponsePromise =
145
- caseAssist.waitForDocumentSuggestionResponse();
146
-
147
- await caseClassification.clickShowSelectInputButton();
148
- await caseClassification.clickallOptionsSelectInput();
149
- await caseClassification.clickSelectInputOptionAtIndex(3);
150
-
151
- await documentSuggestionResponsePromise;
152
- });
153
- });
154
-
155
- test.describe('the behaviour of the case classifications', () => {
156
- test.describe('when selecting a suggestion and then receiving new suggestions that include the selected suggestion', () => {
157
- test('should keep the suggestion by the user selected and display it as an inline option', async ({
158
- caseClassification,
159
- caseAssist,
160
- }) => {
161
- const selectedSuggestionIndex = 1;
162
- await caseClassification.clickCaseClassificationSuggestionAtIndex(
163
- selectedSuggestionIndex
164
- );
165
- await expect(caseClassification.selectedSuggestion).toHaveValue(
166
- caseClassificationSuggestions[selectedSuggestionIndex].value
167
- );
168
-
169
- caseClassification.mockCaseClassification(
170
- coveoDefaultField,
171
- caseClassificationSuggestions
172
- );
173
- const caseClassificationsResponsePromise =
174
- caseAssist.waitForCaseClassificationsResponse();
175
- await caseAssist.fetchClassifications();
176
- await caseClassificationsResponsePromise;
177
- await expect(caseClassification.selectedSuggestion).toHaveValue(
178
- caseClassificationSuggestions[selectedSuggestionIndex].value
179
- );
180
- });
181
- });
182
-
183
- test.describe('when selecting a specific suggestion and then receiving new suggestions that does not contain the previously selected option', () => {
184
- test('should keep the suggestion selected by the user and display it in the select input', async ({
185
- caseClassification,
186
- caseAssist,
187
- }) => {
188
- const selectedSuggestionIndex = 1;
189
- await caseClassification.clickCaseClassificationSuggestionAtIndex(
190
- selectedSuggestionIndex
191
- );
192
- await expect(caseClassification.selectedSuggestion).toHaveValue(
193
- caseClassificationSuggestions[selectedSuggestionIndex].value
194
- );
195
-
196
- caseClassification.mockCaseClassification(coveoDefaultField, [
197
- caseClassificationSuggestions[0],
198
- ]);
199
- const caseClassificationsResponsePromise =
200
- caseAssist.waitForCaseClassificationsResponse();
201
- await caseAssist.fetchClassifications();
202
- await caseClassificationsResponsePromise;
203
-
204
- await expect(caseClassification.allOptionsSelectInput).toHaveText(
205
- caseClassificationSuggestions[selectedSuggestionIndex].value
206
- );
207
- });
208
- });
209
-
210
- test.describe('when selecting an option from the select input and then fetching suggestions', () => {
211
- test('should keep the option selected by the user, display it in the select input and hide the suggestions', async ({
212
- caseClassification,
213
- caseAssist,
214
- }) => {
215
- const selectedOptionIndex = 3;
216
- await caseClassification.clickShowSelectInputButton();
217
- await caseClassification.clickallOptionsSelectInput();
218
- await caseClassification.clickSelectInputOptionAtIndex(
219
- selectedOptionIndex
220
- );
221
-
222
- caseClassification.mockCaseClassification(coveoDefaultField, [
223
- caseClassificationSuggestions[0],
224
- ]);
225
- const caseClassificationsResponsePromise =
226
- caseAssist.waitForCaseClassificationsResponse();
227
- await caseAssist.fetchClassifications();
228
- await caseClassificationsResponsePromise;
229
- await expect(await caseClassification.allOptionsSelectInputValue).toBe(
230
- allOptions[selectedOptionIndex].value
231
- );
232
- await expect(
233
- caseClassification.caseClassificationSuggestions
234
- ).toHaveCount(0);
235
- });
236
- });
237
-
238
- test.describe('when receiving new suggestions without changing the by default auto-selected suggestion', () => {
239
- test('should auto-select the suggestion with the highest confidence from the newly received suggestions', async ({
240
- caseClassification,
241
- caseAssist,
242
- }) => {
243
- const firstAutomaticallySelectedSuggestionIndex = 0;
244
- await expect(caseClassification.selectedSuggestion).toHaveValue(
245
- caseClassificationSuggestions[
246
- firstAutomaticallySelectedSuggestionIndex
247
- ].value
248
- );
249
-
250
- const secondAutomaticallySelectedSuggestionIndex = 1;
251
-
252
- caseClassification.mockCaseClassification(coveoDefaultField, [
253
- caseClassificationSuggestions[
254
- secondAutomaticallySelectedSuggestionIndex
255
- ],
256
- ]);
257
- const caseClassificationsResponsePromise =
258
- caseAssist.waitForCaseClassificationsResponse();
259
- await caseAssist.fetchClassifications();
260
- await caseClassificationsResponsePromise;
261
- await expect(caseClassification.selectedSuggestion).toHaveValue(
262
- caseClassificationSuggestions[
263
- secondAutomaticallySelectedSuggestionIndex
264
- ].value
265
- );
266
- });
267
- });
268
- });
269
- });