botium-core 1.13.5 → 1.13.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/botium-cjs.js +21 -7
  2. package/dist/botium-cjs.js.map +1 -1
  3. package/dist/botium-es.js +21 -7
  4. package/dist/botium-es.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/helpers/RetryHelper.js +3 -2
  7. package/src/scripting/MatchFunctions.js +3 -1
  8. package/src/scripting/ScriptingProvider.js +14 -4
  9. package/src/scripting/logichook/asserter/BotRepliesConsumedAsserter.js +1 -1
  10. package/src/scripting/logichook/asserter/BotRepliesUnconsumedCountAsserter.js +1 -1
  11. package/src/scripting/logichook/asserter/ButtonsAsserter.js +1 -1
  12. package/src/scripting/logichook/asserter/ButtonsCountAsserter.js +1 -1
  13. package/src/scripting/logichook/asserter/ButtonsCountRecAsserter.js +1 -1
  14. package/src/scripting/logichook/asserter/CardsAsserter.js +1 -1
  15. package/src/scripting/logichook/asserter/CardsCountAsserter.js +1 -1
  16. package/src/scripting/logichook/asserter/CardsCountRecAsserter.js +1 -1
  17. package/src/scripting/logichook/asserter/EntitiesAsserter.js +1 -1
  18. package/src/scripting/logichook/asserter/EntityContentAsserter.js +2 -2
  19. package/src/scripting/logichook/asserter/EntityValuesAsserter.js +1 -1
  20. package/src/scripting/logichook/asserter/FormsAsserter.js +1 -1
  21. package/src/scripting/logichook/asserter/IntentAsserter.js +3 -3
  22. package/src/scripting/logichook/asserter/IntentConfidenceAsserter.js +4 -4
  23. package/src/scripting/logichook/asserter/IntentUniqueAsserter.js +2 -2
  24. package/src/scripting/logichook/asserter/JsonPathAsserter.js +5 -5
  25. package/src/scripting/logichook/asserter/JsonPathCountAsserter.js +2 -2
  26. package/src/scripting/logichook/asserter/MediaAsserter.js +1 -1
  27. package/src/scripting/logichook/asserter/MediaCountAsserter.js +1 -1
  28. package/src/scripting/logichook/asserter/MediaCountRecAsserter.js +1 -1
  29. package/src/scripting/logichook/asserter/PauseAsserter.js +1 -1
  30. package/src/scripting/logichook/asserter/ResponseLengthAsserter.js +3 -2
  31. package/src/scripting/logichook/asserter/TextContainsAllAsserter.js +2 -1
  32. package/src/scripting/logichook/asserter/TextContainsAllICAsserter.js +2 -1
  33. package/src/scripting/logichook/asserter/TextContainsAnyAsserter.js +1 -0
  34. package/src/scripting/logichook/asserter/TextContainsAnyICAsserter.js +2 -1
  35. package/src/scripting/logichook/asserter/TextEqualsAnyAsserter.js +2 -1
  36. package/src/scripting/logichook/asserter/TextEqualsAnyICAsserter.js +2 -1
  37. package/src/scripting/logichook/asserter/TextRegexpAllAsserter.js +2 -1
  38. package/src/scripting/logichook/asserter/TextRegexpAllICAsserter.js +2 -1
  39. package/src/scripting/logichook/asserter/TextRegexpAnyAsserter.js +1 -0
  40. package/src/scripting/logichook/asserter/TextRegexpAnyICAsserter.js +2 -1
  41. package/src/scripting/logichook/asserter/TextWildcardAllAsserter.js +2 -1
  42. package/src/scripting/logichook/asserter/TextWildcardAllICAsserter.js +2 -1
  43. package/src/scripting/logichook/asserter/TextWildcardAnyAsserter.js +1 -0
  44. package/src/scripting/logichook/asserter/TextWildcardAnyICAsserter.js +2 -1
  45. package/src/scripting/logichook/asserter/TextWildcardExactAllAsserter.js +2 -1
  46. package/src/scripting/logichook/asserter/TextWildcardExactAllICAsserter.js +2 -1
  47. package/src/scripting/logichook/asserter/TextWildcardExactAnyAsserter.js +1 -0
  48. package/src/scripting/logichook/asserter/TextWildcardExactAnyICAsserter.js +2 -1
  49. package/src/scripting/logichook/asserter/WerAsserter.js +10 -8
  50. package/test/convo/transcript.spec.js +6 -6
  51. package/test/scripting/asserters/convos/{wer_threshold_nok.yml → wer_threshold_nok_float.yml} +0 -0
  52. package/test/scripting/asserters/convos/wer_threshold_nok_percentage.yml +7 -0
  53. package/test/scripting/asserters/convos/{wer_threshold_ok.yml → wer_threshold_ok_float.yml} +0 -0
  54. package/test/scripting/asserters/convos/wer_threshold_ok_percentage.yml +7 -0
  55. package/test/scripting/asserters/entityContentAsserter.spec.js +2 -7
  56. package/test/scripting/asserters/intentAsserter.spec.js +1 -1
  57. package/test/scripting/asserters/jsonpathAsserter.spec.js +1 -1
  58. package/test/scripting/asserters/werAsserter.spec.js +25 -5
  59. package/test/scripting/matching/matchingmode.spec.js +42 -2
  60. package/test/scripting/scriptingModificator.spec.js +1 -2
