coveo.analytics 2.30.56 → 2.32.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 +37 -43
- package/dist/browser.mjs +513 -357
- package/dist/coveoua.browser.js +1 -1
- package/dist/coveoua.browser.js.map +1 -1
- package/dist/coveoua.debug.js +542 -359
- package/dist/coveoua.debug.js.map +1 -1
- package/dist/coveoua.js +1 -1
- package/dist/coveoua.js.map +1 -1
- package/dist/definitions/client/analytics.d.ts +3 -2
- package/dist/definitions/client/runtimeEnvironment.d.ts +1 -1
- package/dist/definitions/donottrack.d.ts +1 -0
- package/dist/definitions/react-native/index.d.ts +1 -2
- package/dist/definitions/version.d.ts +1 -1
- package/dist/library.cjs +15350 -3699
- package/dist/library.es.js +513 -357
- package/dist/library.js +15350 -3699
- package/dist/library.mjs +15350 -3699
- package/dist/react-native.es.js +634 -460
- package/modules/package.json +9 -9
- package/package.json +60 -91
- package/react-native/package.json +7 -7
- package/src/caseAssist/caseAssistActions.ts +51 -50
- package/src/caseAssist/caseAssistClient.spec.ts +328 -297
- package/src/caseAssist/caseAssistClient.ts +201 -185
- package/src/client/analytics.spec.ts +724 -703
- package/src/client/analytics.ts +677 -602
- package/src/client/analyticsBeaconClient.spec.ts +195 -188
- package/src/client/analyticsBeaconClient.ts +99 -88
- package/src/client/analyticsFetchClient.ts +77 -61
- package/src/client/analyticsRequestClient.ts +17 -17
- package/src/client/location.ts +3 -3
- package/src/client/measurementProtocolMapper.ts +54 -45
- package/src/client/measurementProtocolMapping/baseMeasurementProtocolMapper.ts +48 -44
- package/src/client/measurementProtocolMapping/commerceMeasurementProtocolMapper.ts +133 -121
- package/src/client/measurementProtocolMapping/serviceMeasurementProtocolMapper.ts +17 -17
- package/src/client/noopAnalytics.ts +80 -68
- package/src/client/runtimeEnvironment.ts +50 -41
- package/src/client/utils.spec.ts +112 -97
- package/src/client/utils.ts +39 -39
- package/src/cookieutils.spec.ts +59 -0
- package/src/cookieutils.ts +40 -39
- package/src/coveoua/browser.ts +14 -12
- package/src/coveoua/library.ts +4 -4
- package/src/coveoua/plugins.ts +36 -34
- package/src/coveoua/simpleanalytics.spec.ts +467 -452
- package/src/coveoua/simpleanalytics.ts +146 -140
- package/src/detector.ts +17 -17
- package/src/donottrack.spec.ts +199 -121
- package/src/donottrack.ts +31 -8
- package/src/events.ts +86 -79
- package/src/formatting/format-array-for-coveo-custom-data.spec.ts +13 -12
- package/src/formatting/format-array-for-coveo-custom-data.ts +18 -18
- package/src/formatting/format-omnibox-metadata.ts +16 -12
- package/src/history.spec.ts +197 -195
- package/src/history.ts +143 -133
- package/src/hook/addDefaultValues.ts +13 -8
- package/src/hook/enhanceViewEvent.ts +17 -17
- package/src/insight/insightClient.spec.ts +1848 -1717
- package/src/insight/insightClient.ts +866 -761
- package/src/insight/insightEvents.ts +57 -56
- package/src/plugins/BasePlugin.ts +125 -121
- package/src/plugins/ec.spec.ts +457 -429
- package/src/plugins/ec.ts +202 -199
- package/src/plugins/link.spec.ts +183 -159
- package/src/plugins/link.ts +88 -85
- package/src/plugins/svc.spec.ts +161 -155
- package/src/plugins/svc.ts +93 -91
- package/src/react-native/index.ts +8 -1
- package/src/react-native/react-native-runtime.ts +33 -33
- package/src/react-native/react-native-utils.ts +1 -1
- package/src/react-native/react-native.spec.ts +31 -21
- package/src/searchPage/searchPageClient.spec.ts +1944 -1794
- package/src/searchPage/searchPageClient.ts +1261 -1040
- package/src/searchPage/searchPageEvents.ts +524 -511
- package/src/storage.spec.ts +51 -51
- package/src/storage.ts +47 -47
- package/dist/definitions/bundle/browser-fetch.d.ts +0 -1
- package/dist/definitions/src/coveoua/browser.d.ts +0 -6
- package/dist/definitions/src/coveoua/headless.d.ts +0 -6
- package/dist/definitions/src/coveoua/library.d.ts +0 -17
- package/dist/definitions/src/coveoua/plugins.d.ts +0 -10
- package/dist/definitions/src/coveoua/simpleanalytics.d.ts +0 -33
- package/dist/definitions/src/react-native/index.d.ts +0 -3
- package/dist/definitions/src/react-native/react-native-runtime.d.ts +0 -19
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {vi} from 'vitest';
|
|
2
|
+
import type {Mock} from 'vitest';
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
CoveoSearchPageClient,
|
|
5
|
+
EventDescription,
|
|
6
|
+
SearchPageClientProvider,
|
|
7
|
+
} from './searchPageClient';
|
|
8
|
+
import {
|
|
9
|
+
SearchPageEvents,
|
|
10
|
+
PartialDocumentInformation,
|
|
11
|
+
CustomEventsTypes,
|
|
12
|
+
OmniboxSuggestionsMetadata,
|
|
13
|
+
StaticFilterToggleValueMetadata,
|
|
14
|
+
GeneratedAnswerFeedbackReason,
|
|
15
|
+
GeneratedAnswerRephraseFormat,
|
|
16
|
+
GeneratedAnswerFeedbackReasonOption,
|
|
11
17
|
} from './searchPageEvents';
|
|
12
18
|
import CoveoAnalyticsClient from '../client/analytics';
|
|
13
19
|
import {NoopAnalytics} from '../client/noopAnalytics';
|
|
@@ -15,1815 +21,1959 @@ import {mockFetch, lastCallBody} from '../../tests/fetchMock';
|
|
|
15
21
|
import doNotTrack from '../donottrack';
|
|
16
22
|
import {Cookie} from '../cookieutils';
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
vi.mock('../donottrack', () => {
|
|
25
|
+
const doNotTrack = vi.fn();
|
|
26
|
+
return {
|
|
27
|
+
__esModule: true,
|
|
28
|
+
default: doNotTrack,
|
|
29
|
+
doNotTrack,
|
|
30
|
+
shouldDisableAnalyticsForPrivacy: (disableBrowserPrivacySignals?: boolean) =>
|
|
31
|
+
disableBrowserPrivacySignals === true ? false : doNotTrack(),
|
|
32
|
+
};
|
|
23
33
|
});
|
|
24
34
|
const {fetchMock, fetchMockBeforeEach} = mockFetch();
|
|
25
35
|
|
|
26
36
|
describe('SearchPageClient', () => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
it('should send proper payload for #logTriggerQuery', async () => {
|
|
476
|
-
const meta = {
|
|
477
|
-
query: 'queryText',
|
|
478
|
-
};
|
|
479
|
-
await client.logTriggerQuery();
|
|
480
|
-
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
481
|
-
});
|
|
482
|
-
|
|
483
|
-
it('should send proper payload for #makeTriggerQuery', async () => {
|
|
484
|
-
const meta = {
|
|
485
|
-
query: 'queryText',
|
|
486
|
-
};
|
|
487
|
-
const built = await client.makeTriggerQuery();
|
|
488
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
489
|
-
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
490
|
-
expectMatchDescription(built.description, SearchPageEvents.triggerQuery, meta);
|
|
491
|
-
});
|
|
492
|
-
|
|
493
|
-
it('should send proper payload for #logUndoTriggerQuery', async () => {
|
|
494
|
-
const meta = {
|
|
495
|
-
undoneQuery: 'foo',
|
|
496
|
-
};
|
|
497
|
-
await client.logUndoTriggerQuery(meta);
|
|
498
|
-
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
it('should send proper payload for #makeUndoTriggerQuery', async () => {
|
|
502
|
-
const meta = {
|
|
503
|
-
undoneQuery: 'foo',
|
|
504
|
-
};
|
|
505
|
-
const built = await client.makeUndoTriggerQuery(meta);
|
|
506
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
507
|
-
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
508
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.undoTriggerQuery, meta);
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
it('should send proper payload for #logTriggerRedirect', async () => {
|
|
512
|
-
const meta = {
|
|
513
|
-
redirectedTo: 'foo',
|
|
514
|
-
query: provider.getSearchEventRequestPayload().queryText,
|
|
515
|
-
};
|
|
516
|
-
await client.logTriggerRedirect(meta);
|
|
517
|
-
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
it('should send proper payload for #makeTriggerRedirect', async () => {
|
|
521
|
-
const meta = {
|
|
522
|
-
redirectedTo: 'foo',
|
|
523
|
-
query: provider.getSearchEventRequestPayload().queryText,
|
|
524
|
-
};
|
|
525
|
-
const built = await client.makeTriggerRedirect(meta);
|
|
526
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
527
|
-
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
528
|
-
expectMatchDescription(built.description, SearchPageEvents.triggerRedirect, meta);
|
|
529
|
-
});
|
|
530
|
-
|
|
531
|
-
it('should send proper payload for #logPagerResize', async () => {
|
|
532
|
-
const meta = {
|
|
533
|
-
currentResultsPerPage: 123,
|
|
534
|
-
};
|
|
535
|
-
await client.logPagerResize(meta);
|
|
536
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
537
|
-
});
|
|
538
|
-
|
|
539
|
-
it('should send proper payload for #makePagerResize', async () => {
|
|
540
|
-
const meta = {
|
|
541
|
-
currentResultsPerPage: 123,
|
|
542
|
-
};
|
|
543
|
-
const built = await client.makePagerResize(meta);
|
|
544
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
545
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
546
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerResize, meta);
|
|
547
|
-
});
|
|
548
|
-
|
|
549
|
-
it('should send proper payload for #logPagerNumber', async () => {
|
|
550
|
-
const meta = {pagerNumber: 123};
|
|
551
|
-
await client.logPagerNumber(meta);
|
|
552
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
553
|
-
});
|
|
554
|
-
|
|
555
|
-
it('should send proper payload for #makePagerNumber', async () => {
|
|
556
|
-
const meta = {pagerNumber: 123};
|
|
557
|
-
const built = await client.makePagerNumber(meta);
|
|
558
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
559
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
560
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerNumber, meta);
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
it('should send proper payload for #logPagerNext', async () => {
|
|
564
|
-
const meta = {pagerNumber: 123};
|
|
565
|
-
await client.logPagerNext(meta);
|
|
566
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
it('should send proper payload for #makePagerNext', async () => {
|
|
570
|
-
const meta = {pagerNumber: 123};
|
|
571
|
-
const built = await client.makePagerNext(meta);
|
|
572
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
573
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
574
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerNext, meta);
|
|
575
|
-
});
|
|
576
|
-
|
|
577
|
-
it('should send proper payload for #logPagerPrevious', async () => {
|
|
578
|
-
const meta = {pagerNumber: 123};
|
|
579
|
-
await client.logPagerPrevious(meta);
|
|
580
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
it('should send proper payload for #makePagerPrevious', async () => {
|
|
584
|
-
const meta = {pagerNumber: 123};
|
|
585
|
-
const built = await client.makePagerPrevious(meta);
|
|
586
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
587
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
588
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerPrevious, meta);
|
|
589
|
-
});
|
|
590
|
-
|
|
591
|
-
it('should send proper payload for #logPagerScrolling', async () => {
|
|
592
|
-
await client.logPagerScrolling();
|
|
593
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
594
|
-
});
|
|
595
|
-
|
|
596
|
-
it('should send proper payload for #makePagerScrolling', async () => {
|
|
597
|
-
const built = await client.makePagerScrolling();
|
|
598
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
599
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
600
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);
|
|
601
|
-
});
|
|
602
|
-
|
|
603
|
-
it('should send the proper payload for #logStaticFilterClearAll', async () => {
|
|
604
|
-
const staticFilterId = 'filetypes';
|
|
605
|
-
await client.logStaticFilterClearAll({staticFilterId});
|
|
606
|
-
|
|
607
|
-
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
608
|
-
});
|
|
609
|
-
|
|
610
|
-
it('should send the proper payload for #makeStaticFilterClearAll', async () => {
|
|
611
|
-
const staticFilterId = 'filetypes';
|
|
612
|
-
const built = await client.makeStaticFilterClearAll({staticFilterId});
|
|
613
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
614
|
-
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
615
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
616
|
-
});
|
|
617
|
-
|
|
618
|
-
it('should send the proper payload for #logStaticFilterSelect', async () => {
|
|
619
|
-
const meta: StaticFilterToggleValueMetadata = {
|
|
620
|
-
staticFilterId: 'filetypes',
|
|
621
|
-
staticFilterValue: {
|
|
622
|
-
caption: 'Youtube',
|
|
623
|
-
expression: '@filetype="youtubevideo"',
|
|
624
|
-
},
|
|
625
|
-
};
|
|
626
|
-
await client.logStaticFilterSelect(meta);
|
|
627
|
-
|
|
628
|
-
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
629
|
-
});
|
|
630
|
-
|
|
631
|
-
it('should send the proper payload for #makeStaticFilterSelect', async () => {
|
|
632
|
-
const meta: StaticFilterToggleValueMetadata = {
|
|
633
|
-
staticFilterId: 'filetypes',
|
|
634
|
-
staticFilterValue: {
|
|
635
|
-
caption: 'Youtube',
|
|
636
|
-
expression: '@filetype="youtubevideo"',
|
|
637
|
-
},
|
|
638
|
-
};
|
|
639
|
-
const built = await client.makeStaticFilterSelect(meta);
|
|
640
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
641
|
-
|
|
642
|
-
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
643
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.staticFilterSelect, meta);
|
|
644
|
-
});
|
|
645
|
-
|
|
646
|
-
it('should send the proper payload for #logStaticFilterDeselect', async () => {
|
|
647
|
-
const meta: StaticFilterToggleValueMetadata = {
|
|
648
|
-
staticFilterId: 'filetypes',
|
|
649
|
-
staticFilterValue: {
|
|
650
|
-
caption: 'Youtube',
|
|
651
|
-
expression: '@filetype="youtubevideo"',
|
|
652
|
-
},
|
|
653
|
-
};
|
|
654
|
-
await client.logStaticFilterDeselect(meta);
|
|
655
|
-
|
|
656
|
-
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
657
|
-
});
|
|
658
|
-
|
|
659
|
-
it('should send the proper payload for #makeStaticFilterDeselect', async () => {
|
|
660
|
-
const meta: StaticFilterToggleValueMetadata = {
|
|
661
|
-
staticFilterId: 'filetypes',
|
|
662
|
-
staticFilterValue: {
|
|
663
|
-
caption: 'Youtube',
|
|
664
|
-
expression: '@filetype="youtubevideo"',
|
|
665
|
-
},
|
|
666
|
-
};
|
|
667
|
-
const built = await client.makeStaticFilterDeselect(meta);
|
|
668
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
669
|
-
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
670
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.staticFilterDeselect, meta);
|
|
671
|
-
});
|
|
672
|
-
|
|
673
|
-
it('should send proper payload for #logFacetSearch', async () => {
|
|
674
|
-
const meta = {
|
|
675
|
-
facetField: '@foo',
|
|
676
|
-
facetId: 'bar',
|
|
677
|
-
facetTitle: 'title',
|
|
678
|
-
};
|
|
679
|
-
await client.logFacetSearch(meta);
|
|
680
|
-
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
681
|
-
});
|
|
682
|
-
|
|
683
|
-
it('should send proper payload for #makeFacetSearch', async () => {
|
|
684
|
-
const meta = {
|
|
685
|
-
facetField: '@foo',
|
|
686
|
-
facetId: 'bar',
|
|
687
|
-
facetTitle: 'title',
|
|
688
|
-
};
|
|
689
|
-
const built = await client.makeFacetSearch(meta);
|
|
690
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
691
|
-
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
692
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSearch, meta);
|
|
693
|
-
});
|
|
694
|
-
|
|
695
|
-
it('should send proper payload for #logFacetSelect', async () => {
|
|
696
|
-
const meta = {
|
|
697
|
-
facetField: '@foo',
|
|
698
|
-
facetId: 'bar',
|
|
699
|
-
facetTitle: 'title',
|
|
700
|
-
facetValue: 'qwerty',
|
|
701
|
-
};
|
|
702
|
-
|
|
703
|
-
await client.logFacetSelect(meta);
|
|
704
|
-
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
705
|
-
});
|
|
706
|
-
|
|
707
|
-
it('should send proper payload for #makeFacetSelect', async () => {
|
|
708
|
-
const meta = {
|
|
709
|
-
facetField: '@foo',
|
|
710
|
-
facetId: 'bar',
|
|
711
|
-
facetTitle: 'title',
|
|
712
|
-
facetValue: 'qwerty',
|
|
713
|
-
};
|
|
714
|
-
const built = await client.makeFacetSelect(meta);
|
|
715
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
716
|
-
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
717
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSelect, meta);
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
it('should send proper payload for #logFacetDeselect', async () => {
|
|
721
|
-
const meta = {
|
|
722
|
-
facetField: '@foo',
|
|
723
|
-
facetId: 'bar',
|
|
724
|
-
facetTitle: 'title',
|
|
725
|
-
facetValue: 'qwerty',
|
|
726
|
-
};
|
|
727
|
-
|
|
728
|
-
await client.logFacetDeselect(meta);
|
|
729
|
-
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
730
|
-
});
|
|
731
|
-
|
|
732
|
-
it('should send proper payload for #makeFacetDeselect', async () => {
|
|
733
|
-
const meta = {
|
|
734
|
-
facetField: '@foo',
|
|
735
|
-
facetId: 'bar',
|
|
736
|
-
facetTitle: 'title',
|
|
737
|
-
facetValue: 'qwerty',
|
|
738
|
-
};
|
|
739
|
-
|
|
740
|
-
const built = await client.makeFacetDeselect(meta);
|
|
741
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
742
|
-
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
743
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetDeselect, meta);
|
|
744
|
-
});
|
|
745
|
-
|
|
746
|
-
it('should send proper payload for #logFacetExclude', async () => {
|
|
747
|
-
const meta = {
|
|
748
|
-
facetField: '@foo',
|
|
749
|
-
facetId: 'bar',
|
|
750
|
-
facetTitle: 'title',
|
|
751
|
-
facetValue: 'qwerty',
|
|
752
|
-
};
|
|
753
|
-
await client.logFacetExclude(meta);
|
|
754
|
-
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
755
|
-
});
|
|
756
|
-
|
|
757
|
-
it('should send proper payload for #makeFacetExclude', async () => {
|
|
758
|
-
const meta = {
|
|
759
|
-
facetField: '@foo',
|
|
760
|
-
facetId: 'bar',
|
|
761
|
-
facetTitle: 'title',
|
|
762
|
-
facetValue: 'qwerty',
|
|
763
|
-
};
|
|
764
|
-
const built = await client.makeFacetExclude(meta);
|
|
765
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
766
|
-
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
767
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetExclude, meta);
|
|
768
|
-
});
|
|
769
|
-
|
|
770
|
-
it('should send proper payload for #logFacetUnexclude', async () => {
|
|
771
|
-
const meta = {
|
|
772
|
-
facetField: '@foo',
|
|
773
|
-
facetId: 'bar',
|
|
774
|
-
facetTitle: 'title',
|
|
775
|
-
facetValue: 'qwerty',
|
|
776
|
-
};
|
|
777
|
-
await client.logFacetUnexclude(meta);
|
|
778
|
-
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
779
|
-
});
|
|
780
|
-
|
|
781
|
-
it('should send proper payload for #makeFacetUnexclude', async () => {
|
|
782
|
-
const meta = {
|
|
783
|
-
facetField: '@foo',
|
|
784
|
-
facetId: 'bar',
|
|
785
|
-
facetTitle: 'title',
|
|
786
|
-
facetValue: 'qwerty',
|
|
787
|
-
};
|
|
788
|
-
const built = await client.makeFacetUnexclude(meta);
|
|
789
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
790
|
-
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
791
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetUnexclude, meta);
|
|
792
|
-
});
|
|
793
|
-
|
|
794
|
-
it('should send proper payload for #logFacetSelectAll', async () => {
|
|
795
|
-
const meta = {
|
|
796
|
-
facetField: '@foo',
|
|
797
|
-
facetId: 'bar',
|
|
798
|
-
facetTitle: 'title',
|
|
799
|
-
};
|
|
800
|
-
await client.logFacetSelectAll(meta);
|
|
801
|
-
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
it('should send proper payload for #makeFacetSelectAll', async () => {
|
|
805
|
-
const meta = {
|
|
806
|
-
facetField: '@foo',
|
|
807
|
-
facetId: 'bar',
|
|
808
|
-
facetTitle: 'title',
|
|
809
|
-
};
|
|
810
|
-
const built = await client.makeFacetSelectAll(meta);
|
|
811
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
812
|
-
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
813
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSelectAll, meta);
|
|
814
|
-
});
|
|
815
|
-
|
|
816
|
-
it('should send proper payload for #logFacetUpdateSort', async () => {
|
|
817
|
-
const meta = {
|
|
818
|
-
facetField: '@foo',
|
|
819
|
-
facetId: 'bar',
|
|
820
|
-
facetTitle: 'title',
|
|
821
|
-
criteria: 'bazz',
|
|
822
|
-
};
|
|
823
|
-
await client.logFacetUpdateSort(meta);
|
|
824
|
-
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
825
|
-
});
|
|
826
|
-
|
|
827
|
-
it('should send proper payload for #makeFacetUpdateSort', async () => {
|
|
828
|
-
const meta = {
|
|
829
|
-
facetField: '@foo',
|
|
830
|
-
facetId: 'bar',
|
|
831
|
-
facetTitle: 'title',
|
|
832
|
-
criteria: 'bazz',
|
|
833
|
-
};
|
|
834
|
-
const built = await client.makeFacetUpdateSort(meta);
|
|
835
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
836
|
-
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
837
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetUpdateSort, meta);
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
it('should send proper payload for #logFacetShowMore', async () => {
|
|
841
|
-
const meta = {
|
|
842
|
-
facetField: '@foo',
|
|
843
|
-
facetId: 'bar',
|
|
844
|
-
facetTitle: 'title',
|
|
845
|
-
};
|
|
846
|
-
await client.logFacetShowMore(meta);
|
|
847
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
848
|
-
});
|
|
849
|
-
|
|
850
|
-
it('should send proper payload for #makeFacetShowMore', async () => {
|
|
851
|
-
const meta = {
|
|
852
|
-
facetField: '@foo',
|
|
853
|
-
facetId: 'bar',
|
|
854
|
-
facetTitle: 'title',
|
|
855
|
-
};
|
|
856
|
-
const built = await client.makeFacetShowMore(meta);
|
|
857
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
858
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
859
|
-
expectMatchDescription(built.description, SearchPageEvents.facetShowMore, meta);
|
|
860
|
-
});
|
|
861
|
-
|
|
862
|
-
it('should send proper payload for #logFacetShowLess', async () => {
|
|
863
|
-
const meta = {
|
|
864
|
-
facetField: '@foo',
|
|
865
|
-
facetId: 'bar',
|
|
866
|
-
facetTitle: 'title',
|
|
867
|
-
};
|
|
868
|
-
await client.logFacetShowLess(meta);
|
|
869
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
870
|
-
});
|
|
871
|
-
|
|
872
|
-
it('should send proper payload for #makeFacetShowLess', async () => {
|
|
873
|
-
const meta = {
|
|
874
|
-
facetField: '@foo',
|
|
875
|
-
facetId: 'bar',
|
|
876
|
-
facetTitle: 'title',
|
|
877
|
-
};
|
|
878
|
-
const built = await client.makeFacetShowLess(meta);
|
|
879
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
880
|
-
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
881
|
-
expectMatchDescription(built.description, SearchPageEvents.facetShowLess, meta);
|
|
882
|
-
});
|
|
883
|
-
|
|
884
|
-
it('should send proper payload for #logQueryError', async () => {
|
|
885
|
-
const meta = {
|
|
886
|
-
query: 'q',
|
|
887
|
-
aq: 'aq',
|
|
888
|
-
cq: 'cq',
|
|
889
|
-
dq: 'dq',
|
|
890
|
-
errorMessage: 'boom',
|
|
891
|
-
errorType: 'a bad one',
|
|
892
|
-
};
|
|
893
|
-
await client.logQueryError(meta);
|
|
894
|
-
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
it('should send proper payload for #makeQueryError', async () => {
|
|
898
|
-
const meta = {
|
|
899
|
-
query: 'q',
|
|
900
|
-
aq: 'aq',
|
|
901
|
-
cq: 'cq',
|
|
902
|
-
dq: 'dq',
|
|
903
|
-
errorMessage: 'boom',
|
|
904
|
-
errorType: 'a bad one',
|
|
905
|
-
};
|
|
906
|
-
const built = await client.makeQueryError(meta);
|
|
907
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
908
|
-
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
909
|
-
expectMatchDescription(built.description, SearchPageEvents.queryError, meta);
|
|
910
|
-
});
|
|
911
|
-
|
|
912
|
-
it('should send proper payload for #logQueryErrorBack', async () => {
|
|
913
|
-
await client.logQueryErrorBack();
|
|
914
|
-
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
915
|
-
});
|
|
916
|
-
|
|
917
|
-
it('should send proper payload for #makeQueryErrorBack', async () => {
|
|
918
|
-
const built = await client.makeQueryErrorBack();
|
|
919
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
920
|
-
|
|
921
|
-
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
922
|
-
expectMatchDescription(built.description, SearchPageEvents.queryErrorBack);
|
|
923
|
-
});
|
|
924
|
-
|
|
925
|
-
it('should send proper payload for #logQueryErrorRetry', async () => {
|
|
926
|
-
await client.logQueryErrorRetry();
|
|
927
|
-
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
it('should send proper payload for #makeQueryErrorRetry', async () => {
|
|
931
|
-
const built = await client.makeQueryErrorRetry();
|
|
932
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
933
|
-
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
934
|
-
expectMatchDescription(built.description, SearchPageEvents.queryErrorRetry);
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
it('should send proper payload for #logQueryErrorClear', async () => {
|
|
938
|
-
await client.logQueryErrorClear();
|
|
939
|
-
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
940
|
-
});
|
|
941
|
-
|
|
942
|
-
it('should send proper payload for #makeQueryErrorClear', async () => {
|
|
943
|
-
const built = await client.makeQueryErrorClear();
|
|
944
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
945
|
-
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
946
|
-
expectMatchDescription(built.description, SearchPageEvents.queryErrorClear);
|
|
947
|
-
});
|
|
948
|
-
|
|
949
|
-
it('should send proper payload for #logRecommendationInterfaceLoad', async () => {
|
|
950
|
-
await client.logRecommendationInterfaceLoad();
|
|
951
|
-
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
952
|
-
});
|
|
953
|
-
|
|
954
|
-
it('should send proper payload for #makeRecommendationInterfaceLoad', async () => {
|
|
955
|
-
const built = await client.makeRecommendationInterfaceLoad();
|
|
956
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
957
|
-
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
958
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.recommendationInterfaceLoad);
|
|
959
|
-
});
|
|
960
|
-
|
|
961
|
-
it('should send proper payload for #logRecommendation', async () => {
|
|
962
|
-
await client.logRecommendation();
|
|
963
|
-
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
964
|
-
});
|
|
965
|
-
|
|
966
|
-
it('should send proper payload for #makeRecommendation', async () => {
|
|
967
|
-
const built = await client.makeRecommendation();
|
|
968
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
969
|
-
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
970
|
-
});
|
|
971
|
-
|
|
972
|
-
it('should send proper payload for #recommendationOpen', async () => {
|
|
973
|
-
await client.logRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
974
|
-
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
975
|
-
});
|
|
976
|
-
|
|
977
|
-
it('should send proper payload for #makeRecommendationOpen', async () => {
|
|
978
|
-
const built = await client.makeRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
979
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
980
|
-
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
981
|
-
expectMatchDescription(built.description, SearchPageEvents.recommendationOpen, {...fakeDocID});
|
|
982
|
-
});
|
|
983
|
-
|
|
984
|
-
it('should send proper payload for #fetchMoreResults', async () => {
|
|
985
|
-
await client.logFetchMoreResults();
|
|
986
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
987
|
-
});
|
|
988
|
-
|
|
989
|
-
it('should send proper payload for #makeFetchMoreResults', async () => {
|
|
990
|
-
const built = await client.makeFetchMoreResults();
|
|
991
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
992
|
-
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
993
|
-
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling, {type: 'getMoreResults'});
|
|
994
|
-
});
|
|
995
|
-
|
|
996
|
-
it('should send proper payload for #logLikeSmartSnippet', async () => {
|
|
997
|
-
await client.logLikeSmartSnippet();
|
|
998
|
-
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
999
|
-
});
|
|
1000
|
-
|
|
1001
|
-
it('should send proper payload for #makeLikeSmartSnippet', async () => {
|
|
1002
|
-
const built = await client.makeLikeSmartSnippet();
|
|
1003
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1004
|
-
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
1005
|
-
expectMatchDescription(built.description, SearchPageEvents.likeSmartSnippet);
|
|
1006
|
-
});
|
|
1007
|
-
|
|
1008
|
-
it('should send proper payload for #logDislikeSmartSnippet', async () => {
|
|
1009
|
-
await client.logDislikeSmartSnippet();
|
|
1010
|
-
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
1011
|
-
});
|
|
1012
|
-
|
|
1013
|
-
it('should send proper payload for #makeDislikeSmartSnippet', async () => {
|
|
1014
|
-
const built = await client.makeDislikeSmartSnippet();
|
|
1015
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1016
|
-
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
1017
|
-
expectMatchDescription(built.description, SearchPageEvents.dislikeSmartSnippet);
|
|
1018
|
-
});
|
|
1019
|
-
|
|
1020
|
-
it('should send proper payload for #logExpandSmartSnippet', async () => {
|
|
1021
|
-
await client.logExpandSmartSnippet();
|
|
1022
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
1023
|
-
});
|
|
1024
|
-
|
|
1025
|
-
it('should send proper payload for #makeExpandSmartSnippet', async () => {
|
|
1026
|
-
const built = await client.makeExpandSmartSnippet();
|
|
1027
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1028
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
1029
|
-
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippet);
|
|
1030
|
-
});
|
|
1031
|
-
|
|
1032
|
-
it('should send proper payload for #logCollapseSmartSnippet', async () => {
|
|
1033
|
-
await client.logCollapseSmartSnippet();
|
|
1034
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
1035
|
-
});
|
|
1036
|
-
|
|
1037
|
-
it('should send proper payload for #makeCollapseSmartSnippet', async () => {
|
|
1038
|
-
const built = await client.makeCollapseSmartSnippet();
|
|
1039
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1040
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
1041
|
-
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippet);
|
|
1042
|
-
});
|
|
1043
|
-
|
|
1044
|
-
it('should send proper payload for #logOpenSmartSnippetFeedbackModal', async () => {
|
|
1045
|
-
await client.logOpenSmartSnippetFeedbackModal();
|
|
1046
|
-
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1047
|
-
});
|
|
1048
|
-
|
|
1049
|
-
it('should send proper payload for #makeOpenSmartSnippetFeedbackModal', async () => {
|
|
1050
|
-
const built = await client.makeOpenSmartSnippetFeedbackModal();
|
|
1051
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1052
|
-
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1053
|
-
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1054
|
-
});
|
|
1055
|
-
|
|
1056
|
-
it('should send proper payload for #logCloseSmartSnippetFeedbackModal', async () => {
|
|
1057
|
-
await client.logCloseSmartSnippetFeedbackModal();
|
|
1058
|
-
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1059
|
-
});
|
|
1060
|
-
|
|
1061
|
-
it('should send proper payload for #makeCloseSmartSnippetFeedbackModal', async () => {
|
|
1062
|
-
const built = await client.makeCloseSmartSnippetFeedbackModal();
|
|
1063
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1064
|
-
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1065
|
-
expectMatchDescription(built.description, SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1066
|
-
});
|
|
1067
|
-
|
|
1068
|
-
it('should send proper payload for #logSmartSnippetFeedbackReason', async () => {
|
|
1069
|
-
await client.logSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
|
|
1070
|
-
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
1071
|
-
details: 'this is irrelevant',
|
|
1072
|
-
reason: 'does_not_answer',
|
|
1073
|
-
});
|
|
1074
|
-
});
|
|
1075
|
-
|
|
1076
|
-
it('should send proper payload for #makeSmartSnippetFeedbackReason', async () => {
|
|
1077
|
-
const built = await client.makeSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
|
|
1078
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1079
|
-
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
1080
|
-
details: 'this is irrelevant',
|
|
1081
|
-
reason: 'does_not_answer',
|
|
1082
|
-
});
|
|
1083
|
-
expectMatchDescription(built.description, SearchPageEvents.sendSmartSnippetReason, {
|
|
1084
|
-
details: 'this is irrelevant',
|
|
1085
|
-
reason: 'does_not_answer',
|
|
1086
|
-
});
|
|
1087
|
-
});
|
|
1088
|
-
|
|
1089
|
-
it('should send proper payload for #logExpandSmartSnippetSuggestion', async () => {
|
|
1090
|
-
await client.logExpandSmartSnippetSuggestion({
|
|
1091
|
-
question: 'Abc',
|
|
1092
|
-
answerSnippet: 'Def',
|
|
1093
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1094
|
-
});
|
|
1095
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1096
|
-
question: 'Abc',
|
|
1097
|
-
answerSnippet: 'Def',
|
|
1098
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1099
|
-
});
|
|
1100
|
-
});
|
|
1101
|
-
|
|
1102
|
-
it('should send proper payload for #makeExpandSmartSnippetSuggestion', async () => {
|
|
1103
|
-
const built = await client.makeExpandSmartSnippetSuggestion({
|
|
1104
|
-
question: 'Abc',
|
|
1105
|
-
answerSnippet: 'Def',
|
|
1106
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1107
|
-
});
|
|
1108
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1109
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1110
|
-
question: 'Abc',
|
|
1111
|
-
answerSnippet: 'Def',
|
|
1112
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1113
|
-
});
|
|
1114
|
-
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1115
|
-
question: 'Abc',
|
|
1116
|
-
answerSnippet: 'Def',
|
|
1117
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1118
|
-
});
|
|
1119
|
-
});
|
|
1120
|
-
|
|
1121
|
-
it('should send proper payload for #logCollapseSmartSnippetSuggestion', async () => {
|
|
1122
|
-
await client.logCollapseSmartSnippetSuggestion({
|
|
1123
|
-
question: 'Abc',
|
|
1124
|
-
answerSnippet: 'Def',
|
|
1125
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1126
|
-
});
|
|
1127
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1128
|
-
question: 'Abc',
|
|
1129
|
-
answerSnippet: 'Def',
|
|
1130
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1131
|
-
});
|
|
1132
|
-
});
|
|
1133
|
-
|
|
1134
|
-
it('should send proper payload for #makeCollapseSmartSnippetSuggestion', async () => {
|
|
1135
|
-
const built = await client.makeCollapseSmartSnippetSuggestion({
|
|
1136
|
-
question: 'Abc',
|
|
1137
|
-
answerSnippet: 'Def',
|
|
1138
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1139
|
-
});
|
|
1140
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1141
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1142
|
-
question: 'Abc',
|
|
1143
|
-
answerSnippet: 'Def',
|
|
1144
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1145
|
-
});
|
|
1146
|
-
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1147
|
-
question: 'Abc',
|
|
1148
|
-
answerSnippet: 'Def',
|
|
1149
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1150
|
-
});
|
|
1151
|
-
});
|
|
1152
|
-
|
|
1153
|
-
it('should send proper payload for #logExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1154
|
-
await client.logExpandSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
|
|
1155
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1156
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1157
|
-
});
|
|
1158
|
-
});
|
|
1159
|
-
|
|
1160
|
-
it('should send proper payload for #makeExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1161
|
-
const built = await client.makeExpandSmartSnippetSuggestion({
|
|
1162
|
-
contentIdKey: 'permanentid',
|
|
1163
|
-
contentIdValue: 'foo',
|
|
1164
|
-
});
|
|
1165
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1166
|
-
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1167
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1168
|
-
});
|
|
1169
|
-
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1170
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1171
|
-
});
|
|
1172
|
-
});
|
|
1173
|
-
|
|
1174
|
-
it('should send proper payload for #logCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1175
|
-
await client.logCollapseSmartSnippetSuggestion({contentIdKey: 'permanentid', contentIdValue: 'foo'});
|
|
1176
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1177
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1178
|
-
});
|
|
1179
|
-
});
|
|
1180
|
-
|
|
1181
|
-
it('should send proper payload for #makeCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1182
|
-
const built = await client.makeCollapseSmartSnippetSuggestion({
|
|
1183
|
-
contentIdKey: 'permanentid',
|
|
1184
|
-
contentIdValue: 'foo',
|
|
1185
|
-
});
|
|
1186
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1187
|
-
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1188
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1189
|
-
});
|
|
1190
|
-
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1191
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1192
|
-
});
|
|
1193
|
-
});
|
|
1194
|
-
|
|
1195
|
-
it('should send proper payload for #logShowMoreSmartSnippetSuggestion', async () => {
|
|
1196
|
-
await client.logShowMoreSmartSnippetSuggestion({
|
|
1197
|
-
question: 'Abc',
|
|
1198
|
-
answerSnippet: 'Def',
|
|
1199
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1200
|
-
});
|
|
1201
|
-
expectMatchCustomEventPayload(SearchPageEvents.showMoreSmartSnippetSuggestion, {
|
|
1202
|
-
question: 'Abc',
|
|
1203
|
-
answerSnippet: 'Def',
|
|
1204
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1205
|
-
});
|
|
1206
|
-
});
|
|
1207
|
-
|
|
1208
|
-
it('should send proper payload for #logShowLessSmartSnippetSuggestion', async () => {
|
|
1209
|
-
await client.logShowLessSmartSnippetSuggestion({
|
|
1210
|
-
question: 'Abc',
|
|
1211
|
-
answerSnippet: 'Def',
|
|
1212
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1213
|
-
});
|
|
1214
|
-
expectMatchCustomEventPayload(SearchPageEvents.showLessSmartSnippetSuggestion, {
|
|
1215
|
-
question: 'Abc',
|
|
1216
|
-
answerSnippet: 'Def',
|
|
1217
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1218
|
-
});
|
|
1219
|
-
});
|
|
1220
|
-
|
|
1221
|
-
it('should send proper payload for #logOpenSmartSnippetSource', async () => {
|
|
1222
|
-
await client.logOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
1223
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
1224
|
-
});
|
|
1225
|
-
|
|
1226
|
-
it('should send proper payload for #logCopyToClipboard', async () => {
|
|
1227
|
-
await client.logCopyToClipboard(fakeDocInfo, fakeDocID);
|
|
1228
|
-
expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID);
|
|
1229
|
-
});
|
|
1230
|
-
|
|
1231
|
-
it('should send proper payload for #makeOpenSmartSnippetSource', async () => {
|
|
1232
|
-
const built = await client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
1233
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1234
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
1235
|
-
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSource, {...fakeDocID});
|
|
1236
|
-
});
|
|
1237
|
-
|
|
1238
|
-
it('should send proper payload for #logOpenSmartSnippetSuggestionSource', async () => {
|
|
1239
|
-
const meta = {
|
|
1240
|
-
question: 'Abc',
|
|
1241
|
-
answerSnippet: 'Def',
|
|
1242
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1243
|
-
};
|
|
1244
|
-
await client.logOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
|
|
1245
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionSource, fakeDocInfo, {
|
|
1246
|
-
...meta,
|
|
1247
|
-
contentIDKey: meta.documentId.contentIdKey,
|
|
1248
|
-
contentIDValue: meta.documentId.contentIdValue,
|
|
1249
|
-
});
|
|
1250
|
-
});
|
|
1251
|
-
|
|
1252
|
-
it('should send proper payload for #makeOpenSmartSnippetSuggestionSource', async () => {
|
|
1253
|
-
const meta = {
|
|
1254
|
-
question: 'Abc',
|
|
1255
|
-
answerSnippet: 'Def',
|
|
1256
|
-
contentIDKey: 'permanentid',
|
|
1257
|
-
contentIDValue: 'foo',
|
|
1258
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1259
|
-
};
|
|
1260
|
-
const built = await client.makeOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
|
|
1261
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1262
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionSource, fakeDocInfo, meta);
|
|
1263
|
-
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionSource, meta);
|
|
1264
|
-
});
|
|
1265
|
-
|
|
1266
|
-
it('should send proper payload for #logOpenSmartSnippetInlineLink', async () => {
|
|
1267
|
-
const meta = {
|
|
1268
|
-
...fakeDocID,
|
|
1269
|
-
linkText: 'Some text',
|
|
1270
|
-
linkURL: 'https://invalid.com',
|
|
1271
|
-
};
|
|
1272
|
-
await client.logOpenSmartSnippetInlineLink(fakeDocInfo, meta);
|
|
1273
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
1274
|
-
});
|
|
1275
|
-
|
|
1276
|
-
it('should send proper payload for #makeOpenSmartSnippetInlineLink', async () => {
|
|
1277
|
-
const meta = {
|
|
1278
|
-
...fakeDocID,
|
|
1279
|
-
linkText: 'Some text',
|
|
1280
|
-
linkURL: 'https://invalid.com',
|
|
1281
|
-
};
|
|
1282
|
-
const built = await client.makeOpenSmartSnippetInlineLink(fakeDocInfo, meta);
|
|
1283
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1284
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
1285
|
-
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetInlineLink, meta);
|
|
1286
|
-
});
|
|
1287
|
-
|
|
1288
|
-
it('should send proper payload for #logOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
1289
|
-
const meta = {
|
|
1290
|
-
question: 'Abc',
|
|
1291
|
-
answerSnippet: 'Def',
|
|
1292
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1293
|
-
linkText: 'Some text',
|
|
1294
|
-
linkURL: 'https://invalid.com',
|
|
1295
|
-
};
|
|
1296
|
-
await client.logOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
|
|
1297
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, {
|
|
1298
|
-
...meta,
|
|
1299
|
-
contentIDKey: meta.documentId.contentIdKey,
|
|
1300
|
-
contentIDValue: meta.documentId.contentIdValue,
|
|
1301
|
-
});
|
|
1302
|
-
});
|
|
1303
|
-
|
|
1304
|
-
it('should send proper payload for #makeOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
1305
|
-
const meta = {
|
|
1306
|
-
question: 'Abc',
|
|
1307
|
-
answerSnippet: 'Def',
|
|
1308
|
-
contentIDKey: 'permanentid',
|
|
1309
|
-
contentIDValue: 'foo',
|
|
1310
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1311
|
-
linkText: 'Some text',
|
|
1312
|
-
linkURL: 'https://invalid.com',
|
|
1313
|
-
};
|
|
1314
|
-
const built = await client.makeOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
|
|
1315
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1316
|
-
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, meta);
|
|
1317
|
-
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSuggestionInlineLink, meta);
|
|
1318
|
-
});
|
|
1319
|
-
|
|
1320
|
-
it('should send proper payload for #logRecentQueryClick', async () => {
|
|
1321
|
-
await client.logRecentQueryClick();
|
|
1322
|
-
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
1323
|
-
});
|
|
1324
|
-
|
|
1325
|
-
it('should send proper payload for #makeRecentQueryClick', async () => {
|
|
1326
|
-
const built = await client.makeRecentQueryClick();
|
|
1327
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1328
|
-
|
|
1329
|
-
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
1330
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.recentQueryClick);
|
|
1331
|
-
});
|
|
1332
|
-
|
|
1333
|
-
it('should send proper payload for #logClearRecentQueries', async () => {
|
|
1334
|
-
await client.logClearRecentQueries();
|
|
1335
|
-
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
1336
|
-
});
|
|
1337
|
-
|
|
1338
|
-
it('should send proper payload for #makeClearRecentQueries', async () => {
|
|
1339
|
-
const built = await client.makeClearRecentQueries();
|
|
1340
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1341
|
-
|
|
1342
|
-
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
1343
|
-
expectMatchDescription(built.description, SearchPageEvents.clearRecentQueries);
|
|
1344
|
-
});
|
|
1345
|
-
|
|
1346
|
-
it('should send proper payload for #logRecentResultClick', async () => {
|
|
1347
|
-
await client.logRecentResultClick(fakeDocInfo, fakeDocID);
|
|
1348
|
-
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
1349
|
-
info: fakeDocInfo,
|
|
1350
|
-
identifier: fakeDocID,
|
|
1351
|
-
});
|
|
1352
|
-
});
|
|
1353
|
-
|
|
1354
|
-
it('should send proper payload for #makeRecentResultClick', async () => {
|
|
1355
|
-
const built = await client.makeRecentResultClick(fakeDocInfo, fakeDocID);
|
|
1356
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1357
|
-
|
|
1358
|
-
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
1359
|
-
info: fakeDocInfo,
|
|
1360
|
-
identifier: fakeDocID,
|
|
1361
|
-
});
|
|
1362
|
-
|
|
1363
|
-
expectMatchDescription(built.description, SearchPageEvents.recentResultClick, {
|
|
1364
|
-
info: fakeDocInfo,
|
|
1365
|
-
identifier: fakeDocID,
|
|
1366
|
-
});
|
|
1367
|
-
});
|
|
1368
|
-
|
|
1369
|
-
it('should send proper payload for #logNoResultsBack', async () => {
|
|
1370
|
-
await client.logNoResultsBack();
|
|
1371
|
-
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
1372
|
-
});
|
|
1373
|
-
|
|
1374
|
-
it('should send proper payload for #makeNoResultsBack', async () => {
|
|
1375
|
-
const built = await client.makeNoResultsBack();
|
|
1376
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1377
|
-
|
|
1378
|
-
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
1379
|
-
expectSearchEventToMatchDescription(built.description, SearchPageEvents.noResultsBack);
|
|
1380
|
-
});
|
|
1381
|
-
|
|
1382
|
-
it('should send proper payload for #logClearRecentResults', async () => {
|
|
1383
|
-
await client.logClearRecentResults();
|
|
1384
|
-
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
1385
|
-
});
|
|
1386
|
-
|
|
1387
|
-
it('should send proper payload for #makeClearRecentResults', async () => {
|
|
1388
|
-
const built = await client.makeClearRecentResults();
|
|
1389
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1390
|
-
|
|
1391
|
-
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
1392
|
-
expectMatchDescription(built.description, SearchPageEvents.clearRecentResults);
|
|
1393
|
-
});
|
|
1394
|
-
|
|
1395
|
-
it('should send proper payload for #logCustomEventWithType', async () => {
|
|
1396
|
-
await client.logCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
|
|
1397
|
-
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
1398
|
-
});
|
|
1399
|
-
|
|
1400
|
-
it('should send proper payload for #makeCustomEventWithType', async () => {
|
|
1401
|
-
const built = await client.makeCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
|
|
1402
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1403
|
-
|
|
1404
|
-
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
1405
|
-
expectMatchDescription(built.description, 'foo' as SearchPageEvents, {buzz: 'bazz'});
|
|
1406
|
-
});
|
|
1407
|
-
|
|
1408
|
-
it('should enable analytics tracking by default', () => {
|
|
1409
|
-
const c = new CoveoSearchPageClient({}, provider);
|
|
1410
|
-
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
it('should allow disabling analytics on initialization', () => {
|
|
1414
|
-
const c = new CoveoSearchPageClient({enableAnalytics: false}, provider);
|
|
1415
|
-
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1416
|
-
});
|
|
1417
|
-
|
|
1418
|
-
it('should disable analytics when doNotTrack is enabled', async () => {
|
|
1419
|
-
(doNotTrack as jest.Mock).mockImplementationOnce(() => true);
|
|
1420
|
-
|
|
1421
|
-
const c = new CoveoSearchPageClient({}, provider);
|
|
1422
|
-
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1423
|
-
});
|
|
1424
|
-
|
|
1425
|
-
it('should allow disabling analytics after initialization', () => {
|
|
1426
|
-
const c = new CoveoSearchPageClient({enableAnalytics: true}, provider);
|
|
1427
|
-
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1428
|
-
c.disable();
|
|
1429
|
-
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1430
|
-
});
|
|
1431
|
-
|
|
1432
|
-
it('disabling analytics does not delete the visitorId', () => {
|
|
1433
|
-
const visitorId = 'uuid';
|
|
1434
|
-
Cookie.set('coveo_visitorId', visitorId);
|
|
1435
|
-
const c = new CoveoSearchPageClient({enableAnalytics: true}, provider);
|
|
1436
|
-
|
|
1437
|
-
expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
|
|
1438
|
-
c.disable();
|
|
1439
|
-
expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
|
|
1440
|
-
});
|
|
1441
|
-
|
|
1442
|
-
it('should allow enabling analytics after initialization', () => {
|
|
1443
|
-
const c = new CoveoSearchPageClient({enableAnalytics: false}, provider);
|
|
1444
|
-
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1445
|
-
c.enable();
|
|
1446
|
-
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1447
|
-
});
|
|
1448
|
-
|
|
1449
|
-
it('should send proper payload for #logLikeGeneratedAnswer', async () => {
|
|
1450
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1451
|
-
await client.logLikeGeneratedAnswer(meta);
|
|
1452
|
-
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1453
|
-
});
|
|
1454
|
-
|
|
1455
|
-
it('should send proper payload for #logLikeGeneratedAnswer with agent metadata', async () => {
|
|
1456
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId, conversationId: fakeConversationId};
|
|
1457
|
-
await client.logLikeGeneratedAnswer(meta);
|
|
1458
|
-
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1459
|
-
});
|
|
1460
|
-
|
|
1461
|
-
it('should send proper payload for #makeLikeGeneratedAnswer', async () => {
|
|
1462
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1463
|
-
const built = await client.makeLikeGeneratedAnswer(meta);
|
|
1464
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1465
|
-
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1466
|
-
expectMatchDescription(built.description, SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1467
|
-
});
|
|
1468
|
-
|
|
1469
|
-
it('should send proper payload for #logDislikeGeneratedAnswer', async () => {
|
|
1470
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1471
|
-
await client.logDislikeGeneratedAnswer(meta);
|
|
1472
|
-
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1473
|
-
});
|
|
1474
|
-
|
|
1475
|
-
it('should send proper payload for #logDislikeGeneratedAnswer with agent metadata', async () => {
|
|
1476
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId, conversationId: fakeConversationId};
|
|
1477
|
-
await client.logDislikeGeneratedAnswer(meta);
|
|
1478
|
-
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1479
|
-
});
|
|
1480
|
-
|
|
1481
|
-
it('should send proper payload for #makeDislikeGeneratedAnswer', async () => {
|
|
1482
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1483
|
-
const built = await client.makeDislikeGeneratedAnswer(meta);
|
|
1484
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1485
|
-
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1486
|
-
expectMatchDescription(built.description, SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1487
|
-
});
|
|
1488
|
-
|
|
1489
|
-
it('should send proper payload for #logOpenGeneratedAnswerSource', async () => {
|
|
1490
|
-
const meta = {
|
|
1491
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1492
|
-
citationId: 'some-document-id',
|
|
1493
|
-
permanentId: 'perm-id',
|
|
1494
|
-
};
|
|
1495
|
-
await client.logOpenGeneratedAnswerSource(meta);
|
|
1496
|
-
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1497
|
-
});
|
|
1498
|
-
|
|
1499
|
-
it('should send proper payload for #logOpenGeneratedAnswerSource with agent metadata', async () => {
|
|
1500
|
-
const meta = {
|
|
1501
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1502
|
-
conversationId: fakeConversationId,
|
|
1503
|
-
citationId: 'some-document-id',
|
|
1504
|
-
permanentId: 'perm-id',
|
|
1505
|
-
};
|
|
1506
|
-
await client.logOpenGeneratedAnswerSource(meta);
|
|
1507
|
-
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1508
|
-
});
|
|
1509
|
-
|
|
1510
|
-
it('should send proper payload for #makeOpenGeneratedAnswerSource', async () => {
|
|
1511
|
-
const meta = {
|
|
1512
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1513
|
-
citationId: 'some-document-id',
|
|
1514
|
-
permanentId: 'perm-id',
|
|
1515
|
-
};
|
|
1516
|
-
const built = await client.makeOpenGeneratedAnswerSource(meta);
|
|
1517
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1518
|
-
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1519
|
-
expectMatchDescription(built.description, SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1520
|
-
});
|
|
1521
|
-
|
|
1522
|
-
it('should send proper payload for #logGeneratedAnswerOpenInlineLink', async () => {
|
|
1523
|
-
const meta = {
|
|
1524
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1525
|
-
conversationId: fakeConversationId,
|
|
1526
|
-
linkText: 'Read more',
|
|
1527
|
-
linkURL: 'https://example.com',
|
|
1528
|
-
};
|
|
1529
|
-
await client.logGeneratedAnswerOpenInlineLink(meta);
|
|
1530
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1531
|
-
});
|
|
1532
|
-
|
|
1533
|
-
it('should send proper payload for #makeGeneratedAnswerOpenInlineLink', async () => {
|
|
1534
|
-
const meta = {
|
|
1535
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1536
|
-
linkText: 'Read more',
|
|
1537
|
-
linkURL: 'https://example.com',
|
|
1538
|
-
};
|
|
1539
|
-
const built = await client.makeGeneratedAnswerOpenInlineLink(meta);
|
|
1540
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1541
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1542
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1543
|
-
});
|
|
1544
|
-
|
|
1545
|
-
it('should send proper payload for #logGeneratedAnswerCitationClick', async () => {
|
|
1546
|
-
const meta = {
|
|
1547
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1548
|
-
citationId: 'some-document-id',
|
|
1549
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1550
|
-
};
|
|
1551
|
-
|
|
1552
|
-
await client.logGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1553
|
-
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, {
|
|
1554
|
-
...meta,
|
|
1555
|
-
contentIDKey: meta.documentId.contentIdKey,
|
|
1556
|
-
contentIDValue: meta.documentId.contentIdValue,
|
|
1557
|
-
});
|
|
1558
|
-
});
|
|
1559
|
-
|
|
1560
|
-
it('should send proper payload for #logGeneratedAnswerCitationClick with agent metadata', async () => {
|
|
1561
|
-
const meta = {
|
|
1562
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1563
|
-
conversationId: fakeConversationId,
|
|
1564
|
-
citationId: 'some-document-id',
|
|
1565
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1566
|
-
};
|
|
1567
|
-
|
|
1568
|
-
await client.logGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1569
|
-
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, {
|
|
1570
|
-
...meta,
|
|
1571
|
-
contentIDKey: meta.documentId.contentIdKey,
|
|
1572
|
-
contentIDValue: meta.documentId.contentIdValue,
|
|
1573
|
-
});
|
|
1574
|
-
});
|
|
1575
|
-
|
|
1576
|
-
it('should send proper payload for #makeGeneratedAnswerCitationClick', async () => {
|
|
1577
|
-
const meta = {
|
|
1578
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1579
|
-
citationId: 'some-document-id',
|
|
1580
|
-
contentIDKey: 'permanentid',
|
|
1581
|
-
contentIDValue: 'foo',
|
|
1582
|
-
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1583
|
-
};
|
|
1584
|
-
const built = await client.makeGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1585
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1586
|
-
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, meta);
|
|
1587
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerCitationClick, meta);
|
|
1588
|
-
});
|
|
1589
|
-
|
|
1590
|
-
it('should send proper payload for #logGeneratedAnswerFollowupOpenSource', async () => {
|
|
1591
|
-
const meta = {
|
|
1592
|
-
...fakeDocInfo,
|
|
1593
|
-
citationId: 'some-document-id',
|
|
1594
|
-
permanentId: 'perm-id',
|
|
1595
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1596
|
-
conversationId: fakeConversationId,
|
|
1597
|
-
};
|
|
1598
|
-
|
|
1599
|
-
await client.logGeneratedAnswerFollowupOpenSource(meta);
|
|
1600
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFollowupOpenSource, meta);
|
|
1601
|
-
});
|
|
1602
|
-
|
|
1603
|
-
it('should send proper payload for #makeGeneratedAnswerFollowupOpenSource', async () => {
|
|
1604
|
-
const meta = {
|
|
1605
|
-
...fakeDocInfo,
|
|
1606
|
-
citationId: 'some-document-id',
|
|
1607
|
-
permanentId: 'perm-id',
|
|
1608
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1609
|
-
conversationId: fakeConversationId,
|
|
1610
|
-
};
|
|
1611
|
-
|
|
1612
|
-
const built = await client.makeGeneratedAnswerFollowupOpenSource(meta);
|
|
1613
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1614
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFollowupOpenSource, meta);
|
|
1615
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerFollowupOpenSource, meta);
|
|
1616
|
-
});
|
|
1617
|
-
|
|
1618
|
-
it('should send proper payload for #logGeneratedAnswerStreamEnd', async () => {
|
|
1619
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId, answerGenerated: true, answerTextIsEmpty: false};
|
|
1620
|
-
await client.logGeneratedAnswerStreamEnd(meta);
|
|
1621
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1622
|
-
});
|
|
1623
|
-
|
|
1624
|
-
it('should send proper payload for #logGeneratedAnswerStreamEnd with agent metadata', async () => {
|
|
1625
|
-
const meta = {
|
|
1626
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1627
|
-
conversationId: fakeConversationId,
|
|
1628
|
-
answerGenerated: true,
|
|
1629
|
-
answerTextIsEmpty: false,
|
|
1630
|
-
};
|
|
1631
|
-
await client.logGeneratedAnswerStreamEnd(meta);
|
|
1632
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1633
|
-
});
|
|
1634
|
-
|
|
1635
|
-
it('should send proper payload for #makeGeneratedAnswerStreamEnd', async () => {
|
|
1636
|
-
const meta = {generativeQuestionAnsweringId: fakeStreamId, answerGenerated: true, answerTextIsEmpty: false};
|
|
1637
|
-
const built = await client.makeGeneratedAnswerStreamEnd(meta);
|
|
1638
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1639
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1640
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1641
|
-
});
|
|
1642
|
-
|
|
1643
|
-
it('should send proper payload for #logGeneratedAnswerSourceHover', async () => {
|
|
1644
|
-
const meta = {
|
|
1645
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1646
|
-
citationId: 'some-document-id',
|
|
1647
|
-
permanentId: 'perm-id',
|
|
1648
|
-
citationHoverTimeMs: 100,
|
|
1649
|
-
};
|
|
1650
|
-
await client.logGeneratedAnswerSourceHover(meta);
|
|
1651
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1652
|
-
});
|
|
1653
|
-
|
|
1654
|
-
it('should send proper payload for #logGeneratedAnswerSourceHover with agent metadata', async () => {
|
|
1655
|
-
const meta = {
|
|
1656
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1657
|
-
conversationId: fakeConversationId,
|
|
1658
|
-
citationId: 'some-document-id',
|
|
1659
|
-
permanentId: 'perm-id',
|
|
1660
|
-
citationHoverTimeMs: 100,
|
|
1661
|
-
};
|
|
1662
|
-
await client.logGeneratedAnswerSourceHover(meta);
|
|
1663
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1664
|
-
});
|
|
1665
|
-
|
|
1666
|
-
it('should send proper payload for #makeGeneratedAnswerSourceHover', async () => {
|
|
1667
|
-
const meta = {
|
|
1668
|
-
generativeQuestionAnsweringId: fakeStreamId,
|
|
1669
|
-
citationId: 'some-document-id',
|
|
1670
|
-
permanentId: 'perm-id',
|
|
1671
|
-
citationHoverTimeMs: 100,
|
|
1672
|
-
};
|
|
1673
|
-
const built = await client.makeGeneratedAnswerSourceHover(meta);
|
|
1674
|
-
await built.log({searchUID: provider.getSearchUID()});
|
|
1675
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1676
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1677
|
-
});
|
|
37
|
+
const fakeDocInfo = {
|
|
38
|
+
collectionName: 'collection',
|
|
39
|
+
documentCategory: 'category',
|
|
40
|
+
documentAuthor: 'author',
|
|
41
|
+
documentPosition: 1,
|
|
42
|
+
documentTitle: 'title',
|
|
43
|
+
documentUri: 'uri',
|
|
44
|
+
documentUriHash: 'hash',
|
|
45
|
+
documentUrl: 'url',
|
|
46
|
+
queryPipeline: 'my-pipeline',
|
|
47
|
+
rankingModifier: 'modifier',
|
|
48
|
+
sourceName: 'source',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const fakeDocID = {
|
|
52
|
+
contentIDKey: 'permanentID',
|
|
53
|
+
contentIDValue: 'the-permanent-id',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const fakeFacetState = [
|
|
57
|
+
{
|
|
58
|
+
valuePosition: 0,
|
|
59
|
+
value: 'foo',
|
|
60
|
+
state: 'selected' as const,
|
|
61
|
+
facetPosition: 1,
|
|
62
|
+
displayValue: 'foobar',
|
|
63
|
+
facetType: 'specific' as const,
|
|
64
|
+
field: '@foo',
|
|
65
|
+
id: 'bar',
|
|
66
|
+
title: 'title',
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const fakeStreamId = 'some-stream-id-123';
|
|
71
|
+
const fakeConversationId = 'some-conversation-id-123';
|
|
72
|
+
|
|
73
|
+
let client: CoveoSearchPageClient;
|
|
74
|
+
|
|
75
|
+
const provider: SearchPageClientProvider = {
|
|
76
|
+
getBaseMetadata: () => ({foo: 'bar'}),
|
|
77
|
+
getGeneratedAnswerMetadata: () => ({genQaMetadata: 'bar'}),
|
|
78
|
+
getSearchEventRequestPayload: () => ({
|
|
79
|
+
queryText: 'queryText',
|
|
80
|
+
responseTime: 123,
|
|
81
|
+
}),
|
|
82
|
+
getSearchUID: () => 'my-uid',
|
|
83
|
+
getPipeline: () => 'my-pipeline',
|
|
84
|
+
getOriginContext: () => 'origin-context',
|
|
85
|
+
getOriginLevel1: () => 'origin-level-1',
|
|
86
|
+
getOriginLevel2: () => 'origin-level-2',
|
|
87
|
+
getOriginLevel3: () => 'origin-level-3',
|
|
88
|
+
getLanguage: () => 'en',
|
|
89
|
+
getFacetState: () => fakeFacetState,
|
|
90
|
+
getIsAnonymous: () => false,
|
|
91
|
+
getSplitTestRunName: () => 'split-test-run-something',
|
|
92
|
+
getSplitTestRunVersion: () => 'split-test-run-something/foo',
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
beforeEach(() => {
|
|
96
|
+
fetchMockBeforeEach();
|
|
97
|
+
|
|
98
|
+
client = initClient();
|
|
99
|
+
client.coveoAnalyticsClient.runtime.storage.setItem('visitorId', 'visitor-id');
|
|
100
|
+
fetchMock.mock(/.*/, {
|
|
101
|
+
visitId: 'visit-id',
|
|
102
|
+
});
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
afterEach(() => {
|
|
106
|
+
fetchMock.reset();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const customDataFromMiddleware = {helloFromMiddleware: 1234};
|
|
110
|
+
|
|
111
|
+
const initClient = () => {
|
|
112
|
+
return new CoveoSearchPageClient(
|
|
113
|
+
{
|
|
114
|
+
beforeSendHooks: [
|
|
115
|
+
(_, payload) =>
|
|
116
|
+
Promise.resolve({
|
|
117
|
+
...payload,
|
|
118
|
+
customData: {...payload.customData, ...customDataFromMiddleware},
|
|
119
|
+
}),
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
provider
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const expectOrigins = () => ({
|
|
127
|
+
originContext: 'origin-context',
|
|
128
|
+
originLevel1: 'origin-level-1',
|
|
129
|
+
originLevel2: 'origin-level-2',
|
|
130
|
+
originLevel3: 'origin-level-3',
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const expectSplitTestRun = () => ({
|
|
134
|
+
splitTestRunName: 'split-test-run-something',
|
|
135
|
+
splitTestRunVersion: 'split-test-run-something/foo',
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
const expectMatchPayload = (actionCause: SearchPageEvents, meta = {}) => {
|
|
139
|
+
const body: string = lastCallBody(fetchMock);
|
|
140
|
+
const customData = {
|
|
141
|
+
foo: 'bar',
|
|
142
|
+
genQaMetadata: 'bar',
|
|
143
|
+
...customDataFromMiddleware,
|
|
144
|
+
...meta,
|
|
145
|
+
};
|
|
146
|
+
expect(JSON.parse(body)).toEqual({
|
|
147
|
+
queryText: 'queryText',
|
|
148
|
+
responseTime: 123,
|
|
149
|
+
searchQueryUid: provider.getSearchUID(),
|
|
150
|
+
queryPipeline: 'my-pipeline',
|
|
151
|
+
actionCause,
|
|
152
|
+
anonymous: false,
|
|
153
|
+
customData,
|
|
154
|
+
facetState: fakeFacetState,
|
|
155
|
+
language: 'en',
|
|
156
|
+
clientId: 'visitor-id',
|
|
157
|
+
userAgent: expect.any(String),
|
|
158
|
+
...expectOrigins(),
|
|
159
|
+
...expectSplitTestRun(),
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const expectMatchDescription = (
|
|
164
|
+
description: EventDescription,
|
|
165
|
+
actionCause: SearchPageEvents,
|
|
166
|
+
meta = {}
|
|
167
|
+
) => {
|
|
168
|
+
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
|
|
169
|
+
expect(description).toEqual({
|
|
170
|
+
actionCause,
|
|
171
|
+
customData,
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
const expectSearchEventToMatchDescription = (
|
|
176
|
+
description: EventDescription,
|
|
177
|
+
actionCause: SearchPageEvents,
|
|
178
|
+
meta = {}
|
|
179
|
+
) => {
|
|
180
|
+
expectMatchDescription(description, actionCause, {
|
|
181
|
+
...meta,
|
|
182
|
+
genQaMetadata: 'bar',
|
|
183
|
+
});
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
const expectMatchDocumentPayload = (
|
|
187
|
+
actionCause: SearchPageEvents,
|
|
188
|
+
doc: PartialDocumentInformation,
|
|
189
|
+
meta = {}
|
|
190
|
+
) => {
|
|
191
|
+
const body: string = lastCallBody(fetchMock);
|
|
192
|
+
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
|
|
193
|
+
expect(JSON.parse(body)).toEqual({
|
|
194
|
+
anonymous: false,
|
|
195
|
+
actionCause,
|
|
196
|
+
customData,
|
|
197
|
+
language: 'en',
|
|
198
|
+
clientId: 'visitor-id',
|
|
199
|
+
facetState: fakeFacetState,
|
|
200
|
+
searchQueryUid: provider.getSearchUID(),
|
|
201
|
+
userAgent: expect.any(String),
|
|
202
|
+
...doc,
|
|
203
|
+
...expectOrigins(),
|
|
204
|
+
...expectSplitTestRun(),
|
|
205
|
+
});
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const expectMatchCustomEventPayload = (
|
|
209
|
+
actionCause: SearchPageEvents,
|
|
210
|
+
meta = {},
|
|
211
|
+
eventType = CustomEventsTypes[actionCause]
|
|
212
|
+
) => {
|
|
213
|
+
const body: string = lastCallBody(fetchMock);
|
|
214
|
+
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
|
|
215
|
+
expect(JSON.parse(body)).toEqual({
|
|
216
|
+
anonymous: false,
|
|
217
|
+
eventValue: actionCause,
|
|
218
|
+
eventType,
|
|
219
|
+
lastSearchQueryUid: 'my-uid',
|
|
220
|
+
customData,
|
|
221
|
+
language: 'en',
|
|
222
|
+
clientId: 'visitor-id',
|
|
223
|
+
facetState: fakeFacetState,
|
|
224
|
+
userAgent: expect.any(String),
|
|
225
|
+
...expectOrigins(),
|
|
226
|
+
...expectSplitTestRun(),
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const expectMatchCustomEventWithTypePayload = (
|
|
231
|
+
eventValue: string,
|
|
232
|
+
eventType: string,
|
|
233
|
+
meta = {}
|
|
234
|
+
) => {
|
|
235
|
+
const body: string = lastCallBody(fetchMock);
|
|
236
|
+
const customData = {foo: 'bar', ...customDataFromMiddleware, ...meta};
|
|
237
|
+
expect(JSON.parse(body)).toEqual({
|
|
238
|
+
anonymous: false,
|
|
239
|
+
eventValue,
|
|
240
|
+
eventType,
|
|
241
|
+
lastSearchQueryUid: 'my-uid',
|
|
242
|
+
customData,
|
|
243
|
+
language: 'en',
|
|
244
|
+
clientId: 'visitor-id',
|
|
245
|
+
facetState: fakeFacetState,
|
|
246
|
+
userAgent: expect.any(String),
|
|
247
|
+
...expectOrigins(),
|
|
248
|
+
...expectSplitTestRun(),
|
|
249
|
+
});
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
it('should send proper payload for #interfaceLoad', async () => {
|
|
253
|
+
await client.logInterfaceLoad();
|
|
254
|
+
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it('should send proper payload for #makeInterfaceLoad', async () => {
|
|
258
|
+
const built = await client.makeInterfaceLoad();
|
|
259
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
260
|
+
expectMatchPayload(SearchPageEvents.interfaceLoad);
|
|
261
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.interfaceLoad);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it('should send proper payload for #interfaceChange', async () => {
|
|
265
|
+
await client.logInterfaceChange({
|
|
266
|
+
interfaceChangeTo: 'bob',
|
|
267
|
+
});
|
|
268
|
+
expectMatchPayload(SearchPageEvents.interfaceChange, {
|
|
269
|
+
interfaceChangeTo: 'bob',
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('should send proper payload for #makeInterfaceChange', async () => {
|
|
274
|
+
const built = await client.makeInterfaceChange({interfaceChangeTo: 'bob'});
|
|
275
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
276
|
+
expectMatchPayload(SearchPageEvents.interfaceChange, {
|
|
277
|
+
interfaceChangeTo: 'bob',
|
|
278
|
+
});
|
|
279
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.interfaceChange, {
|
|
280
|
+
interfaceChangeTo: 'bob',
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
it('should send proper payload for #didyoumeanAutomatic', async () => {
|
|
285
|
+
await client.logDidYouMeanAutomatic();
|
|
286
|
+
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
it('should send proper payload for #makeDidyoumeanAutomatic', async () => {
|
|
290
|
+
const built = await client.makeDidYouMeanAutomatic();
|
|
291
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
292
|
+
expectMatchPayload(SearchPageEvents.didyoumeanAutomatic);
|
|
293
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.didyoumeanAutomatic);
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it('should send proper payload for #didyoumeanClick', async () => {
|
|
297
|
+
await client.logDidYouMeanClick();
|
|
298
|
+
expectMatchPayload(SearchPageEvents.didyoumeanClick);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('should send proper payload for #makeDidyoumeanClick', async () => {
|
|
302
|
+
const built = await client.makeDidYouMeanClick();
|
|
303
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
304
|
+
expectMatchPayload(SearchPageEvents.didyoumeanClick);
|
|
305
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.didyoumeanClick);
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
it('should send proper payload for #resultsSort', async () => {
|
|
309
|
+
await client.logResultsSort({resultsSortBy: 'date ascending'});
|
|
310
|
+
expectMatchPayload(SearchPageEvents.resultsSort, {
|
|
311
|
+
resultsSortBy: 'date ascending',
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
it('should send proper payload for #makeResultsSort', async () => {
|
|
316
|
+
const built = await client.makeResultsSort({
|
|
317
|
+
resultsSortBy: 'date ascending',
|
|
318
|
+
});
|
|
319
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
320
|
+
expectMatchPayload(SearchPageEvents.resultsSort, {
|
|
321
|
+
resultsSortBy: 'date ascending',
|
|
322
|
+
});
|
|
323
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.resultsSort, {
|
|
324
|
+
resultsSortBy: 'date ascending',
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
it('should send proper payload for #searchboxSubmit', async () => {
|
|
329
|
+
await client.logSearchboxSubmit();
|
|
330
|
+
expectMatchPayload(SearchPageEvents.searchboxSubmit);
|
|
331
|
+
});
|
|
332
|
+
|
|
333
|
+
it('should send proper payload for #makeSearchboxSubmit', async () => {
|
|
334
|
+
const built = await client.makeSearchboxSubmit();
|
|
335
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
336
|
+
expectMatchPayload(SearchPageEvents.searchboxSubmit);
|
|
337
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.searchboxSubmit);
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
it('should send proper payload for #searchboxClear', async () => {
|
|
341
|
+
await client.logSearchboxClear();
|
|
342
|
+
expectMatchPayload(SearchPageEvents.searchboxClear);
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('should send proper payload for #makeSearchboxClear', async () => {
|
|
346
|
+
const built = await client.makeSearchboxClear();
|
|
347
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
348
|
+
expectMatchPayload(SearchPageEvents.searchboxClear);
|
|
349
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.searchboxClear);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
it('should send proper payload for #searchboxAsYouType', async () => {
|
|
353
|
+
await client.logSearchboxAsYouType();
|
|
354
|
+
expectMatchPayload(SearchPageEvents.searchboxAsYouType);
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
it('should send proper payload for #makeSearchboxAsYouType', async () => {
|
|
358
|
+
const built = await client.makeSearchboxAsYouType();
|
|
359
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
360
|
+
expectMatchPayload(SearchPageEvents.searchboxAsYouType);
|
|
361
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.searchboxAsYouType);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('should send proper payload for #documentQuickview', async () => {
|
|
365
|
+
await client.logDocumentQuickview(fakeDocInfo, fakeDocID);
|
|
366
|
+
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, fakeDocID);
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
it('should send proper payload for #makeDocumentQuickview', async () => {
|
|
370
|
+
const built = await client.makeDocumentQuickview(fakeDocInfo, fakeDocID);
|
|
371
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
372
|
+
expectMatchDocumentPayload(SearchPageEvents.documentQuickview, fakeDocInfo, fakeDocID);
|
|
373
|
+
expectMatchDescription(built.description, SearchPageEvents.documentQuickview, {...fakeDocID});
|
|
374
|
+
});
|
|
375
|
+
|
|
376
|
+
it('should send proper payload for #documentOpen', async () => {
|
|
377
|
+
await client.logDocumentOpen(fakeDocInfo, fakeDocID);
|
|
378
|
+
expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
it('should send proper payload for #makeDocumentOpen', async () => {
|
|
382
|
+
const built = await client.makeDocumentOpen(fakeDocInfo, fakeDocID);
|
|
383
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
384
|
+
expectMatchDocumentPayload(SearchPageEvents.documentOpen, fakeDocInfo, fakeDocID);
|
|
385
|
+
expectMatchDescription(built.description, SearchPageEvents.documentOpen, {
|
|
386
|
+
...fakeDocID,
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
it('should send proper payload for #showMoreFoldedResults', async () => {
|
|
391
|
+
await client.logShowMoreFoldedResults(fakeDocInfo, fakeDocID);
|
|
392
|
+
expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
it('should send proper payload for #makeShowMoreFoldedResults', async () => {
|
|
396
|
+
const built = await client.makeShowMoreFoldedResults(fakeDocInfo, fakeDocID);
|
|
397
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
398
|
+
expectMatchDocumentPayload(SearchPageEvents.showMoreFoldedResults, fakeDocInfo, fakeDocID);
|
|
399
|
+
expectMatchDescription(built.description, SearchPageEvents.showMoreFoldedResults, fakeDocID);
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
it('should send proper payload for #showLessFoldedResults', async () => {
|
|
403
|
+
await client.logShowLessFoldedResults();
|
|
404
|
+
expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it('should send proper payload for #makeShowLessFoldedResults', async () => {
|
|
408
|
+
const built = await client.makeShowLessFoldedResults();
|
|
409
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
410
|
+
expectMatchCustomEventPayload(SearchPageEvents.showLessFoldedResults);
|
|
411
|
+
expectMatchDescription(built.description, SearchPageEvents.showLessFoldedResults);
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it('should send proper payload for #omniboxAnalytics', async () => {
|
|
415
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
416
|
+
partialQueries: 'a;b;c',
|
|
417
|
+
partialQuery: 'abcd',
|
|
418
|
+
suggestionRanking: 1,
|
|
419
|
+
suggestions: 'q;w;e;r;t;y',
|
|
420
|
+
querySuggestResponseId: '1',
|
|
421
|
+
};
|
|
422
|
+
await client.logOmniboxAnalytics(meta);
|
|
423
|
+
expectMatchPayload(SearchPageEvents.omniboxAnalytics, meta);
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it('should send proper payload for #makeOmniboxAnalytics', async () => {
|
|
427
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
428
|
+
partialQueries: 'a;b;c',
|
|
429
|
+
partialQuery: 'abcd',
|
|
430
|
+
suggestionRanking: 1,
|
|
431
|
+
suggestions: 'q;w;e;r;t;y',
|
|
432
|
+
querySuggestResponseId: '1',
|
|
433
|
+
};
|
|
434
|
+
const built = await client.makeOmniboxAnalytics(meta);
|
|
435
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
436
|
+
expectMatchPayload(SearchPageEvents.omniboxAnalytics, meta);
|
|
437
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.omniboxAnalytics, meta);
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
it('should send proper payload for #logOmniboxFromLink', async () => {
|
|
441
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
442
|
+
partialQueries: 'a;b;c',
|
|
443
|
+
partialQuery: 'abcd',
|
|
444
|
+
suggestionRanking: 1,
|
|
445
|
+
suggestions: 'q;w;e;r;t;y',
|
|
446
|
+
querySuggestResponseId: '1',
|
|
447
|
+
};
|
|
448
|
+
await client.logOmniboxFromLink(meta);
|
|
449
|
+
expectMatchPayload(SearchPageEvents.omniboxFromLink, meta);
|
|
450
|
+
});
|
|
451
|
+
|
|
452
|
+
it('should send proper payload for #makeOmniboxFromLink', async () => {
|
|
453
|
+
const meta: OmniboxSuggestionsMetadata = {
|
|
454
|
+
partialQueries: 'a;b;c',
|
|
455
|
+
partialQuery: 'abcd',
|
|
456
|
+
suggestionRanking: 1,
|
|
457
|
+
suggestions: 'q;w;e;r;t;y',
|
|
458
|
+
querySuggestResponseId: '1',
|
|
459
|
+
};
|
|
460
|
+
const built = await client.makeOmniboxFromLink(meta);
|
|
461
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
462
|
+
expectMatchPayload(SearchPageEvents.omniboxFromLink, meta);
|
|
463
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.omniboxFromLink, meta);
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
it('should send proper payload for #logSearchFromLink', async () => {
|
|
467
|
+
await client.logSearchFromLink();
|
|
468
|
+
expectMatchPayload(SearchPageEvents.searchFromLink);
|
|
469
|
+
});
|
|
470
|
+
|
|
471
|
+
it('should send proper payload for #makeSearchFromLink', async () => {
|
|
472
|
+
const built = await client.makeSearchFromLink();
|
|
473
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
474
|
+
expectMatchPayload(SearchPageEvents.searchFromLink);
|
|
475
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.searchFromLink);
|
|
476
|
+
});
|
|
477
|
+
|
|
478
|
+
it('should send proper payload for #logTriggerNotify', async () => {
|
|
479
|
+
const meta = {
|
|
480
|
+
notifications: ['foo', 'bar'],
|
|
481
|
+
};
|
|
482
|
+
await client.logTriggerNotify(meta);
|
|
483
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerNotify, meta);
|
|
484
|
+
});
|
|
1678
485
|
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
486
|
+
it('should send proper payload for #makeTriggerNotify', async () => {
|
|
487
|
+
const meta = {
|
|
488
|
+
notifications: ['foo', 'bar'],
|
|
489
|
+
};
|
|
490
|
+
const built = await client.makeTriggerNotify(meta);
|
|
491
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
492
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerNotify, meta);
|
|
493
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerNotify, meta);
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
it('should send proper payload for #logTriggerExecute', async () => {
|
|
497
|
+
const meta = {
|
|
498
|
+
executions: [
|
|
499
|
+
{functionName: 'foo', params: [true, 3, 'hello']},
|
|
500
|
+
{functionName: 'world', params: []},
|
|
501
|
+
],
|
|
502
|
+
};
|
|
503
|
+
await client.logTriggerExecute(meta);
|
|
504
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerExecute, meta);
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
it('should send proper payload for #makeTriggerExecute', async () => {
|
|
508
|
+
const meta = {
|
|
509
|
+
executions: [
|
|
510
|
+
{functionName: 'foo', params: [true, 3, 'hello']},
|
|
511
|
+
{functionName: 'world', params: []},
|
|
512
|
+
],
|
|
513
|
+
};
|
|
514
|
+
const built = await client.makeTriggerExecute(meta);
|
|
515
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
516
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerExecute, meta);
|
|
517
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerExecute, meta);
|
|
518
|
+
});
|
|
519
|
+
|
|
520
|
+
it('should send proper payload for #logTriggerQuery', async () => {
|
|
521
|
+
const meta = {
|
|
522
|
+
query: 'queryText',
|
|
523
|
+
};
|
|
524
|
+
await client.logTriggerQuery();
|
|
525
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
526
|
+
});
|
|
1684
527
|
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
528
|
+
it('should send proper payload for #makeTriggerQuery', async () => {
|
|
529
|
+
const meta = {
|
|
530
|
+
query: 'queryText',
|
|
531
|
+
};
|
|
532
|
+
const built = await client.makeTriggerQuery();
|
|
533
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
534
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerQuery, meta, 'queryPipelineTriggers');
|
|
535
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerQuery, meta);
|
|
536
|
+
});
|
|
537
|
+
|
|
538
|
+
it('should send proper payload for #logUndoTriggerQuery', async () => {
|
|
539
|
+
const meta = {
|
|
540
|
+
undoneQuery: 'foo',
|
|
541
|
+
};
|
|
542
|
+
await client.logUndoTriggerQuery(meta);
|
|
543
|
+
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
544
|
+
});
|
|
1690
545
|
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
546
|
+
it('should send proper payload for #makeUndoTriggerQuery', async () => {
|
|
547
|
+
const meta = {
|
|
548
|
+
undoneQuery: 'foo',
|
|
549
|
+
};
|
|
550
|
+
const built = await client.makeUndoTriggerQuery(meta);
|
|
551
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
552
|
+
expectMatchPayload(SearchPageEvents.undoTriggerQuery, meta);
|
|
553
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.undoTriggerQuery, meta);
|
|
554
|
+
});
|
|
555
|
+
|
|
556
|
+
it('should send proper payload for #logTriggerRedirect', async () => {
|
|
557
|
+
const meta = {
|
|
558
|
+
redirectedTo: 'foo',
|
|
559
|
+
query: provider.getSearchEventRequestPayload().queryText,
|
|
560
|
+
};
|
|
561
|
+
await client.logTriggerRedirect(meta);
|
|
562
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
563
|
+
});
|
|
564
|
+
|
|
565
|
+
it('should send proper payload for #makeTriggerRedirect', async () => {
|
|
566
|
+
const meta = {
|
|
567
|
+
redirectedTo: 'foo',
|
|
568
|
+
query: provider.getSearchEventRequestPayload().queryText,
|
|
569
|
+
};
|
|
570
|
+
const built = await client.makeTriggerRedirect(meta);
|
|
571
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
572
|
+
expectMatchCustomEventPayload(SearchPageEvents.triggerRedirect, meta);
|
|
573
|
+
expectMatchDescription(built.description, SearchPageEvents.triggerRedirect, meta);
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
it('should send proper payload for #logPagerResize', async () => {
|
|
577
|
+
const meta = {
|
|
578
|
+
currentResultsPerPage: 123,
|
|
579
|
+
};
|
|
580
|
+
await client.logPagerResize(meta);
|
|
581
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
582
|
+
});
|
|
1698
583
|
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
584
|
+
it('should send proper payload for #makePagerResize', async () => {
|
|
585
|
+
const meta = {
|
|
586
|
+
currentResultsPerPage: 123,
|
|
587
|
+
};
|
|
588
|
+
const built = await client.makePagerResize(meta);
|
|
589
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
590
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerResize, meta);
|
|
591
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerResize, meta);
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
it('should send proper payload for #logPagerNumber', async () => {
|
|
595
|
+
const meta = {pagerNumber: 123};
|
|
596
|
+
await client.logPagerNumber(meta);
|
|
597
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
it('should send proper payload for #makePagerNumber', async () => {
|
|
601
|
+
const meta = {pagerNumber: 123};
|
|
602
|
+
const built = await client.makePagerNumber(meta);
|
|
603
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
604
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNumber, meta);
|
|
605
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerNumber, meta);
|
|
606
|
+
});
|
|
607
|
+
|
|
608
|
+
it('should send proper payload for #logPagerNext', async () => {
|
|
609
|
+
const meta = {pagerNumber: 123};
|
|
610
|
+
await client.logPagerNext(meta);
|
|
611
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it('should send proper payload for #makePagerNext', async () => {
|
|
615
|
+
const meta = {pagerNumber: 123};
|
|
616
|
+
const built = await client.makePagerNext(meta);
|
|
617
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
618
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerNext, meta);
|
|
619
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerNext, meta);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
it('should send proper payload for #logPagerPrevious', async () => {
|
|
623
|
+
const meta = {pagerNumber: 123};
|
|
624
|
+
await client.logPagerPrevious(meta);
|
|
625
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
626
|
+
});
|
|
627
|
+
|
|
628
|
+
it('should send proper payload for #makePagerPrevious', async () => {
|
|
629
|
+
const meta = {pagerNumber: 123};
|
|
630
|
+
const built = await client.makePagerPrevious(meta);
|
|
631
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
632
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerPrevious, meta);
|
|
633
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerPrevious, meta);
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
it('should send proper payload for #logPagerScrolling', async () => {
|
|
637
|
+
await client.logPagerScrolling();
|
|
638
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
639
|
+
});
|
|
640
|
+
|
|
641
|
+
it('should send proper payload for #makePagerScrolling', async () => {
|
|
642
|
+
const built = await client.makePagerScrolling();
|
|
643
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
644
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling);
|
|
645
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling);
|
|
646
|
+
});
|
|
647
|
+
|
|
648
|
+
it('should send the proper payload for #logStaticFilterClearAll', async () => {
|
|
649
|
+
const staticFilterId = 'filetypes';
|
|
650
|
+
await client.logStaticFilterClearAll({staticFilterId});
|
|
651
|
+
|
|
652
|
+
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
it('should send the proper payload for #makeStaticFilterClearAll', async () => {
|
|
656
|
+
const staticFilterId = 'filetypes';
|
|
657
|
+
const built = await client.makeStaticFilterClearAll({staticFilterId});
|
|
658
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
659
|
+
expectMatchPayload(SearchPageEvents.staticFilterClearAll, {staticFilterId});
|
|
660
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.staticFilterClearAll, {
|
|
661
|
+
staticFilterId,
|
|
662
|
+
});
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
it('should send the proper payload for #logStaticFilterSelect', async () => {
|
|
666
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
667
|
+
staticFilterId: 'filetypes',
|
|
668
|
+
staticFilterValue: {
|
|
669
|
+
caption: 'Youtube',
|
|
670
|
+
expression: '@filetype="youtubevideo"',
|
|
671
|
+
},
|
|
672
|
+
};
|
|
673
|
+
await client.logStaticFilterSelect(meta);
|
|
674
|
+
|
|
675
|
+
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
it('should send the proper payload for #makeStaticFilterSelect', async () => {
|
|
679
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
680
|
+
staticFilterId: 'filetypes',
|
|
681
|
+
staticFilterValue: {
|
|
682
|
+
caption: 'Youtube',
|
|
683
|
+
expression: '@filetype="youtubevideo"',
|
|
684
|
+
},
|
|
685
|
+
};
|
|
686
|
+
const built = await client.makeStaticFilterSelect(meta);
|
|
687
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
688
|
+
|
|
689
|
+
expectMatchPayload(SearchPageEvents.staticFilterSelect, meta);
|
|
690
|
+
expectSearchEventToMatchDescription(
|
|
691
|
+
built.description,
|
|
692
|
+
SearchPageEvents.staticFilterSelect,
|
|
693
|
+
meta
|
|
694
|
+
);
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
it('should send the proper payload for #logStaticFilterDeselect', async () => {
|
|
698
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
699
|
+
staticFilterId: 'filetypes',
|
|
700
|
+
staticFilterValue: {
|
|
701
|
+
caption: 'Youtube',
|
|
702
|
+
expression: '@filetype="youtubevideo"',
|
|
703
|
+
},
|
|
704
|
+
};
|
|
705
|
+
await client.logStaticFilterDeselect(meta);
|
|
706
|
+
|
|
707
|
+
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
it('should send the proper payload for #makeStaticFilterDeselect', async () => {
|
|
711
|
+
const meta: StaticFilterToggleValueMetadata = {
|
|
712
|
+
staticFilterId: 'filetypes',
|
|
713
|
+
staticFilterValue: {
|
|
714
|
+
caption: 'Youtube',
|
|
715
|
+
expression: '@filetype="youtubevideo"',
|
|
716
|
+
},
|
|
717
|
+
};
|
|
718
|
+
const built = await client.makeStaticFilterDeselect(meta);
|
|
719
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
720
|
+
expectMatchPayload(SearchPageEvents.staticFilterDeselect, meta);
|
|
721
|
+
expectSearchEventToMatchDescription(
|
|
722
|
+
built.description,
|
|
723
|
+
SearchPageEvents.staticFilterDeselect,
|
|
724
|
+
meta
|
|
725
|
+
);
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
it('should send proper payload for #logFacetSearch', async () => {
|
|
729
|
+
const meta = {
|
|
730
|
+
facetField: '@foo',
|
|
731
|
+
facetId: 'bar',
|
|
732
|
+
facetTitle: 'title',
|
|
733
|
+
};
|
|
734
|
+
await client.logFacetSearch(meta);
|
|
735
|
+
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
it('should send proper payload for #makeFacetSearch', async () => {
|
|
739
|
+
const meta = {
|
|
740
|
+
facetField: '@foo',
|
|
741
|
+
facetId: 'bar',
|
|
742
|
+
facetTitle: 'title',
|
|
743
|
+
};
|
|
744
|
+
const built = await client.makeFacetSearch(meta);
|
|
745
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
746
|
+
expectMatchPayload(SearchPageEvents.facetSearch, meta);
|
|
747
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSearch, meta);
|
|
748
|
+
});
|
|
749
|
+
|
|
750
|
+
it('should send proper payload for #logFacetSelect', async () => {
|
|
751
|
+
const meta = {
|
|
752
|
+
facetField: '@foo',
|
|
753
|
+
facetId: 'bar',
|
|
754
|
+
facetTitle: 'title',
|
|
755
|
+
facetValue: 'qwerty',
|
|
756
|
+
};
|
|
1704
757
|
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerHideAnswers, meta);
|
|
1709
|
-
});
|
|
758
|
+
await client.logFacetSelect(meta);
|
|
759
|
+
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
760
|
+
});
|
|
1710
761
|
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
}
|
|
762
|
+
it('should send proper payload for #makeFacetSelect', async () => {
|
|
763
|
+
const meta = {
|
|
764
|
+
facetField: '@foo',
|
|
765
|
+
facetId: 'bar',
|
|
766
|
+
facetTitle: 'title',
|
|
767
|
+
facetValue: 'qwerty',
|
|
768
|
+
};
|
|
769
|
+
const built = await client.makeFacetSelect(meta);
|
|
770
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
771
|
+
expectMatchPayload(SearchPageEvents.facetSelect, meta);
|
|
772
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSelect, meta);
|
|
773
|
+
});
|
|
774
|
+
|
|
775
|
+
it('should send proper payload for #logFacetDeselect', async () => {
|
|
776
|
+
const meta = {
|
|
777
|
+
facetField: '@foo',
|
|
778
|
+
facetId: 'bar',
|
|
779
|
+
facetTitle: 'title',
|
|
780
|
+
facetValue: 'qwerty',
|
|
781
|
+
};
|
|
1718
782
|
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, meta);
|
|
1723
|
-
});
|
|
783
|
+
await client.logFacetDeselect(meta);
|
|
784
|
+
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
785
|
+
});
|
|
1724
786
|
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
787
|
+
it('should send proper payload for #makeFacetDeselect', async () => {
|
|
788
|
+
const meta = {
|
|
789
|
+
facetField: '@foo',
|
|
790
|
+
facetId: 'bar',
|
|
791
|
+
facetTitle: 'title',
|
|
792
|
+
facetValue: 'qwerty',
|
|
793
|
+
};
|
|
1730
794
|
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
795
|
+
const built = await client.makeFacetDeselect(meta);
|
|
796
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
797
|
+
expectMatchPayload(SearchPageEvents.facetDeselect, meta);
|
|
798
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetDeselect, meta);
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
it('should send proper payload for #logFacetExclude', async () => {
|
|
802
|
+
const meta = {
|
|
803
|
+
facetField: '@foo',
|
|
804
|
+
facetId: 'bar',
|
|
805
|
+
facetTitle: 'title',
|
|
806
|
+
facetValue: 'qwerty',
|
|
807
|
+
};
|
|
808
|
+
await client.logFacetExclude(meta);
|
|
809
|
+
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
it('should send proper payload for #makeFacetExclude', async () => {
|
|
813
|
+
const meta = {
|
|
814
|
+
facetField: '@foo',
|
|
815
|
+
facetId: 'bar',
|
|
816
|
+
facetTitle: 'title',
|
|
817
|
+
facetValue: 'qwerty',
|
|
818
|
+
};
|
|
819
|
+
const built = await client.makeFacetExclude(meta);
|
|
820
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
821
|
+
expectMatchPayload(SearchPageEvents.facetExclude, meta);
|
|
822
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetExclude, meta);
|
|
823
|
+
});
|
|
824
|
+
|
|
825
|
+
it('should send proper payload for #logFacetUnexclude', async () => {
|
|
826
|
+
const meta = {
|
|
827
|
+
facetField: '@foo',
|
|
828
|
+
facetId: 'bar',
|
|
829
|
+
facetTitle: 'title',
|
|
830
|
+
facetValue: 'qwerty',
|
|
831
|
+
};
|
|
832
|
+
await client.logFacetUnexclude(meta);
|
|
833
|
+
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
it('should send proper payload for #makeFacetUnexclude', async () => {
|
|
837
|
+
const meta = {
|
|
838
|
+
facetField: '@foo',
|
|
839
|
+
facetId: 'bar',
|
|
840
|
+
facetTitle: 'title',
|
|
841
|
+
facetValue: 'qwerty',
|
|
842
|
+
};
|
|
843
|
+
const built = await client.makeFacetUnexclude(meta);
|
|
844
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
845
|
+
expectMatchPayload(SearchPageEvents.facetUnexclude, meta);
|
|
846
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetUnexclude, meta);
|
|
847
|
+
});
|
|
848
|
+
|
|
849
|
+
it('should send proper payload for #logFacetSelectAll', async () => {
|
|
850
|
+
const meta = {
|
|
851
|
+
facetField: '@foo',
|
|
852
|
+
facetId: 'bar',
|
|
853
|
+
facetTitle: 'title',
|
|
854
|
+
};
|
|
855
|
+
await client.logFacetSelectAll(meta);
|
|
856
|
+
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
it('should send proper payload for #makeFacetSelectAll', async () => {
|
|
860
|
+
const meta = {
|
|
861
|
+
facetField: '@foo',
|
|
862
|
+
facetId: 'bar',
|
|
863
|
+
facetTitle: 'title',
|
|
864
|
+
};
|
|
865
|
+
const built = await client.makeFacetSelectAll(meta);
|
|
866
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
867
|
+
expectMatchPayload(SearchPageEvents.facetSelectAll, meta);
|
|
868
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetSelectAll, meta);
|
|
869
|
+
});
|
|
870
|
+
|
|
871
|
+
it('should send proper payload for #logFacetUpdateSort', async () => {
|
|
872
|
+
const meta = {
|
|
873
|
+
facetField: '@foo',
|
|
874
|
+
facetId: 'bar',
|
|
875
|
+
facetTitle: 'title',
|
|
876
|
+
criteria: 'bazz',
|
|
877
|
+
};
|
|
878
|
+
await client.logFacetUpdateSort(meta);
|
|
879
|
+
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
it('should send proper payload for #makeFacetUpdateSort', async () => {
|
|
883
|
+
const meta = {
|
|
884
|
+
facetField: '@foo',
|
|
885
|
+
facetId: 'bar',
|
|
886
|
+
facetTitle: 'title',
|
|
887
|
+
criteria: 'bazz',
|
|
888
|
+
};
|
|
889
|
+
const built = await client.makeFacetUpdateSort(meta);
|
|
890
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
891
|
+
expectMatchPayload(SearchPageEvents.facetUpdateSort, meta);
|
|
892
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.facetUpdateSort, meta);
|
|
893
|
+
});
|
|
894
|
+
|
|
895
|
+
it('should send proper payload for #logFacetShowMore', async () => {
|
|
896
|
+
const meta = {
|
|
897
|
+
facetField: '@foo',
|
|
898
|
+
facetId: 'bar',
|
|
899
|
+
facetTitle: 'title',
|
|
900
|
+
};
|
|
901
|
+
await client.logFacetShowMore(meta);
|
|
902
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
it('should send proper payload for #makeFacetShowMore', async () => {
|
|
906
|
+
const meta = {
|
|
907
|
+
facetField: '@foo',
|
|
908
|
+
facetId: 'bar',
|
|
909
|
+
facetTitle: 'title',
|
|
910
|
+
};
|
|
911
|
+
const built = await client.makeFacetShowMore(meta);
|
|
912
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
913
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowMore, meta);
|
|
914
|
+
expectMatchDescription(built.description, SearchPageEvents.facetShowMore, meta);
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
it('should send proper payload for #logFacetShowLess', async () => {
|
|
918
|
+
const meta = {
|
|
919
|
+
facetField: '@foo',
|
|
920
|
+
facetId: 'bar',
|
|
921
|
+
facetTitle: 'title',
|
|
922
|
+
};
|
|
923
|
+
await client.logFacetShowLess(meta);
|
|
924
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
925
|
+
});
|
|
926
|
+
|
|
927
|
+
it('should send proper payload for #makeFacetShowLess', async () => {
|
|
928
|
+
const meta = {
|
|
929
|
+
facetField: '@foo',
|
|
930
|
+
facetId: 'bar',
|
|
931
|
+
facetTitle: 'title',
|
|
932
|
+
};
|
|
933
|
+
const built = await client.makeFacetShowLess(meta);
|
|
934
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
935
|
+
expectMatchCustomEventPayload(SearchPageEvents.facetShowLess, meta);
|
|
936
|
+
expectMatchDescription(built.description, SearchPageEvents.facetShowLess, meta);
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
it('should send proper payload for #logQueryError', async () => {
|
|
940
|
+
const meta = {
|
|
941
|
+
query: 'q',
|
|
942
|
+
aq: 'aq',
|
|
943
|
+
cq: 'cq',
|
|
944
|
+
dq: 'dq',
|
|
945
|
+
errorMessage: 'boom',
|
|
946
|
+
errorType: 'a bad one',
|
|
947
|
+
};
|
|
948
|
+
await client.logQueryError(meta);
|
|
949
|
+
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
950
|
+
});
|
|
951
|
+
|
|
952
|
+
it('should send proper payload for #makeQueryError', async () => {
|
|
953
|
+
const meta = {
|
|
954
|
+
query: 'q',
|
|
955
|
+
aq: 'aq',
|
|
956
|
+
cq: 'cq',
|
|
957
|
+
dq: 'dq',
|
|
958
|
+
errorMessage: 'boom',
|
|
959
|
+
errorType: 'a bad one',
|
|
960
|
+
};
|
|
961
|
+
const built = await client.makeQueryError(meta);
|
|
962
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
963
|
+
expectMatchCustomEventPayload(SearchPageEvents.queryError, meta);
|
|
964
|
+
expectMatchDescription(built.description, SearchPageEvents.queryError, meta);
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
it('should send proper payload for #logQueryErrorBack', async () => {
|
|
968
|
+
await client.logQueryErrorBack();
|
|
969
|
+
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
970
|
+
});
|
|
971
|
+
|
|
972
|
+
it('should send proper payload for #makeQueryErrorBack', async () => {
|
|
973
|
+
const built = await client.makeQueryErrorBack();
|
|
974
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
975
|
+
|
|
976
|
+
expectMatchPayload(SearchPageEvents.queryErrorBack);
|
|
977
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorBack);
|
|
978
|
+
});
|
|
979
|
+
|
|
980
|
+
it('should send proper payload for #logQueryErrorRetry', async () => {
|
|
981
|
+
await client.logQueryErrorRetry();
|
|
982
|
+
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
it('should send proper payload for #makeQueryErrorRetry', async () => {
|
|
986
|
+
const built = await client.makeQueryErrorRetry();
|
|
987
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
988
|
+
expectMatchPayload(SearchPageEvents.queryErrorRetry);
|
|
989
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorRetry);
|
|
990
|
+
});
|
|
991
|
+
|
|
992
|
+
it('should send proper payload for #logQueryErrorClear', async () => {
|
|
993
|
+
await client.logQueryErrorClear();
|
|
994
|
+
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
995
|
+
});
|
|
996
|
+
|
|
997
|
+
it('should send proper payload for #makeQueryErrorClear', async () => {
|
|
998
|
+
const built = await client.makeQueryErrorClear();
|
|
999
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1000
|
+
expectMatchPayload(SearchPageEvents.queryErrorClear);
|
|
1001
|
+
expectMatchDescription(built.description, SearchPageEvents.queryErrorClear);
|
|
1002
|
+
});
|
|
1003
|
+
|
|
1004
|
+
it('should send proper payload for #logRecommendationInterfaceLoad', async () => {
|
|
1005
|
+
await client.logRecommendationInterfaceLoad();
|
|
1006
|
+
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
1007
|
+
});
|
|
1008
|
+
|
|
1009
|
+
it('should send proper payload for #makeRecommendationInterfaceLoad', async () => {
|
|
1010
|
+
const built = await client.makeRecommendationInterfaceLoad();
|
|
1011
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1012
|
+
expectMatchPayload(SearchPageEvents.recommendationInterfaceLoad);
|
|
1013
|
+
expectSearchEventToMatchDescription(
|
|
1014
|
+
built.description,
|
|
1015
|
+
SearchPageEvents.recommendationInterfaceLoad
|
|
1016
|
+
);
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
it('should send proper payload for #logRecommendation', async () => {
|
|
1020
|
+
await client.logRecommendation();
|
|
1021
|
+
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
1022
|
+
});
|
|
1023
|
+
|
|
1024
|
+
it('should send proper payload for #makeRecommendation', async () => {
|
|
1025
|
+
const built = await client.makeRecommendation();
|
|
1026
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1027
|
+
expectMatchCustomEventPayload(SearchPageEvents.recommendation);
|
|
1028
|
+
});
|
|
1029
|
+
|
|
1030
|
+
it('should send proper payload for #recommendationOpen', async () => {
|
|
1031
|
+
await client.logRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
1032
|
+
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
1033
|
+
});
|
|
1034
|
+
|
|
1035
|
+
it('should send proper payload for #makeRecommendationOpen', async () => {
|
|
1036
|
+
const built = await client.makeRecommendationOpen(fakeDocInfo, fakeDocID);
|
|
1037
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1038
|
+
expectMatchDocumentPayload(SearchPageEvents.recommendationOpen, fakeDocInfo, fakeDocID);
|
|
1039
|
+
expectMatchDescription(built.description, SearchPageEvents.recommendationOpen, {...fakeDocID});
|
|
1040
|
+
});
|
|
1041
|
+
|
|
1042
|
+
it('should send proper payload for #fetchMoreResults', async () => {
|
|
1043
|
+
await client.logFetchMoreResults();
|
|
1044
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {
|
|
1045
|
+
type: 'getMoreResults',
|
|
1046
|
+
});
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
it('should send proper payload for #makeFetchMoreResults', async () => {
|
|
1050
|
+
const built = await client.makeFetchMoreResults();
|
|
1051
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1052
|
+
expectMatchCustomEventPayload(SearchPageEvents.pagerScrolling, {
|
|
1053
|
+
type: 'getMoreResults',
|
|
1054
|
+
});
|
|
1055
|
+
expectMatchDescription(built.description, SearchPageEvents.pagerScrolling, {
|
|
1056
|
+
type: 'getMoreResults',
|
|
1057
|
+
});
|
|
1058
|
+
});
|
|
1059
|
+
|
|
1060
|
+
it('should send proper payload for #logLikeSmartSnippet', async () => {
|
|
1061
|
+
await client.logLikeSmartSnippet();
|
|
1062
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
1063
|
+
});
|
|
1064
|
+
|
|
1065
|
+
it('should send proper payload for #makeLikeSmartSnippet', async () => {
|
|
1066
|
+
const built = await client.makeLikeSmartSnippet();
|
|
1067
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1068
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeSmartSnippet);
|
|
1069
|
+
expectMatchDescription(built.description, SearchPageEvents.likeSmartSnippet);
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
it('should send proper payload for #logDislikeSmartSnippet', async () => {
|
|
1073
|
+
await client.logDislikeSmartSnippet();
|
|
1074
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
1075
|
+
});
|
|
1076
|
+
|
|
1077
|
+
it('should send proper payload for #makeDislikeSmartSnippet', async () => {
|
|
1078
|
+
const built = await client.makeDislikeSmartSnippet();
|
|
1079
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1080
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeSmartSnippet);
|
|
1081
|
+
expectMatchDescription(built.description, SearchPageEvents.dislikeSmartSnippet);
|
|
1082
|
+
});
|
|
1083
|
+
|
|
1084
|
+
it('should send proper payload for #logExpandSmartSnippet', async () => {
|
|
1085
|
+
await client.logExpandSmartSnippet();
|
|
1086
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
it('should send proper payload for #makeExpandSmartSnippet', async () => {
|
|
1090
|
+
const built = await client.makeExpandSmartSnippet();
|
|
1091
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1092
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippet);
|
|
1093
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippet);
|
|
1094
|
+
});
|
|
1095
|
+
|
|
1096
|
+
it('should send proper payload for #logCollapseSmartSnippet', async () => {
|
|
1097
|
+
await client.logCollapseSmartSnippet();
|
|
1098
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
it('should send proper payload for #makeCollapseSmartSnippet', async () => {
|
|
1102
|
+
const built = await client.makeCollapseSmartSnippet();
|
|
1103
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1104
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippet);
|
|
1105
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippet);
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
it('should send proper payload for #logOpenSmartSnippetFeedbackModal', async () => {
|
|
1109
|
+
await client.logOpenSmartSnippetFeedbackModal();
|
|
1110
|
+
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
it('should send proper payload for #makeOpenSmartSnippetFeedbackModal', async () => {
|
|
1114
|
+
const built = await client.makeOpenSmartSnippetFeedbackModal();
|
|
1115
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1116
|
+
expectMatchCustomEventPayload(SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1117
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetFeedbackModal);
|
|
1118
|
+
});
|
|
1119
|
+
|
|
1120
|
+
it('should send proper payload for #logCloseSmartSnippetFeedbackModal', async () => {
|
|
1121
|
+
await client.logCloseSmartSnippetFeedbackModal();
|
|
1122
|
+
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1123
|
+
});
|
|
1124
|
+
|
|
1125
|
+
it('should send proper payload for #makeCloseSmartSnippetFeedbackModal', async () => {
|
|
1126
|
+
const built = await client.makeCloseSmartSnippetFeedbackModal();
|
|
1127
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1128
|
+
expectMatchCustomEventPayload(SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1129
|
+
expectMatchDescription(built.description, SearchPageEvents.closeSmartSnippetFeedbackModal);
|
|
1130
|
+
});
|
|
1131
|
+
|
|
1132
|
+
it('should send proper payload for #logSmartSnippetFeedbackReason', async () => {
|
|
1133
|
+
await client.logSmartSnippetFeedbackReason('does_not_answer', 'this is irrelevant');
|
|
1134
|
+
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
1135
|
+
details: 'this is irrelevant',
|
|
1136
|
+
reason: 'does_not_answer',
|
|
1137
|
+
});
|
|
1138
|
+
});
|
|
1139
|
+
|
|
1140
|
+
it('should send proper payload for #makeSmartSnippetFeedbackReason', async () => {
|
|
1141
|
+
const built = await client.makeSmartSnippetFeedbackReason(
|
|
1142
|
+
'does_not_answer',
|
|
1143
|
+
'this is irrelevant'
|
|
1144
|
+
);
|
|
1145
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1146
|
+
expectMatchCustomEventPayload(SearchPageEvents.sendSmartSnippetReason, {
|
|
1147
|
+
details: 'this is irrelevant',
|
|
1148
|
+
reason: 'does_not_answer',
|
|
1149
|
+
});
|
|
1150
|
+
expectMatchDescription(built.description, SearchPageEvents.sendSmartSnippetReason, {
|
|
1151
|
+
details: 'this is irrelevant',
|
|
1152
|
+
reason: 'does_not_answer',
|
|
1153
|
+
});
|
|
1154
|
+
});
|
|
1155
|
+
|
|
1156
|
+
it('should send proper payload for #logExpandSmartSnippetSuggestion', async () => {
|
|
1157
|
+
await client.logExpandSmartSnippetSuggestion({
|
|
1158
|
+
question: 'Abc',
|
|
1159
|
+
answerSnippet: 'Def',
|
|
1160
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1161
|
+
});
|
|
1162
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1163
|
+
question: 'Abc',
|
|
1164
|
+
answerSnippet: 'Def',
|
|
1165
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1166
|
+
});
|
|
1167
|
+
});
|
|
1168
|
+
|
|
1169
|
+
it('should send proper payload for #makeExpandSmartSnippetSuggestion', async () => {
|
|
1170
|
+
const built = await client.makeExpandSmartSnippetSuggestion({
|
|
1171
|
+
question: 'Abc',
|
|
1172
|
+
answerSnippet: 'Def',
|
|
1173
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1174
|
+
});
|
|
1175
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1176
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1177
|
+
question: 'Abc',
|
|
1178
|
+
answerSnippet: 'Def',
|
|
1179
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1180
|
+
});
|
|
1181
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1182
|
+
question: 'Abc',
|
|
1183
|
+
answerSnippet: 'Def',
|
|
1184
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
it('should send proper payload for #logCollapseSmartSnippetSuggestion', async () => {
|
|
1189
|
+
await client.logCollapseSmartSnippetSuggestion({
|
|
1190
|
+
question: 'Abc',
|
|
1191
|
+
answerSnippet: 'Def',
|
|
1192
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1193
|
+
});
|
|
1194
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1195
|
+
question: 'Abc',
|
|
1196
|
+
answerSnippet: 'Def',
|
|
1197
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1198
|
+
});
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
it('should send proper payload for #makeCollapseSmartSnippetSuggestion', async () => {
|
|
1202
|
+
const built = await client.makeCollapseSmartSnippetSuggestion({
|
|
1203
|
+
question: 'Abc',
|
|
1204
|
+
answerSnippet: 'Def',
|
|
1205
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1206
|
+
});
|
|
1207
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1208
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1209
|
+
question: 'Abc',
|
|
1210
|
+
answerSnippet: 'Def',
|
|
1211
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1212
|
+
});
|
|
1213
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1214
|
+
question: 'Abc',
|
|
1215
|
+
answerSnippet: 'Def',
|
|
1216
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1217
|
+
});
|
|
1218
|
+
});
|
|
1219
|
+
|
|
1220
|
+
it('should send proper payload for #logExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1221
|
+
await client.logExpandSmartSnippetSuggestion({
|
|
1222
|
+
contentIdKey: 'permanentid',
|
|
1223
|
+
contentIdValue: 'foo',
|
|
1224
|
+
});
|
|
1225
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1226
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1227
|
+
});
|
|
1228
|
+
});
|
|
1229
|
+
|
|
1230
|
+
it('should send proper payload for #makeExpandSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1231
|
+
const built = await client.makeExpandSmartSnippetSuggestion({
|
|
1232
|
+
contentIdKey: 'permanentid',
|
|
1233
|
+
contentIdValue: 'foo',
|
|
1234
|
+
});
|
|
1235
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1236
|
+
expectMatchCustomEventPayload(SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1237
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1238
|
+
});
|
|
1239
|
+
expectMatchDescription(built.description, SearchPageEvents.expandSmartSnippetSuggestion, {
|
|
1240
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1241
|
+
});
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
it('should send proper payload for #logCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1245
|
+
await client.logCollapseSmartSnippetSuggestion({
|
|
1246
|
+
contentIdKey: 'permanentid',
|
|
1247
|
+
contentIdValue: 'foo',
|
|
1248
|
+
});
|
|
1249
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1250
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1251
|
+
});
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
it('should send proper payload for #makeCollapseSmartSnippetSuggestion when called with only the documentId', async () => {
|
|
1255
|
+
const built = await client.makeCollapseSmartSnippetSuggestion({
|
|
1256
|
+
contentIdKey: 'permanentid',
|
|
1257
|
+
contentIdValue: 'foo',
|
|
1258
|
+
});
|
|
1259
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1260
|
+
expectMatchCustomEventPayload(SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1261
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1262
|
+
});
|
|
1263
|
+
expectMatchDescription(built.description, SearchPageEvents.collapseSmartSnippetSuggestion, {
|
|
1264
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1265
|
+
});
|
|
1266
|
+
});
|
|
1267
|
+
|
|
1268
|
+
it('should send proper payload for #logShowMoreSmartSnippetSuggestion', async () => {
|
|
1269
|
+
await client.logShowMoreSmartSnippetSuggestion({
|
|
1270
|
+
question: 'Abc',
|
|
1271
|
+
answerSnippet: 'Def',
|
|
1272
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1273
|
+
});
|
|
1274
|
+
expectMatchCustomEventPayload(SearchPageEvents.showMoreSmartSnippetSuggestion, {
|
|
1275
|
+
question: 'Abc',
|
|
1276
|
+
answerSnippet: 'Def',
|
|
1277
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1278
|
+
});
|
|
1279
|
+
});
|
|
1738
1280
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1281
|
+
it('should send proper payload for #logShowLessSmartSnippetSuggestion', async () => {
|
|
1282
|
+
await client.logShowLessSmartSnippetSuggestion({
|
|
1283
|
+
question: 'Abc',
|
|
1284
|
+
answerSnippet: 'Def',
|
|
1285
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1286
|
+
});
|
|
1287
|
+
expectMatchCustomEventPayload(SearchPageEvents.showLessSmartSnippetSuggestion, {
|
|
1288
|
+
question: 'Abc',
|
|
1289
|
+
answerSnippet: 'Def',
|
|
1290
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1743
1291
|
});
|
|
1292
|
+
});
|
|
1744
1293
|
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
});
|
|
1294
|
+
it('should send proper payload for #logOpenSmartSnippetSource', async () => {
|
|
1295
|
+
await client.logOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
1296
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
1297
|
+
});
|
|
1750
1298
|
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
|
|
1756
|
-
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerExpand, meta);
|
|
1757
|
-
});
|
|
1299
|
+
it('should send proper payload for #logCopyToClipboard', async () => {
|
|
1300
|
+
await client.logCopyToClipboard(fakeDocInfo, fakeDocID);
|
|
1301
|
+
expectMatchDocumentPayload(SearchPageEvents.copyToClipboard, fakeDocInfo, fakeDocID);
|
|
1302
|
+
});
|
|
1758
1303
|
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1304
|
+
it('should send proper payload for #makeOpenSmartSnippetSource', async () => {
|
|
1305
|
+
const built = await client.makeOpenSmartSnippetSource(fakeDocInfo, fakeDocID);
|
|
1306
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1307
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSource, fakeDocInfo, fakeDocID);
|
|
1308
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetSource, {
|
|
1309
|
+
...fakeDocID,
|
|
1763
1310
|
});
|
|
1311
|
+
});
|
|
1764
1312
|
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1313
|
+
it('should send proper payload for #logOpenSmartSnippetSuggestionSource', async () => {
|
|
1314
|
+
const meta = {
|
|
1315
|
+
question: 'Abc',
|
|
1316
|
+
answerSnippet: 'Def',
|
|
1317
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1318
|
+
};
|
|
1319
|
+
await client.logOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
|
|
1320
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionSource, fakeDocInfo, {
|
|
1321
|
+
...meta,
|
|
1322
|
+
contentIDKey: meta.documentId.contentIdKey,
|
|
1323
|
+
contentIDValue: meta.documentId.contentIdValue,
|
|
1324
|
+
});
|
|
1325
|
+
});
|
|
1326
|
+
|
|
1327
|
+
it('should send proper payload for #makeOpenSmartSnippetSuggestionSource', async () => {
|
|
1328
|
+
const meta = {
|
|
1329
|
+
question: 'Abc',
|
|
1330
|
+
answerSnippet: 'Def',
|
|
1331
|
+
contentIDKey: 'permanentid',
|
|
1332
|
+
contentIDValue: 'foo',
|
|
1333
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1334
|
+
};
|
|
1335
|
+
const built = await client.makeOpenSmartSnippetSuggestionSource(fakeDocInfo, meta);
|
|
1336
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1337
|
+
expectMatchDocumentPayload(
|
|
1338
|
+
SearchPageEvents.openSmartSnippetSuggestionSource,
|
|
1339
|
+
fakeDocInfo,
|
|
1340
|
+
meta
|
|
1341
|
+
);
|
|
1342
|
+
expectMatchDescription(
|
|
1343
|
+
built.description,
|
|
1344
|
+
SearchPageEvents.openSmartSnippetSuggestionSource,
|
|
1345
|
+
meta
|
|
1346
|
+
);
|
|
1347
|
+
});
|
|
1348
|
+
|
|
1349
|
+
it('should send proper payload for #logOpenSmartSnippetInlineLink', async () => {
|
|
1350
|
+
const meta = {
|
|
1351
|
+
...fakeDocID,
|
|
1352
|
+
linkText: 'Some text',
|
|
1353
|
+
linkURL: 'https://invalid.com',
|
|
1354
|
+
};
|
|
1355
|
+
await client.logOpenSmartSnippetInlineLink(fakeDocInfo, meta);
|
|
1356
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
1357
|
+
});
|
|
1358
|
+
|
|
1359
|
+
it('should send proper payload for #makeOpenSmartSnippetInlineLink', async () => {
|
|
1360
|
+
const meta = {
|
|
1361
|
+
...fakeDocID,
|
|
1362
|
+
linkText: 'Some text',
|
|
1363
|
+
linkURL: 'https://invalid.com',
|
|
1364
|
+
};
|
|
1365
|
+
const built = await client.makeOpenSmartSnippetInlineLink(fakeDocInfo, meta);
|
|
1366
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1367
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetInlineLink, fakeDocInfo, meta);
|
|
1368
|
+
expectMatchDescription(built.description, SearchPageEvents.openSmartSnippetInlineLink, meta);
|
|
1369
|
+
});
|
|
1370
|
+
|
|
1371
|
+
it('should send proper payload for #logOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
1372
|
+
const meta = {
|
|
1373
|
+
question: 'Abc',
|
|
1374
|
+
answerSnippet: 'Def',
|
|
1375
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1376
|
+
linkText: 'Some text',
|
|
1377
|
+
linkURL: 'https://invalid.com',
|
|
1378
|
+
};
|
|
1379
|
+
await client.logOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
|
|
1380
|
+
expectMatchDocumentPayload(SearchPageEvents.openSmartSnippetSuggestionInlineLink, fakeDocInfo, {
|
|
1381
|
+
...meta,
|
|
1382
|
+
contentIDKey: meta.documentId.contentIdKey,
|
|
1383
|
+
contentIDValue: meta.documentId.contentIdValue,
|
|
1384
|
+
});
|
|
1385
|
+
});
|
|
1386
|
+
|
|
1387
|
+
it('should send proper payload for #makeOpenSmartSnippetSuggestionInlineLink', async () => {
|
|
1388
|
+
const meta = {
|
|
1389
|
+
question: 'Abc',
|
|
1390
|
+
answerSnippet: 'Def',
|
|
1391
|
+
contentIDKey: 'permanentid',
|
|
1392
|
+
contentIDValue: 'foo',
|
|
1393
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1394
|
+
linkText: 'Some text',
|
|
1395
|
+
linkURL: 'https://invalid.com',
|
|
1396
|
+
};
|
|
1397
|
+
const built = await client.makeOpenSmartSnippetSuggestionInlineLink(fakeDocInfo, meta);
|
|
1398
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1399
|
+
expectMatchDocumentPayload(
|
|
1400
|
+
SearchPageEvents.openSmartSnippetSuggestionInlineLink,
|
|
1401
|
+
fakeDocInfo,
|
|
1402
|
+
meta
|
|
1403
|
+
);
|
|
1404
|
+
expectMatchDescription(
|
|
1405
|
+
built.description,
|
|
1406
|
+
SearchPageEvents.openSmartSnippetSuggestionInlineLink,
|
|
1407
|
+
meta
|
|
1408
|
+
);
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
it('should send proper payload for #logRecentQueryClick', async () => {
|
|
1412
|
+
await client.logRecentQueryClick();
|
|
1413
|
+
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
it('should send proper payload for #makeRecentQueryClick', async () => {
|
|
1417
|
+
const built = await client.makeRecentQueryClick();
|
|
1418
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1419
|
+
|
|
1420
|
+
expectMatchPayload(SearchPageEvents.recentQueryClick);
|
|
1421
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.recentQueryClick);
|
|
1422
|
+
});
|
|
1423
|
+
|
|
1424
|
+
it('should send proper payload for #logClearRecentQueries', async () => {
|
|
1425
|
+
await client.logClearRecentQueries();
|
|
1426
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
1427
|
+
});
|
|
1428
|
+
|
|
1429
|
+
it('should send proper payload for #makeClearRecentQueries', async () => {
|
|
1430
|
+
const built = await client.makeClearRecentQueries();
|
|
1431
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1432
|
+
|
|
1433
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentQueries);
|
|
1434
|
+
expectMatchDescription(built.description, SearchPageEvents.clearRecentQueries);
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
it('should send proper payload for #logRecentResultClick', async () => {
|
|
1438
|
+
await client.logRecentResultClick(fakeDocInfo, fakeDocID);
|
|
1439
|
+
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
1440
|
+
info: fakeDocInfo,
|
|
1441
|
+
identifier: fakeDocID,
|
|
1442
|
+
});
|
|
1443
|
+
});
|
|
1444
|
+
|
|
1445
|
+
it('should send proper payload for #makeRecentResultClick', async () => {
|
|
1446
|
+
const built = await client.makeRecentResultClick(fakeDocInfo, fakeDocID);
|
|
1447
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1448
|
+
|
|
1449
|
+
expectMatchCustomEventPayload(SearchPageEvents.recentResultClick, {
|
|
1450
|
+
info: fakeDocInfo,
|
|
1451
|
+
identifier: fakeDocID,
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1454
|
+
expectMatchDescription(built.description, SearchPageEvents.recentResultClick, {
|
|
1455
|
+
info: fakeDocInfo,
|
|
1456
|
+
identifier: fakeDocID,
|
|
1457
|
+
});
|
|
1458
|
+
});
|
|
1459
|
+
|
|
1460
|
+
it('should send proper payload for #logNoResultsBack', async () => {
|
|
1461
|
+
await client.logNoResultsBack();
|
|
1462
|
+
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
1463
|
+
});
|
|
1464
|
+
|
|
1465
|
+
it('should send proper payload for #makeNoResultsBack', async () => {
|
|
1466
|
+
const built = await client.makeNoResultsBack();
|
|
1467
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1468
|
+
|
|
1469
|
+
expectMatchPayload(SearchPageEvents.noResultsBack);
|
|
1470
|
+
expectSearchEventToMatchDescription(built.description, SearchPageEvents.noResultsBack);
|
|
1471
|
+
});
|
|
1472
|
+
|
|
1473
|
+
it('should send proper payload for #logClearRecentResults', async () => {
|
|
1474
|
+
await client.logClearRecentResults();
|
|
1475
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
1476
|
+
});
|
|
1477
|
+
|
|
1478
|
+
it('should send proper payload for #makeClearRecentResults', async () => {
|
|
1479
|
+
const built = await client.makeClearRecentResults();
|
|
1480
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1481
|
+
|
|
1482
|
+
expectMatchCustomEventPayload(SearchPageEvents.clearRecentResults);
|
|
1483
|
+
expectMatchDescription(built.description, SearchPageEvents.clearRecentResults);
|
|
1484
|
+
});
|
|
1485
|
+
|
|
1486
|
+
it('should send proper payload for #logCustomEventWithType', async () => {
|
|
1487
|
+
await client.logCustomEventWithType('foo', 'bar', {buzz: 'bazz'});
|
|
1488
|
+
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
it('should send proper payload for #makeCustomEventWithType', async () => {
|
|
1492
|
+
const built = await client.makeCustomEventWithType('foo', 'bar', {
|
|
1493
|
+
buzz: 'bazz',
|
|
1494
|
+
});
|
|
1495
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1496
|
+
|
|
1497
|
+
expectMatchCustomEventWithTypePayload('foo', 'bar', {buzz: 'bazz'});
|
|
1498
|
+
expectMatchDescription(built.description, 'foo' as SearchPageEvents, {
|
|
1499
|
+
buzz: 'bazz',
|
|
1500
|
+
});
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
it('should enable analytics tracking by default', () => {
|
|
1504
|
+
const c = new CoveoSearchPageClient({}, provider);
|
|
1505
|
+
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1506
|
+
});
|
|
1507
|
+
|
|
1508
|
+
it('should allow disabling analytics on initialization', () => {
|
|
1509
|
+
const c = new CoveoSearchPageClient({enableAnalytics: false}, provider);
|
|
1510
|
+
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1511
|
+
});
|
|
1512
|
+
|
|
1513
|
+
it('should disable analytics when doNotTrack is enabled', async () => {
|
|
1514
|
+
(doNotTrack as Mock).mockImplementationOnce(() => true);
|
|
1515
|
+
|
|
1516
|
+
const c = new CoveoSearchPageClient({}, provider);
|
|
1517
|
+
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1518
|
+
});
|
|
1519
|
+
|
|
1520
|
+
it('keeps a real analytics client under doNotTrack when disableBrowserPrivacySignals is true', () => {
|
|
1521
|
+
(doNotTrack as Mock).mockImplementation(() => true);
|
|
1522
|
+
|
|
1523
|
+
const c = new CoveoSearchPageClient({disableBrowserPrivacySignals: true}, provider);
|
|
1524
|
+
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1525
|
+
|
|
1526
|
+
(doNotTrack as Mock).mockReset();
|
|
1527
|
+
});
|
|
1528
|
+
|
|
1529
|
+
it('still disables analytics when enableAnalytics is false even if disableBrowserPrivacySignals is true', () => {
|
|
1530
|
+
const c = new CoveoSearchPageClient(
|
|
1531
|
+
{enableAnalytics: false, disableBrowserPrivacySignals: true},
|
|
1532
|
+
provider
|
|
1533
|
+
);
|
|
1534
|
+
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1535
|
+
});
|
|
1536
|
+
|
|
1537
|
+
it('should allow disabling analytics after initialization', () => {
|
|
1538
|
+
const c = new CoveoSearchPageClient({enableAnalytics: true}, provider);
|
|
1539
|
+
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1540
|
+
c.disable();
|
|
1541
|
+
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1542
|
+
});
|
|
1543
|
+
|
|
1544
|
+
it('disabling analytics does not delete the visitorId', () => {
|
|
1545
|
+
const visitorId = 'uuid';
|
|
1546
|
+
Cookie.set('coveo_visitorId', visitorId);
|
|
1547
|
+
const c = new CoveoSearchPageClient({enableAnalytics: true}, provider);
|
|
1548
|
+
|
|
1549
|
+
expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
|
|
1550
|
+
c.disable();
|
|
1551
|
+
expect(Cookie.get('coveo_visitorId')).toBe(visitorId);
|
|
1552
|
+
});
|
|
1553
|
+
|
|
1554
|
+
it('should allow enabling analytics after initialization', () => {
|
|
1555
|
+
const c = new CoveoSearchPageClient({enableAnalytics: false}, provider);
|
|
1556
|
+
expect(c.coveoAnalyticsClient instanceof NoopAnalytics).toBe(true);
|
|
1557
|
+
c.enable();
|
|
1558
|
+
expect(c.coveoAnalyticsClient instanceof CoveoAnalyticsClient).toBe(true);
|
|
1559
|
+
});
|
|
1560
|
+
|
|
1561
|
+
it('should send proper payload for #logLikeGeneratedAnswer', async () => {
|
|
1562
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1563
|
+
await client.logLikeGeneratedAnswer(meta);
|
|
1564
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1565
|
+
});
|
|
1566
|
+
|
|
1567
|
+
it('should send proper payload for #logLikeGeneratedAnswer with agent metadata', async () => {
|
|
1568
|
+
const meta = {
|
|
1569
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1570
|
+
conversationId: fakeConversationId,
|
|
1571
|
+
};
|
|
1572
|
+
await client.logLikeGeneratedAnswer(meta);
|
|
1573
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1574
|
+
});
|
|
1575
|
+
|
|
1576
|
+
it('should send proper payload for #makeLikeGeneratedAnswer', async () => {
|
|
1577
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1578
|
+
const built = await client.makeLikeGeneratedAnswer(meta);
|
|
1579
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1580
|
+
expectMatchCustomEventPayload(SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1581
|
+
expectMatchDescription(built.description, SearchPageEvents.likeGeneratedAnswer, meta);
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
it('should send proper payload for #logDislikeGeneratedAnswer', async () => {
|
|
1585
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1586
|
+
await client.logDislikeGeneratedAnswer(meta);
|
|
1587
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1588
|
+
});
|
|
1589
|
+
|
|
1590
|
+
it('should send proper payload for #logDislikeGeneratedAnswer with agent metadata', async () => {
|
|
1591
|
+
const meta = {
|
|
1592
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1593
|
+
conversationId: fakeConversationId,
|
|
1594
|
+
};
|
|
1595
|
+
await client.logDislikeGeneratedAnswer(meta);
|
|
1596
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
it('should send proper payload for #makeDislikeGeneratedAnswer', async () => {
|
|
1600
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1601
|
+
const built = await client.makeDislikeGeneratedAnswer(meta);
|
|
1602
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1603
|
+
expectMatchCustomEventPayload(SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1604
|
+
expectMatchDescription(built.description, SearchPageEvents.dislikeGeneratedAnswer, meta);
|
|
1605
|
+
});
|
|
1606
|
+
|
|
1607
|
+
it('should send proper payload for #logOpenGeneratedAnswerSource', async () => {
|
|
1608
|
+
const meta = {
|
|
1609
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1610
|
+
citationId: 'some-document-id',
|
|
1611
|
+
permanentId: 'perm-id',
|
|
1612
|
+
};
|
|
1613
|
+
await client.logOpenGeneratedAnswerSource(meta);
|
|
1614
|
+
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1615
|
+
});
|
|
1616
|
+
|
|
1617
|
+
it('should send proper payload for #logOpenGeneratedAnswerSource with agent metadata', async () => {
|
|
1618
|
+
const meta = {
|
|
1619
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1620
|
+
conversationId: fakeConversationId,
|
|
1621
|
+
citationId: 'some-document-id',
|
|
1622
|
+
permanentId: 'perm-id',
|
|
1623
|
+
};
|
|
1624
|
+
await client.logOpenGeneratedAnswerSource(meta);
|
|
1625
|
+
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1626
|
+
});
|
|
1627
|
+
|
|
1628
|
+
it('should send proper payload for #makeOpenGeneratedAnswerSource', async () => {
|
|
1629
|
+
const meta = {
|
|
1630
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1631
|
+
citationId: 'some-document-id',
|
|
1632
|
+
permanentId: 'perm-id',
|
|
1633
|
+
};
|
|
1634
|
+
const built = await client.makeOpenGeneratedAnswerSource(meta);
|
|
1635
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1636
|
+
expectMatchCustomEventPayload(SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1637
|
+
expectMatchDescription(built.description, SearchPageEvents.openGeneratedAnswerSource, meta);
|
|
1638
|
+
});
|
|
1639
|
+
|
|
1640
|
+
it('should send proper payload for #logGeneratedAnswerOpenInlineLink', async () => {
|
|
1641
|
+
const meta = {
|
|
1642
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1643
|
+
conversationId: fakeConversationId,
|
|
1644
|
+
linkText: 'Read more',
|
|
1645
|
+
linkURL: 'https://example.com',
|
|
1646
|
+
};
|
|
1647
|
+
await client.logGeneratedAnswerOpenInlineLink(meta);
|
|
1648
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1649
|
+
});
|
|
1650
|
+
|
|
1651
|
+
it('should send proper payload for #makeGeneratedAnswerOpenInlineLink', async () => {
|
|
1652
|
+
const meta = {
|
|
1653
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1654
|
+
linkText: 'Read more',
|
|
1655
|
+
linkURL: 'https://example.com',
|
|
1656
|
+
};
|
|
1657
|
+
const built = await client.makeGeneratedAnswerOpenInlineLink(meta);
|
|
1658
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1659
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1660
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerOpenInlineLink, meta);
|
|
1661
|
+
});
|
|
1662
|
+
|
|
1663
|
+
it('should send proper payload for #logGeneratedAnswerCitationClick', async () => {
|
|
1664
|
+
const meta = {
|
|
1665
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1666
|
+
citationId: 'some-document-id',
|
|
1667
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1668
|
+
};
|
|
1772
1669
|
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
documented: <GeneratedAnswerFeedbackReasonOption>'no',
|
|
1779
|
-
correctTopic: <GeneratedAnswerFeedbackReasonOption>'unknown',
|
|
1780
|
-
hallucinationFree: <GeneratedAnswerFeedbackReasonOption>'yes',
|
|
1781
|
-
details: 'a few additional details',
|
|
1782
|
-
documentUrl: 'https://document.com',
|
|
1783
|
-
};
|
|
1784
|
-
await client.logGeneratedAnswerFeedbackSubmitV2(meta);
|
|
1785
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFeedbackSubmitV2, meta);
|
|
1670
|
+
await client.logGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1671
|
+
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, {
|
|
1672
|
+
...meta,
|
|
1673
|
+
contentIDKey: meta.documentId.contentIdKey,
|
|
1674
|
+
contentIDValue: meta.documentId.contentIdValue,
|
|
1786
1675
|
});
|
|
1676
|
+
});
|
|
1787
1677
|
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFeedbackSubmit, meta);
|
|
1796
|
-
});
|
|
1678
|
+
it('should send proper payload for #logGeneratedAnswerCitationClick with agent metadata', async () => {
|
|
1679
|
+
const meta = {
|
|
1680
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1681
|
+
conversationId: fakeConversationId,
|
|
1682
|
+
citationId: 'some-document-id',
|
|
1683
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1684
|
+
};
|
|
1797
1685
|
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1686
|
+
await client.logGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1687
|
+
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, {
|
|
1688
|
+
...meta,
|
|
1689
|
+
contentIDKey: meta.documentId.contentIdKey,
|
|
1690
|
+
contentIDValue: meta.documentId.contentIdValue,
|
|
1691
|
+
});
|
|
1692
|
+
});
|
|
1693
|
+
|
|
1694
|
+
it('should send proper payload for #makeGeneratedAnswerCitationClick', async () => {
|
|
1695
|
+
const meta = {
|
|
1696
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1697
|
+
citationId: 'some-document-id',
|
|
1698
|
+
contentIDKey: 'permanentid',
|
|
1699
|
+
contentIDValue: 'foo',
|
|
1700
|
+
documentId: {contentIdKey: 'permanentid', contentIdValue: 'foo'},
|
|
1701
|
+
};
|
|
1702
|
+
const built = await client.makeGeneratedAnswerCitationClick(fakeDocInfo, meta);
|
|
1703
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1704
|
+
expectMatchDocumentPayload(SearchPageEvents.generatedAnswerCitationClick, fakeDocInfo, meta);
|
|
1705
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerCitationClick, meta);
|
|
1706
|
+
});
|
|
1707
|
+
|
|
1708
|
+
it('should send proper payload for #logGeneratedAnswerFollowupOpenSource', async () => {
|
|
1709
|
+
const meta = {
|
|
1710
|
+
...fakeDocInfo,
|
|
1711
|
+
citationId: 'some-document-id',
|
|
1712
|
+
permanentId: 'perm-id',
|
|
1713
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1714
|
+
conversationId: fakeConversationId,
|
|
1715
|
+
};
|
|
1809
1716
|
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1717
|
+
await client.logGeneratedAnswerFollowupOpenSource(meta);
|
|
1718
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFollowupOpenSource, meta);
|
|
1719
|
+
});
|
|
1720
|
+
|
|
1721
|
+
it('should send proper payload for #makeGeneratedAnswerFollowupOpenSource', async () => {
|
|
1722
|
+
const meta = {
|
|
1723
|
+
...fakeDocInfo,
|
|
1724
|
+
citationId: 'some-document-id',
|
|
1725
|
+
permanentId: 'perm-id',
|
|
1726
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1727
|
+
conversationId: fakeConversationId,
|
|
1728
|
+
};
|
|
1818
1729
|
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1730
|
+
const built = await client.makeGeneratedAnswerFollowupOpenSource(meta);
|
|
1731
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1732
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFollowupOpenSource, meta);
|
|
1733
|
+
expectMatchDescription(
|
|
1734
|
+
built.description,
|
|
1735
|
+
SearchPageEvents.generatedAnswerFollowupOpenSource,
|
|
1736
|
+
meta
|
|
1737
|
+
);
|
|
1738
|
+
});
|
|
1739
|
+
|
|
1740
|
+
it('should send proper payload for #logGeneratedAnswerStreamEnd', async () => {
|
|
1741
|
+
const meta = {
|
|
1742
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1743
|
+
answerGenerated: true,
|
|
1744
|
+
answerTextIsEmpty: false,
|
|
1745
|
+
};
|
|
1746
|
+
await client.logGeneratedAnswerStreamEnd(meta);
|
|
1747
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1748
|
+
});
|
|
1749
|
+
|
|
1750
|
+
it('should send proper payload for #logGeneratedAnswerStreamEnd with agent metadata', async () => {
|
|
1751
|
+
const meta = {
|
|
1752
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1753
|
+
conversationId: fakeConversationId,
|
|
1754
|
+
answerGenerated: true,
|
|
1755
|
+
answerTextIsEmpty: false,
|
|
1756
|
+
};
|
|
1757
|
+
await client.logGeneratedAnswerStreamEnd(meta);
|
|
1758
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1759
|
+
});
|
|
1760
|
+
|
|
1761
|
+
it('should send proper payload for #makeGeneratedAnswerStreamEnd', async () => {
|
|
1762
|
+
const meta = {
|
|
1763
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1764
|
+
answerGenerated: true,
|
|
1765
|
+
answerTextIsEmpty: false,
|
|
1766
|
+
};
|
|
1767
|
+
const built = await client.makeGeneratedAnswerStreamEnd(meta);
|
|
1768
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1769
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1770
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerStreamEnd, meta);
|
|
1771
|
+
});
|
|
1772
|
+
|
|
1773
|
+
it('should send proper payload for #logGeneratedAnswerSourceHover', async () => {
|
|
1774
|
+
const meta = {
|
|
1775
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1776
|
+
citationId: 'some-document-id',
|
|
1777
|
+
permanentId: 'perm-id',
|
|
1778
|
+
citationHoverTimeMs: 100,
|
|
1779
|
+
};
|
|
1780
|
+
await client.logGeneratedAnswerSourceHover(meta);
|
|
1781
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1782
|
+
});
|
|
1783
|
+
|
|
1784
|
+
it('should send proper payload for #logGeneratedAnswerSourceHover with agent metadata', async () => {
|
|
1785
|
+
const meta = {
|
|
1786
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1787
|
+
conversationId: fakeConversationId,
|
|
1788
|
+
citationId: 'some-document-id',
|
|
1789
|
+
permanentId: 'perm-id',
|
|
1790
|
+
citationHoverTimeMs: 100,
|
|
1791
|
+
};
|
|
1792
|
+
await client.logGeneratedAnswerSourceHover(meta);
|
|
1793
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1794
|
+
});
|
|
1795
|
+
|
|
1796
|
+
it('should send proper payload for #makeGeneratedAnswerSourceHover', async () => {
|
|
1797
|
+
const meta = {
|
|
1798
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1799
|
+
citationId: 'some-document-id',
|
|
1800
|
+
permanentId: 'perm-id',
|
|
1801
|
+
citationHoverTimeMs: 100,
|
|
1802
|
+
};
|
|
1803
|
+
const built = await client.makeGeneratedAnswerSourceHover(meta);
|
|
1804
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1805
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1806
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerSourceHover, meta);
|
|
1807
|
+
});
|
|
1808
|
+
|
|
1809
|
+
it('should send proper payload for #logGeneratedAnswerCopyToClipboard', async () => {
|
|
1810
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1811
|
+
await client.logGeneratedAnswerCopyToClipboard(meta);
|
|
1812
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCopyToClipboard, meta);
|
|
1813
|
+
});
|
|
1814
|
+
|
|
1815
|
+
it('should send proper payload for #logGeneratedAnswerCopyToClipboard with agent metadata', async () => {
|
|
1816
|
+
const meta = {
|
|
1817
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1818
|
+
conversationId: fakeConversationId,
|
|
1819
|
+
};
|
|
1820
|
+
await client.logGeneratedAnswerCopyToClipboard(meta);
|
|
1821
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCopyToClipboard, meta);
|
|
1822
|
+
});
|
|
1823
|
+
|
|
1824
|
+
it('should send proper payload for #makeGeneratedAnswerCopyToClipboard', async () => {
|
|
1825
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1826
|
+
const built = await client.makeGeneratedAnswerCopyToClipboard(meta);
|
|
1827
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1828
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCopyToClipboard, meta);
|
|
1829
|
+
expectMatchDescription(
|
|
1830
|
+
built.description,
|
|
1831
|
+
SearchPageEvents.generatedAnswerCopyToClipboard,
|
|
1832
|
+
meta
|
|
1833
|
+
);
|
|
1834
|
+
});
|
|
1835
|
+
|
|
1836
|
+
it('should send proper payload for #logGeneratedAnswerHideAnswers', async () => {
|
|
1837
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1838
|
+
await client.logGeneratedAnswerHideAnswers(meta);
|
|
1839
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerHideAnswers, meta);
|
|
1840
|
+
});
|
|
1841
|
+
|
|
1842
|
+
it('should send proper payload for #logGeneratedAnswerHideAnswers with agent metadata', async () => {
|
|
1843
|
+
const meta = {
|
|
1844
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1845
|
+
conversationId: fakeConversationId,
|
|
1846
|
+
};
|
|
1847
|
+
await client.logGeneratedAnswerHideAnswers(meta);
|
|
1848
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerHideAnswers, meta);
|
|
1849
|
+
});
|
|
1850
|
+
|
|
1851
|
+
it('should send proper payload for #makeGeneratedAnswerHideAnswers', async () => {
|
|
1852
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1853
|
+
const built = await client.makeGeneratedAnswerHideAnswers(meta);
|
|
1854
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1855
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerHideAnswers, meta);
|
|
1856
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerHideAnswers, meta);
|
|
1857
|
+
});
|
|
1858
|
+
|
|
1859
|
+
it('should send proper payload for #logGeneratedAnswerShowAnswers', async () => {
|
|
1860
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1861
|
+
await client.logGeneratedAnswerShowAnswers(meta);
|
|
1862
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, meta);
|
|
1863
|
+
});
|
|
1864
|
+
|
|
1865
|
+
it('should send proper payload for #logGeneratedAnswerShowAnswers with agent metadata', async () => {
|
|
1866
|
+
const meta = {
|
|
1867
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1868
|
+
conversationId: fakeConversationId,
|
|
1869
|
+
};
|
|
1870
|
+
await client.logGeneratedAnswerShowAnswers(meta);
|
|
1871
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, meta);
|
|
1872
|
+
});
|
|
1873
|
+
|
|
1874
|
+
it('should send proper payload for #makeGeneratedAnswerShowAnswers', async () => {
|
|
1875
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1876
|
+
const built = await client.makeGeneratedAnswerShowAnswers(meta);
|
|
1877
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1878
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerShowAnswers, meta);
|
|
1879
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerShowAnswers, meta);
|
|
1880
|
+
});
|
|
1881
|
+
|
|
1882
|
+
it('should send proper payload for #logGeneratedAnswerExpand', async () => {
|
|
1883
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1884
|
+
await client.logGeneratedAnswerExpand(meta);
|
|
1885
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
|
|
1886
|
+
});
|
|
1887
|
+
|
|
1888
|
+
it('should send proper payload for #logGeneratedAnswerExpand with agent metadata', async () => {
|
|
1889
|
+
const meta = {
|
|
1890
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1891
|
+
conversationId: fakeConversationId,
|
|
1892
|
+
};
|
|
1893
|
+
await client.logGeneratedAnswerExpand(meta);
|
|
1894
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
|
|
1895
|
+
});
|
|
1896
|
+
|
|
1897
|
+
it('should send proper payload for #makeGeneratedAnswerExpand', async () => {
|
|
1898
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1899
|
+
const built = await client.makeGeneratedAnswerExpand(meta);
|
|
1900
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1901
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerExpand, meta);
|
|
1902
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerExpand, meta);
|
|
1903
|
+
});
|
|
1904
|
+
|
|
1905
|
+
it('should send proper payload for #logGeneratedAnswerCollapse', async () => {
|
|
1906
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1907
|
+
await client.logGeneratedAnswerCollapse(meta);
|
|
1908
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, meta);
|
|
1909
|
+
});
|
|
1910
|
+
|
|
1911
|
+
it('should send proper payload for #makeGeneratedAnswerCollapse', async () => {
|
|
1912
|
+
const meta = {generativeQuestionAnsweringId: fakeStreamId};
|
|
1913
|
+
const built = await client.makeGeneratedAnswerCollapse(meta);
|
|
1914
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1915
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerCollapse, meta);
|
|
1916
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerCollapse, meta);
|
|
1917
|
+
});
|
|
1918
|
+
|
|
1919
|
+
it('should send proper payload for #logGeneratedAnswerFeedbackSubmitV2', async () => {
|
|
1920
|
+
const meta = {
|
|
1921
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1922
|
+
helpful: true,
|
|
1923
|
+
readable: <GeneratedAnswerFeedbackReasonOption>'yes',
|
|
1924
|
+
documented: <GeneratedAnswerFeedbackReasonOption>'no',
|
|
1925
|
+
correctTopic: <GeneratedAnswerFeedbackReasonOption>'unknown',
|
|
1926
|
+
hallucinationFree: <GeneratedAnswerFeedbackReasonOption>'yes',
|
|
1927
|
+
details: 'a few additional details',
|
|
1928
|
+
documentUrl: 'https://document.com',
|
|
1929
|
+
};
|
|
1930
|
+
await client.logGeneratedAnswerFeedbackSubmitV2(meta);
|
|
1931
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFeedbackSubmitV2, meta);
|
|
1932
|
+
});
|
|
1933
|
+
|
|
1934
|
+
it('should send proper payload for #logGeneratedAnswerFeedbackSubmit', async () => {
|
|
1935
|
+
const meta = {
|
|
1936
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1937
|
+
reason: <GeneratedAnswerFeedbackReason>'other',
|
|
1938
|
+
details: 'a few additional details',
|
|
1939
|
+
};
|
|
1940
|
+
await client.logGeneratedAnswerFeedbackSubmit(meta);
|
|
1941
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFeedbackSubmit, meta);
|
|
1942
|
+
});
|
|
1943
|
+
|
|
1944
|
+
it('should send proper payload for #makeGeneratedAnswerFeedbackSubmit', async () => {
|
|
1945
|
+
const meta = {
|
|
1946
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1947
|
+
reason: <GeneratedAnswerFeedbackReason>'other',
|
|
1948
|
+
details: 'a few additional details',
|
|
1949
|
+
};
|
|
1950
|
+
const built = await client.makeGeneratedAnswerFeedbackSubmit(meta);
|
|
1951
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1952
|
+
expectMatchCustomEventPayload(SearchPageEvents.generatedAnswerFeedbackSubmit, meta);
|
|
1953
|
+
expectMatchDescription(built.description, SearchPageEvents.generatedAnswerFeedbackSubmit, meta);
|
|
1954
|
+
});
|
|
1955
|
+
|
|
1956
|
+
it('should send proper payload for #logRephraseGeneratedAnswer', async () => {
|
|
1957
|
+
const meta = {
|
|
1958
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1959
|
+
rephraseFormat: <GeneratedAnswerRephraseFormat>'step',
|
|
1960
|
+
};
|
|
1961
|
+
await client.logRephraseGeneratedAnswer(meta);
|
|
1962
|
+
expectMatchPayload(SearchPageEvents.rephraseGeneratedAnswer, meta);
|
|
1963
|
+
});
|
|
1964
|
+
|
|
1965
|
+
it('should send proper payload for #makeRephraseGeneratedAnswer', async () => {
|
|
1966
|
+
const meta = {
|
|
1967
|
+
generativeQuestionAnsweringId: fakeStreamId,
|
|
1968
|
+
rephraseFormat: <GeneratedAnswerRephraseFormat>'step',
|
|
1969
|
+
};
|
|
1970
|
+
const built = await client.makeRephraseGeneratedAnswer(meta);
|
|
1971
|
+
await built.log({searchUID: provider.getSearchUID()});
|
|
1972
|
+
expectMatchPayload(SearchPageEvents.rephraseGeneratedAnswer, meta);
|
|
1973
|
+
expectSearchEventToMatchDescription(
|
|
1974
|
+
built.description,
|
|
1975
|
+
SearchPageEvents.rephraseGeneratedAnswer,
|
|
1976
|
+
meta
|
|
1977
|
+
);
|
|
1978
|
+
});
|
|
1829
1979
|
});
|