botium-core 1.13.5 → 1.13.7
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/dist/botium-cjs.js +24 -10
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +24 -10
- package/dist/botium-es.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/RetryHelper.js +3 -2
- package/src/scripting/MatchFunctions.js +3 -1
- package/src/scripting/ScriptingProvider.js +14 -4
- package/src/scripting/logichook/LogicHookUtils.js +3 -3
- package/src/scripting/logichook/asserter/BotRepliesConsumedAsserter.js +1 -1
- package/src/scripting/logichook/asserter/BotRepliesUnconsumedCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/EntitiesAsserter.js +1 -1
- package/src/scripting/logichook/asserter/EntityContentAsserter.js +2 -2
- package/src/scripting/logichook/asserter/EntityValuesAsserter.js +1 -1
- package/src/scripting/logichook/asserter/FormsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/IntentAsserter.js +3 -3
- package/src/scripting/logichook/asserter/IntentConfidenceAsserter.js +4 -4
- package/src/scripting/logichook/asserter/IntentUniqueAsserter.js +2 -2
- package/src/scripting/logichook/asserter/JsonPathAsserter.js +9 -8
- package/src/scripting/logichook/asserter/JsonPathCountAsserter.js +2 -2
- package/src/scripting/logichook/asserter/MediaAsserter.js +1 -1
- package/src/scripting/logichook/asserter/MediaCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/MediaCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/PauseAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ResponseLengthAsserter.js +3 -2
- package/src/scripting/logichook/asserter/TextContainsAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextContainsAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextContainsAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextContainsAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextEqualsAnyAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextEqualsAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextRegexpAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextWildcardAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextWildcardExactAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/WerAsserter.js +10 -8
- package/test/convo/transcript.spec.js +6 -6
- package/test/scripting/asserters/convos/{wer_threshold_nok.yml → wer_threshold_nok_float.yml} +0 -0
- package/test/scripting/asserters/convos/wer_threshold_nok_percentage.yml +7 -0
- package/test/scripting/asserters/convos/{wer_threshold_ok.yml → wer_threshold_ok_float.yml} +0 -0
- package/test/scripting/asserters/convos/wer_threshold_ok_percentage.yml +7 -0
- package/test/scripting/asserters/entityContentAsserter.spec.js +2 -7
- package/test/scripting/asserters/intentAsserter.spec.js +1 -1
- package/test/scripting/asserters/jsonpathAsserter.spec.js +8 -8
- package/test/scripting/asserters/werAsserter.spec.js +25 -5
- package/test/scripting/matching/matchingmode.spec.js +42 -2
- package/test/scripting/scriptingModificator.spec.js +1 -2
package/dist/botium-cjs.js
CHANGED
|
@@ -81,7 +81,7 @@ var express__default = /*#__PURE__*/_interopDefaultLegacy(express);
|
|
|
81
81
|
var bodyParser__default = /*#__PURE__*/_interopDefaultLegacy(bodyParser);
|
|
82
82
|
|
|
83
83
|
var name = "botium-core";
|
|
84
|
-
var version$1 = "1.13.
|
|
84
|
+
var version$1 = "1.13.7";
|
|
85
85
|
var description = "The Selenium for Chatbots";
|
|
86
86
|
var main = "index.js";
|
|
87
87
|
var module$1 = "dist/botium-es.js";
|
|
@@ -1367,7 +1367,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1367
1367
|
|
|
1368
1368
|
|
|
1369
1369
|
if (hookType === 'asserter') {
|
|
1370
|
-
const asserter = DEFAULT_ASSERTERS.find(asserter => src === asserter.className);
|
|
1370
|
+
const asserter = DEFAULT_ASSERTERS.find(asserter => src === asserter.className || src === asserter.name);
|
|
1371
1371
|
|
|
1372
1372
|
if (asserter) {
|
|
1373
1373
|
return new asserter.Class({
|
|
@@ -1378,7 +1378,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
|
|
1380
1380
|
if (hookType === 'logichook') {
|
|
1381
|
-
const lh = DEFAULT_LOGIC_HOOKS.find(lh => src === lh.className);
|
|
1381
|
+
const lh = DEFAULT_LOGIC_HOOKS.find(lh => src === lh.className || src === lh.name);
|
|
1382
1382
|
|
|
1383
1383
|
if (lh) {
|
|
1384
1384
|
return new lh.Class({
|
|
@@ -1389,7 +1389,7 @@ var LogicHookUtils_1 = class LogicHookUtils {
|
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
1391
|
if (hookType === 'userinput') {
|
|
1392
|
-
const ui = DEFAULT_USER_INPUTS.find(ui => src === ui.className);
|
|
1392
|
+
const ui = DEFAULT_USER_INPUTS.find(ui => src === ui.className || src === ui.name);
|
|
1393
1393
|
|
|
1394
1394
|
if (ui) {
|
|
1395
1395
|
return new ui.Class({
|
|
@@ -2833,7 +2833,10 @@ var RetryHelper_1 = class RetryHelper {
|
|
|
2833
2833
|
factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash__default["default"].isNil(options.factor) ? 1 : options.factor),
|
|
2834
2834
|
minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash__default["default"].isNil(options.minTimeout) ? 1000 : options.minTimeout)
|
|
2835
2835
|
};
|
|
2836
|
-
|
|
2836
|
+
|
|
2837
|
+
if (this.retrySettings.retries > 0) {
|
|
2838
|
+
debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
|
|
2839
|
+
}
|
|
2837
2840
|
}
|
|
2838
2841
|
|
|
2839
2842
|
shouldRetry(err) {
|
|
@@ -3871,7 +3874,8 @@ const equals = ignoreCase => (botresponse, utterance) => {
|
|
|
3871
3874
|
const wer = () => (botresponse, utterance, args) => {
|
|
3872
3875
|
botresponse = _normalize(botresponse || '');
|
|
3873
3876
|
utterance = toString(utterance || '');
|
|
3874
|
-
|
|
3877
|
+
const threshold = [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
|
|
3878
|
+
return wordErrorRate__default["default"].wordErrorRate(botresponse, utterance) <= threshold;
|
|
3875
3879
|
};
|
|
3876
3880
|
|
|
3877
3881
|
const getMatchFunction$1 = matchingMode => {
|
|
@@ -6266,7 +6270,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6266
6270
|
|
|
6267
6271
|
const found = lodash__default["default"].find(tomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
|
|
6268
6272
|
|
|
6269
|
-
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? '
|
|
6273
|
+
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
|
|
6270
6274
|
|
|
6271
6275
|
if (lodash__default["default"].isNil(found)) {
|
|
6272
6276
|
let message = `${stepTag}: Bot response `;
|
|
@@ -6278,13 +6282,18 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6278
6282
|
throw new BotiumError$2(message, {
|
|
6279
6283
|
type: 'asserter',
|
|
6280
6284
|
source: asserterType,
|
|
6285
|
+
params: {
|
|
6286
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
6287
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
6288
|
+
},
|
|
6281
6289
|
context: {
|
|
6282
6290
|
stepTag
|
|
6283
6291
|
},
|
|
6284
6292
|
cause: {
|
|
6285
6293
|
expected: tomatch,
|
|
6286
6294
|
actual: botresponse,
|
|
6287
|
-
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
|
|
6295
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
6296
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
6288
6297
|
}
|
|
6289
6298
|
});
|
|
6290
6299
|
}
|
|
@@ -6298,7 +6307,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6298
6307
|
|
|
6299
6308
|
const found = lodash__default["default"].find(nottomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
|
|
6300
6309
|
|
|
6301
|
-
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? '
|
|
6310
|
+
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
|
|
6302
6311
|
|
|
6303
6312
|
if (!lodash__default["default"].isNil(found)) {
|
|
6304
6313
|
let message = `${stepTag}: Bot response `;
|
|
@@ -6310,6 +6319,10 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6310
6319
|
throw new BotiumError$2(message, {
|
|
6311
6320
|
type: 'asserter',
|
|
6312
6321
|
source: asserterType,
|
|
6322
|
+
params: {
|
|
6323
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
6324
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
6325
|
+
},
|
|
6313
6326
|
context: {
|
|
6314
6327
|
stepTag
|
|
6315
6328
|
},
|
|
@@ -6317,7 +6330,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
|
|
|
6317
6330
|
not: true,
|
|
6318
6331
|
expected: nottomatch,
|
|
6319
6332
|
actual: botresponse,
|
|
6320
|
-
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
|
|
6333
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
6334
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
6321
6335
|
}
|
|
6322
6336
|
});
|
|
6323
6337
|
}
|