package/dist/botium-es.js CHANGED
@@ -37,7 +37,7 @@ import express from 'express';
37
37
  import bodyParser from 'body-parser';
38
38
 
39
39
  var name = "botium-core";
40
- var version$1 = "1.13.5";
40
+ var version$1 = "1.13.6";
41
41
  var description = "The Selenium for Chatbots";
42
42
  var main = "index.js";
43
43
  var module = "dist/botium-es.js";
@@ -2789,7 +2789,10 @@ var RetryHelper_1 = class RetryHelper {
2789
2789
  factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (lodash.isNil(options.factor) ? 1 : options.factor),
2790
2790
  minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (lodash.isNil(options.minTimeout) ? 1000 : options.minTimeout)
2791
2791
  };
2792
- debug$j(`Retry for ${section} is ${this.retrySettings.retries > 0 ? 'enabled' : 'disabled'}. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
2792
+
2793
+ if (this.retrySettings.retries > 0) {
2794
+ debug$j(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`);
2795
+ }
2793
2796
  }
2794
2797
 
2795
2798
  shouldRetry(err) {
@@ -3827,7 +3830,8 @@ const equals = ignoreCase => (botresponse, utterance) => {
3827
3830
  const wer = () => (botresponse, utterance, args) => {
3828
3831
  botresponse = _normalize(botresponse || '');
3829
3832
  utterance = toString(utterance || '');
3830
- return wordErrorRate.wordErrorRate(botresponse, utterance) <= args[0];
3833
+ const threshold = [',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100;
3834
+ return wordErrorRate.wordErrorRate(botresponse, utterance) <= threshold;
3831
3835
  };
3832
3836
 
3833
3837
  const getMatchFunction$1 = matchingMode => {
@@ -6222,7 +6226,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6222
6226
 
6223
6227
  const found = lodash.find(tomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
6224
6228
 
6225
- const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'WerAsserter' : 'TextMatchAsserter';
6229
+ const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
6226
6230
 
6227
6231
  if (lodash.isNil(found)) {
6228
6232
  let message = `${stepTag}: Bot response `;
@@ -6234,13 +6238,18 @@ var ScriptingProvider_1 = class ScriptingProvider {
6234
6238
  throw new BotiumError$2(message, {
6235
6239
  type: 'asserter',
6236
6240
  source: asserterType,
6241
+ params: {
6242
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
6243
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
6244
+ },
6237
6245
  context: {
6238
6246
  stepTag
6239
6247
  },
6240
6248
  cause: {
6241
6249
  expected: tomatch,
6242
6250
  actual: botresponse,
6243
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
6251
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
6252
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
6244
6253
  }
6245
6254
  });
6246
6255
  }
@@ -6254,7 +6263,7 @@ var ScriptingProvider_1 = class ScriptingProvider {
6254
6263
 
6255
6264
  const found = lodash.find(nottomatch, utt => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]));
6256
6265
 
6257
- const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'WerAsserter' : 'TextMatchAsserter';
6266
+ const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter';
6258
6267
 
6259
6268
  if (!lodash.isNil(found)) {
6260
6269
  let message = `${stepTag}: Bot response `;
@@ -6266,6 +6275,10 @@ var ScriptingProvider_1 = class ScriptingProvider {
6266
6275
  throw new BotiumError$2(message, {
6267
6276
  type: 'asserter',
6268
6277
  source: asserterType,
6278
+ params: {
6279
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
6280
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
6281
+ },
6269
6282
  context: {
6270
6283
  stepTag
6271
6284
  },
@@ -6273,7 +6286,8 @@ var ScriptingProvider_1 = class ScriptingProvider {
6273
6286
  not: true,
6274
6287
  expected: nottomatch,
6275
6288
  actual: botresponse,
6276
- matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
6289
+ matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
6290
+ args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
6277
6291
  }
6278
6292
  });
6279
6293
  }