@coveo/quantic 3.10.0-pre.faaf12d7a7 → 3.11.0
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/README.md +52 -12
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +7 -0
- package/force-app/main/default/lwc/quanticCaseAssistInterface/quanticCaseAssistInterface.js +8 -0
- package/force-app/main/default/lwc/quanticCategoryFacet/__tests__/quanticCategoryFacet.test.js +108 -1
- package/force-app/main/default/lwc/quanticCategoryFacet/quanticCategoryFacet.js +22 -0
- package/force-app/main/default/lwc/quanticDateFacet/__tests__/quanticDateFacet.test.js +107 -1
- package/force-app/main/default/lwc/quanticDateFacet/quanticDateFacet.js +22 -0
- package/force-app/main/default/lwc/quanticFacet/__tests__/quanticFacet.test.js +106 -1
- package/force-app/main/default/lwc/quanticFacet/quanticFacet.js +21 -1
- package/force-app/main/default/lwc/quanticFeedbackModalQna/__tests__/quanticFeedbackModalQna.test.js +1 -1
- package/force-app/main/default/lwc/quanticFeedbackModalQna/quanticFeedbackModalQna.js +1 -1
- package/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.css +0 -1
- package/force-app/main/default/lwc/quanticGeneratedAnswerContent/templates/generatedMarkdownContent.css +1 -0
- package/force-app/main/default/lwc/quanticInsightInterface/quanticInsightInterface.js +8 -0
- package/force-app/main/default/lwc/quanticNotifications/__tests__/quanticNotifications.test.js +112 -4
- package/force-app/main/default/lwc/quanticNotifications/quanticNotifications.css +8 -0
- package/force-app/main/default/lwc/quanticNotifications/quanticNotifications.html +20 -7
- package/force-app/main/default/lwc/quanticNotifications/quanticNotifications.js +57 -18
- package/force-app/main/default/lwc/quanticNumericFacet/__tests__/quanticNumericFacet.test.js +107 -1
- package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.js +22 -0
- package/force-app/main/default/lwc/quanticRecommendationInterface/quanticRecommendationInterface.js +8 -0
- package/force-app/main/default/lwc/quanticSearchInterface/quanticSearchInterface.js +8 -0
- package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js +107 -1
- package/force-app/main/default/lwc/quanticTimeframeFacet/quanticTimeframeFacet.js +22 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/__tests__/quanticUserActionsToggle.test.js +18 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/data.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/fixture.ts +32 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/pageObject.ts +71 -0
- package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts +39 -0
- package/force-app/main/default/staticresources/coveobueno/browser/bueno.js +3 -18
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +9 -6
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/common/request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/recommendations/recommendations-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/commerce/search/query-suggest/query-suggest-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/knowledge/stream-answer-api.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-case-classifications/get-case-classifications-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/case-assist/get-document-suggestions/get-document-suggestions-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/get-interface/get-interface-config-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/query/query-request.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/service/insight/user-actions/user-actions-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-engine/commerce-engine.ssr.d.ts +4 -13
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/common.d.ts +8 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/factories/build-factory.d.ts +19 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/factories/hydrated-state-factory.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/factories/recommendation-hydrated-state-factory.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/factories/recommendation-static-state-factory.d.ts +3 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/factories/static-state-factory.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/build.d.ts +13 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/common.d.ts +180 -5
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/core-engine.d.ts +29 -10
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/fetch-static-state.d.ts +15 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/from-build-result.d.ts +20 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/hydrate-static-state.d.ts +18 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/logger.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/navigatorContextProvider.d.ts +17 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/ssr-engine/types/common.d.ts +6 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/app/ssr-engine/types/from-build-result.d.ts +1 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/core/parameter-manager/headless-core-parameter-manager.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/field-suggestions/headless-field-suggestions-generator.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/instant-products/headless-instant-products.ssr.d.ts +3 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/product-view/headless-product-view.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recent-queries-list/headless-recent-queries-list.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/recommendations/headless-recommendations.ssr.d.ts +10 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/controllers/commerce/standalone-search-box/headless-standalone-search-box.ssr.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/analytics/search-action-cause.d.ts +0 -82
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-set/facet-set-analytics-actions.d.ts +0 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/history/history-analytics-actions.d.ts +0 -3
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/legacy/search-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +2 -2
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/features/static-filter-set/static-filter-set-actions.d.ts +0 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +4 -4
- package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-engine-v2.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/utils/facet-utils.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/utils/utils.d.ts +4 -0
- package/force-app/main/default/staticresources/coveoheadless/headless.js +11 -8
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +10 -7
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +9 -6
- package/force-app/main/default/staticresources/dompurify/purify.min.js +1339 -2
- package/package.json +23 -19
package/force-app/main/default/lwc/quanticTimeframeFacet/__tests__/quanticTimeframeFacet.test.js
CHANGED
|
@@ -12,17 +12,22 @@ jest.mock('c/quanticUtils', () => ({
|
|
|
12
12
|
DATEFACETS: 'dateFacets',
|
|
13
13
|
},
|
|
14
14
|
},
|
|
15
|
+
I18nUtils: {
|
|
16
|
+
format: jest.fn(),
|
|
17
|
+
},
|
|
15
18
|
}));
|
|
16
19
|
jest.mock('c/quanticHeadlessLoader');
|
|
17
20
|
|
|
18
21
|
const selectors = {
|
|
19
22
|
facetContent: '[data-test="facet-content"]',
|
|
23
|
+
componentError: 'c-quantic-component-error',
|
|
20
24
|
};
|
|
21
25
|
|
|
22
26
|
const exampleFacetId = 'example facet id';
|
|
27
|
+
const exampleField = 'exampleField';
|
|
23
28
|
const exampleFilterId = `${exampleFacetId}_input`;
|
|
24
29
|
const defaultOptions = {
|
|
25
|
-
field:
|
|
30
|
+
field: exampleField,
|
|
26
31
|
};
|
|
27
32
|
const timeframeFacetControllerMock = {
|
|
28
33
|
subscribe: jest.fn((callback) => callback()),
|
|
@@ -31,6 +36,8 @@ const timeframeFacetControllerMock = {
|
|
|
31
36
|
values: [],
|
|
32
37
|
},
|
|
33
38
|
};
|
|
39
|
+
const parentFacetIdError = `The ${exampleField} c-quantic-timeframe-facet requires dependsOn.parentFacetId to be a valid string.`;
|
|
40
|
+
const expectedValueError = `The ${exampleField} c-quantic-timeframe-facet requires dependsOn.expectedValue to be a valid string.`;
|
|
34
41
|
|
|
35
42
|
function createTestComponent(options = defaultOptions) {
|
|
36
43
|
prepareHeadlessState();
|
|
@@ -87,6 +94,21 @@ const exampleEngine = {
|
|
|
87
94
|
};
|
|
88
95
|
let isInitialized = false;
|
|
89
96
|
|
|
97
|
+
function mockBueno() {
|
|
98
|
+
// @ts-ignore
|
|
99
|
+
mockHeadlessLoader.getBueno = () => {
|
|
100
|
+
// @ts-ignore
|
|
101
|
+
global.Bueno = {
|
|
102
|
+
isString: jest
|
|
103
|
+
.fn()
|
|
104
|
+
.mockImplementation(
|
|
105
|
+
(value) => Object.prototype.toString.call(value) === '[object String]'
|
|
106
|
+
),
|
|
107
|
+
};
|
|
108
|
+
return new Promise((resolve) => resolve());
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
90
112
|
function mockSuccessfulHeadlessInitialization() {
|
|
91
113
|
// @ts-ignore
|
|
92
114
|
mockHeadlessLoader.initializeWithHeadless = (element, _, initialize) => {
|
|
@@ -109,6 +131,7 @@ function cleanup() {
|
|
|
109
131
|
describe('c-quantic-timeframe-facet', () => {
|
|
110
132
|
beforeAll(() => {
|
|
111
133
|
mockSuccessfulHeadlessInitialization();
|
|
134
|
+
mockBueno();
|
|
112
135
|
});
|
|
113
136
|
|
|
114
137
|
afterEach(() => {
|
|
@@ -211,6 +234,89 @@ describe('c-quantic-timeframe-facet', () => {
|
|
|
211
234
|
});
|
|
212
235
|
});
|
|
213
236
|
|
|
237
|
+
describe('validation of the dependsOn property', () => {
|
|
238
|
+
let consoleError;
|
|
239
|
+
beforeAll(() => {
|
|
240
|
+
consoleError = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
241
|
+
});
|
|
242
|
+
describe('when dependsOn.parentFacetId is not provided', () => {
|
|
243
|
+
it('should display the error component', async () => {
|
|
244
|
+
const invalidFacetDependency = {
|
|
245
|
+
expectedValue: 'txt',
|
|
246
|
+
};
|
|
247
|
+
const element = createTestComponent({
|
|
248
|
+
...defaultOptions,
|
|
249
|
+
dependsOn: invalidFacetDependency,
|
|
250
|
+
});
|
|
251
|
+
await flushPromises();
|
|
252
|
+
|
|
253
|
+
const componentError = element.shadowRoot.querySelector(
|
|
254
|
+
selectors.componentError
|
|
255
|
+
);
|
|
256
|
+
const facetContent = element.shadowRoot.querySelector(
|
|
257
|
+
selectors.facetContent
|
|
258
|
+
);
|
|
259
|
+
|
|
260
|
+
expect(consoleError).toHaveBeenCalledTimes(1);
|
|
261
|
+
expect(consoleError).toHaveBeenCalledWith(parentFacetIdError);
|
|
262
|
+
expect(componentError).not.toBeNull();
|
|
263
|
+
expect(facetContent).toBeNull();
|
|
264
|
+
});
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
describe('when dependsOn.parentFacetId is not a string', () => {
|
|
268
|
+
it('should display the error component', async () => {
|
|
269
|
+
const invalidFacetDependency = {
|
|
270
|
+
parentFacetId: 1,
|
|
271
|
+
expectedValue: 'txt',
|
|
272
|
+
};
|
|
273
|
+
const element = createTestComponent({
|
|
274
|
+
...defaultOptions,
|
|
275
|
+
dependsOn: invalidFacetDependency,
|
|
276
|
+
});
|
|
277
|
+
await flushPromises();
|
|
278
|
+
|
|
279
|
+
const componentError = element.shadowRoot.querySelector(
|
|
280
|
+
selectors.componentError
|
|
281
|
+
);
|
|
282
|
+
const facetContent = element.shadowRoot.querySelector(
|
|
283
|
+
selectors.facetContent
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
expect(consoleError).toHaveBeenCalledTimes(1);
|
|
287
|
+
expect(consoleError).toHaveBeenCalledWith(parentFacetIdError);
|
|
288
|
+
expect(componentError).not.toBeNull();
|
|
289
|
+
expect(facetContent).toBeNull();
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
describe('when dependsOn.expectedValue is not a string', () => {
|
|
294
|
+
it('should display the error component', async () => {
|
|
295
|
+
const invalidFacetDependency = {
|
|
296
|
+
parentFacetId: 'filetype',
|
|
297
|
+
expectedValue: 2,
|
|
298
|
+
};
|
|
299
|
+
const element = createTestComponent({
|
|
300
|
+
...defaultOptions,
|
|
301
|
+
dependsOn: invalidFacetDependency,
|
|
302
|
+
});
|
|
303
|
+
await flushPromises();
|
|
304
|
+
|
|
305
|
+
const componentError = element.shadowRoot.querySelector(
|
|
306
|
+
selectors.componentError
|
|
307
|
+
);
|
|
308
|
+
const facetContent = element.shadowRoot.querySelector(
|
|
309
|
+
selectors.facetContent
|
|
310
|
+
);
|
|
311
|
+
|
|
312
|
+
expect(consoleError).toHaveBeenCalledTimes(1);
|
|
313
|
+
expect(consoleError).toHaveBeenCalledWith(expectedValueError);
|
|
314
|
+
expect(componentError).not.toBeNull();
|
|
315
|
+
expect(facetContent).toBeNull();
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
|
|
214
320
|
describe('when the component is disconnected', () => {
|
|
215
321
|
it('should make the condition manager stop watching the facet', async () => {
|
|
216
322
|
const exampleFacetDependency = {
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
initializeWithHeadless,
|
|
13
13
|
registerComponentForInit,
|
|
14
14
|
registerToStore,
|
|
15
|
+
getBueno,
|
|
15
16
|
} from 'c/quanticHeadlessLoader';
|
|
16
17
|
import {
|
|
17
18
|
DateUtils,
|
|
@@ -414,6 +415,7 @@ export default class QuanticTimeframeFacet extends LightningElement {
|
|
|
414
415
|
* @param {SearchEngine} engine
|
|
415
416
|
*/
|
|
416
417
|
initialize = (engine) => {
|
|
418
|
+
this.validateDependsOnProperty();
|
|
417
419
|
this.headless = getHeadlessBundle(this.engineId);
|
|
418
420
|
this.initializeSearchStatusController(engine);
|
|
419
421
|
this.initializeFacetController(engine);
|
|
@@ -427,6 +429,26 @@ export default class QuanticTimeframeFacet extends LightningElement {
|
|
|
427
429
|
});
|
|
428
430
|
};
|
|
429
431
|
|
|
432
|
+
validateDependsOnProperty() {
|
|
433
|
+
if (this.dependsOn) {
|
|
434
|
+
getBueno(this).then(() => {
|
|
435
|
+
const {parentFacetId, expectedValue} = this.dependsOn;
|
|
436
|
+
if (!Bueno.isString(parentFacetId)) {
|
|
437
|
+
console.error(
|
|
438
|
+
`The ${this.field} ${this.template.host.localName} requires dependsOn.parentFacetId to be a valid string.`
|
|
439
|
+
);
|
|
440
|
+
this.setInitializationError();
|
|
441
|
+
}
|
|
442
|
+
if (expectedValue && !Bueno.isString(expectedValue)) {
|
|
443
|
+
console.error(
|
|
444
|
+
`The ${this.field} ${this.template.host.localName} requires dependsOn.expectedValue to be a valid string.`
|
|
445
|
+
);
|
|
446
|
+
this.setInitializationError();
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
430
452
|
/**
|
|
431
453
|
* @param {SearchEngine} engine
|
|
432
454
|
*/
|
|
@@ -119,6 +119,24 @@ describe('c-quantic-user-actions-toggle', () => {
|
|
|
119
119
|
cleanup();
|
|
120
120
|
});
|
|
121
121
|
|
|
122
|
+
describe('controller initialization', () => {
|
|
123
|
+
it('should build the controller with the right parameters', async () => {
|
|
124
|
+
createTestComponent();
|
|
125
|
+
await flushPromises();
|
|
126
|
+
|
|
127
|
+
expect(functionsMocks.buildUserActions).toHaveBeenCalledTimes(1);
|
|
128
|
+
expect(functionsMocks.buildUserActions).toHaveBeenCalledWith(
|
|
129
|
+
exampleEngine,
|
|
130
|
+
{
|
|
131
|
+
options: {
|
|
132
|
+
ticketCreationDate: exampleTicketCreationDateTime,
|
|
133
|
+
excludedCustomActions: exampleExcludedCustomActions,
|
|
134
|
+
},
|
|
135
|
+
}
|
|
136
|
+
);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
122
140
|
it('should display the user actions toggle button', async () => {
|
|
123
141
|
const element = createTestComponent();
|
|
124
142
|
await flushPromises();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const followingSessionsActions = [
|
|
2
|
+
{
|
|
3
|
+
name: 'CUSTOM',
|
|
4
|
+
value:
|
|
5
|
+
'{"event_type":"example","event_value":"exampleCustomAction","origin_level_1":"default"}',
|
|
6
|
+
time: new Date('2024-09-01T15:30:00Z').valueOf(),
|
|
7
|
+
},
|
|
8
|
+
];
|
|
9
|
+
|
|
10
|
+
const ticketCreationSessionActions = [
|
|
11
|
+
{
|
|
12
|
+
name: 'CUSTOM',
|
|
13
|
+
value:
|
|
14
|
+
'{"event_type":"errors","event_value":"One","origin_level_1":"default","origin_level_2":"default"}',
|
|
15
|
+
time: new Date('2024-08-30T00:10:00Z').valueOf(),
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const precedingSessionsActions = [
|
|
20
|
+
{
|
|
21
|
+
name: 'CUSTOM',
|
|
22
|
+
value:
|
|
23
|
+
'{"event_type":"example","event_value":"exampleCustomAction","origin_level_1":"default"}',
|
|
24
|
+
time: new Date('2024-08-29T15:40:00Z').valueOf(),
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export const exampleUserActionsData = [
|
|
29
|
+
...followingSessionsActions,
|
|
30
|
+
...ticketCreationSessionActions,
|
|
31
|
+
...precedingSessionsActions,
|
|
32
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {quanticBase} from '../../../../../../playwright/fixtures/baseFixture';
|
|
2
|
+
import {UserActionsToggleObject} from './pageObject';
|
|
3
|
+
import {exampleUserActionsData} from './data';
|
|
4
|
+
|
|
5
|
+
const pageUrl = 's/quantic-user-actions-toggle';
|
|
6
|
+
|
|
7
|
+
interface UserActionsToggleOptions {
|
|
8
|
+
userId: string;
|
|
9
|
+
ticketCreationDateTime: string;
|
|
10
|
+
}
|
|
11
|
+
type QuanticUserActionsToggleE2EFixtures = {
|
|
12
|
+
userActionsToggle: UserActionsToggleObject;
|
|
13
|
+
options: UserActionsToggleOptions;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const testInsight =
|
|
17
|
+
quanticBase.extend<QuanticUserActionsToggleE2EFixtures>({
|
|
18
|
+
options: {
|
|
19
|
+
userId: 'someone@company.com',
|
|
20
|
+
ticketCreationDateTime: '2024-01-01T00:00:00Z',
|
|
21
|
+
},
|
|
22
|
+
userActionsToggle: async ({page, options, configuration}, use) => {
|
|
23
|
+
await page.goto(pageUrl);
|
|
24
|
+
configuration.configure({...options});
|
|
25
|
+
const userActionsToggleObject = new UserActionsToggleObject(page);
|
|
26
|
+
userActionsToggleObject.mockUserActions(exampleUserActionsData);
|
|
27
|
+
await userActionsToggleObject.waitForUserActionsResponse(options.userId);
|
|
28
|
+
await use(userActionsToggleObject);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export {expect} from '@playwright/test';
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {Locator, Page, Request, Response} from '@playwright/test';
|
|
2
|
+
import {isUaCustomEvent} from '../../../../../../playwright/utils/requests';
|
|
3
|
+
|
|
4
|
+
const userActionsRequestRegex =
|
|
5
|
+
/\/rest\/organizations\/.*\/machinelearning\/user\/actions$/;
|
|
6
|
+
|
|
7
|
+
export class UserActionsToggleObject {
|
|
8
|
+
constructor(public page: Page) {
|
|
9
|
+
this.page = page;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get userActionsToggleButton(): Locator {
|
|
13
|
+
return this.page.getByRole('button', {name: /User actions/i});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get userActionsModal(): Locator {
|
|
17
|
+
return this.page.locator(
|
|
18
|
+
'c-quantic-user-actions-toggle > c-quantic-modal > div'
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get userActionsModalCloseButton(): Locator {
|
|
23
|
+
return this.page
|
|
24
|
+
.locator('c-quantic-user-actions-toggle > c-quantic-modal')
|
|
25
|
+
.getByRole('button', {name: 'Close'});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async mockUserActions(
|
|
29
|
+
userActions: Array<{name: string; value: string; time: number}>
|
|
30
|
+
) {
|
|
31
|
+
await this.page.route(userActionsRequestRegex, async (route) => {
|
|
32
|
+
const body = {value: userActions};
|
|
33
|
+
|
|
34
|
+
await route.fulfill({
|
|
35
|
+
body: JSON.stringify(body),
|
|
36
|
+
status: 200,
|
|
37
|
+
headers: {
|
|
38
|
+
'content-type': 'text/html',
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
async waitForUserActionsResponse(userId: string): Promise<Response> {
|
|
45
|
+
return this.page.waitForResponse((response) => {
|
|
46
|
+
const request = response.request();
|
|
47
|
+
if (request.url().match(userActionsRequestRegex)) {
|
|
48
|
+
const requestBody = request.postDataJSON?.();
|
|
49
|
+
return requestBody?.objectId === userId;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async waitForOpenUserActionsUaAnalytics(): Promise<Request> {
|
|
56
|
+
const uaRequest = this.page.waitForRequest((request) => {
|
|
57
|
+
if (isUaCustomEvent(request)) {
|
|
58
|
+
const requestBody = request.postDataJSON?.();
|
|
59
|
+
const expectedFields = {
|
|
60
|
+
eventType: 'User Actions',
|
|
61
|
+
eventValue: 'openUserActions',
|
|
62
|
+
};
|
|
63
|
+
return Object.keys(expectedFields).every(
|
|
64
|
+
(key) => requestBody?.[key] === expectedFields[key]
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
});
|
|
69
|
+
return uaRequest;
|
|
70
|
+
}
|
|
71
|
+
}
|
package/force-app/main/default/lwc/quanticUserActionsToggle/e2e/quanticUserActionsToggle.e2e.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {testInsight, expect} from './fixture';
|
|
2
|
+
|
|
3
|
+
const exampleUserId = 'exampleUserId';
|
|
4
|
+
const exampleTicketCreateDateTime = encodeURIComponent('2024-08-30');
|
|
5
|
+
|
|
6
|
+
testInsight.use({
|
|
7
|
+
options: {
|
|
8
|
+
userId: exampleUserId,
|
|
9
|
+
ticketCreationDateTime: exampleTicketCreateDateTime,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
testInsight.describe('quantic user actions toggle', () => {
|
|
14
|
+
testInsight.describe('when opening the user action modal', () => {
|
|
15
|
+
testInsight(
|
|
16
|
+
'should open the user actions timeline and log analytics',
|
|
17
|
+
async ({userActionsToggle}) => {
|
|
18
|
+
await expect(userActionsToggle.userActionsModal).not.toBeVisible();
|
|
19
|
+
const uaPromise = userActionsToggle.waitForOpenUserActionsUaAnalytics();
|
|
20
|
+
await userActionsToggle.userActionsToggleButton.click();
|
|
21
|
+
await expect(userActionsToggle.userActionsModal).toBeVisible();
|
|
22
|
+
await uaPromise;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
testInsight.describe('when closing the user action modal', () => {
|
|
28
|
+
testInsight(
|
|
29
|
+
'should close the user actions timeline',
|
|
30
|
+
async ({userActionsToggle}) => {
|
|
31
|
+
await expect(userActionsToggle.userActionsModal).not.toBeVisible();
|
|
32
|
+
await userActionsToggle.userActionsToggleButton.click();
|
|
33
|
+
await expect(userActionsToggle.userActionsModal).toBeVisible();
|
|
34
|
+
await userActionsToggle.userActionsModalCloseButton.click();
|
|
35
|
+
await expect(userActionsToggle.userActionsModal).not.toBeVisible();
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
});
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/(function
|
|
17
|
+
*/(function(g,f){if(typeof exports=="object"&&typeof module<"u"){module.exports=f()}else if("function"==typeof define && define.amd){define("Bueno",f)}else {g["Bueno"]=f()}}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : this,function(){var exports={};var __exports=exports;var module={exports};
|
|
18
18
|
"use strict";
|
|
19
19
|
var __defProp = Object.defineProperty;
|
|
20
20
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -393,20 +393,5 @@ var EnumValue = class {
|
|
|
393
393
|
return this.value.required;
|
|
394
394
|
}
|
|
395
395
|
};
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
if ((from && typeof from === "object") || typeof from === "function") {
|
|
399
|
-
for (let key of Object.getOwnPropertyNames(from)) {
|
|
400
|
-
if (!Object.prototype.hasOwnProperty.call(to, key) && key !== except)
|
|
401
|
-
Object.defineProperty(to, key, {
|
|
402
|
-
get: () => from[key],
|
|
403
|
-
enumerable: !(desc = Object.getOwnPropertyDescriptor(from, key)) || desc.enumerable,
|
|
404
|
-
});
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
return to;
|
|
408
|
-
};
|
|
409
|
-
module.exports = __cp(module.exports, exports);
|
|
410
|
-
}
|
|
411
|
-
return module.exports;
|
|
412
|
-
}))
|
|
396
|
+
|
|
397
|
+
if(__exports != exports)module.exports = exports;return module.exports}));
|