wingbot 3.67.26 → 3.67.28
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/package.json
CHANGED
|
@@ -115,7 +115,7 @@ class ConversationTester {
|
|
|
115
115
|
* @param {boolean} [options.disableAssertTexts]
|
|
116
116
|
* @param {boolean} [options.disableAssertQuickReplies]
|
|
117
117
|
* @param {boolean} [options.useConversationForTextTestCases]
|
|
118
|
-
* @param {
|
|
118
|
+
* @param {number} [options.textThreshold]
|
|
119
119
|
* @param {number} [options.stepCasesPerStep]
|
|
120
120
|
* @param {number} [options.textCasesPerStep]
|
|
121
121
|
* @param {number} [options.textCaseParallel]
|
|
@@ -403,21 +403,27 @@ class ConversationTester {
|
|
|
403
403
|
* @param {TestsGroup} testsGroup
|
|
404
404
|
* @param {object} [botconfig]
|
|
405
405
|
* @param {string} [lang]
|
|
406
|
-
* @returns {Tester}
|
|
406
|
+
* @returns {Promise<Tester>}
|
|
407
407
|
*/
|
|
408
|
-
_createTester (testsGroup, botconfig = null, lang = null) {
|
|
408
|
+
async _createTester (testsGroup, botconfig = null, lang = null) {
|
|
409
409
|
if (!this._cachedBot) {
|
|
410
|
-
this._cachedBot = this._botFactory(true)
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
410
|
+
this._cachedBot = Promise.resolve(this._botFactory(true))
|
|
411
|
+
.then((cb) => {
|
|
412
|
+
if (botconfig) {
|
|
413
|
+
cb.buildWithSnapshot(botconfig.blocks, Number.MAX_SAFE_INTEGER);
|
|
414
|
+
}
|
|
415
|
+
return cb;
|
|
416
|
+
})
|
|
417
|
+
.catch((e) => { this._cachedBot = null; throw e; });
|
|
414
418
|
}
|
|
415
419
|
|
|
420
|
+
const cachedBot = await this._cachedBot;
|
|
421
|
+
|
|
416
422
|
let t;
|
|
417
423
|
if (typeof this._options.testerFactory === 'function') {
|
|
418
|
-
t = this._options.testerFactory(
|
|
424
|
+
t = this._options.testerFactory(cachedBot, testsGroup);
|
|
419
425
|
} else {
|
|
420
|
-
t = new Tester(
|
|
426
|
+
t = new Tester(cachedBot);
|
|
421
427
|
t.allowEmptyResponse = !!this._options.allowEmptyResponse;
|
|
422
428
|
}
|
|
423
429
|
|
|
@@ -436,7 +442,7 @@ class ConversationTester {
|
|
|
436
442
|
* @param {string} [lang]
|
|
437
443
|
*/
|
|
438
444
|
async _runTextCaseTests (testsGroup, botconfig = null, lang = null) {
|
|
439
|
-
const t = this._createTester(testsGroup, botconfig, lang);
|
|
445
|
+
const t = await this._createTester(testsGroup, botconfig, lang);
|
|
440
446
|
let out = '';
|
|
441
447
|
let passing = 0;
|
|
442
448
|
let longestText = 0;
|
|
@@ -499,7 +505,7 @@ class ConversationTester {
|
|
|
499
505
|
const out = [];
|
|
500
506
|
|
|
501
507
|
for (const testCase of testsGroup.testCases) {
|
|
502
|
-
const t = this._createTester(testsGroup, botconfig, lang);
|
|
508
|
+
const t = await this._createTester(testsGroup, botconfig, lang);
|
|
503
509
|
let o = '';
|
|
504
510
|
let fail = null;
|
|
505
511
|
// @ts-ignore
|
|
@@ -535,7 +541,7 @@ class ConversationTester {
|
|
|
535
541
|
*/
|
|
536
542
|
async executeTextCase (testsGroup, t, textCase, botconfig, longestText, lang = null) {
|
|
537
543
|
if (this._options.useConversationForTextTestCases) {
|
|
538
|
-
const tester = this._createTester(testsGroup, botconfig, lang);
|
|
544
|
+
const tester = await this._createTester(testsGroup, botconfig, lang);
|
|
539
545
|
|
|
540
546
|
try {
|
|
541
547
|
await tester.text(textCase.text);
|
|
@@ -275,7 +275,7 @@ function onInteractionHandler (
|
|
|
275
275
|
req,
|
|
276
276
|
actions,
|
|
277
277
|
lastAction,
|
|
278
|
-
|
|
278
|
+
state,
|
|
279
279
|
// data,
|
|
280
280
|
skill,
|
|
281
281
|
prevSkill,
|
|
@@ -305,14 +305,14 @@ function onInteractionHandler (
|
|
|
305
305
|
lang,
|
|
306
306
|
[pagePathVar]: pagePath,
|
|
307
307
|
[userAgentVar]: userAgent
|
|
308
|
-
} =
|
|
308
|
+
} = state;
|
|
309
309
|
|
|
310
310
|
const customDimensions = {};
|
|
311
311
|
for (let i = 1; i <= 8; i++) {
|
|
312
312
|
const k = `cd${i}`;
|
|
313
|
-
if (!['undefined', 'object'].includes(typeof
|
|
313
|
+
if (!['undefined', 'object'].includes(typeof state[k])) {
|
|
314
314
|
Object.assign(customDimensions, {
|
|
315
|
-
[k]:
|
|
315
|
+
[k]: state[k]
|
|
316
316
|
});
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -23,7 +23,7 @@ const ConversationTester = require('../ConversationTester');
|
|
|
23
23
|
* @param {boolean} [options.disableAssertTexts]
|
|
24
24
|
* @param {boolean} [options.disableAssertQuickReplies]
|
|
25
25
|
* @param {boolean} [options.useConversationForTextTestCases]
|
|
26
|
-
* @param {
|
|
26
|
+
* @param {number} [options.textThreshold]
|
|
27
27
|
* @param {number} [options.stepCasesPerStep]
|
|
28
28
|
* @param {number} [options.textCasesPerStep]
|
|
29
29
|
* @param {number} [options.textCaseParallel]
|
|
@@ -102,7 +102,7 @@ function validateBotApi (botFactory, postBackTest = null, textTest = null, acl =
|
|
|
102
102
|
validationRequestBody = decompress(validationRequestBody);
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
const bot = botFactory();
|
|
105
|
+
const bot = await Promise.resolve(botFactory());
|
|
106
106
|
|
|
107
107
|
await ctx.audit('validateBot');
|
|
108
108
|
return validate(bot, validationRequestBody, postBackTest, textTest);
|