botium-core 1.13.18 → 1.13.19

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 (33) hide show
  1. package/dist/botium-cjs.js +29 -6
  2. package/dist/botium-cjs.js.map +1 -1
  3. package/dist/botium-es.js +29 -6
  4. package/dist/botium-es.js.map +1 -1
  5. package/package.json +2 -1
  6. package/src/scripting/Convo.js +17 -5
  7. package/src/scripting/logichook/LogicHookConsts.js +5 -1
  8. package/src/scripting/logichook/asserter/ButtonsAsserter.js +5 -5
  9. package/src/scripting/logichook/logichooks/ConditionalBusinessHoursLogicHook.js +56 -0
  10. package/src/scripting/logichook/logichooks/ConditionalCapabilityValueBasedLogicHook.js +37 -0
  11. package/src/scripting/logichook/logichooks/ConditionalJsonPathBasedLogicHook.js +31 -0
  12. package/src/scripting/logichook/logichooks/ConditionalTimeBasedLogicHook.js +46 -0
  13. package/test/scripting/logichooks/CustomConditionalLogicHook.js +21 -0
  14. package/test/scripting/logichooks/conditionalStepBusinessHoursLogicHook.spec.js +130 -0
  15. package/test/scripting/logichooks/conditionalStepCapabilityValueBasedLogicHook.spec.js +35 -0
  16. package/test/scripting/logichooks/conditionalStepJsonPathBasedLogicHook.spec.js +35 -0
  17. package/test/scripting/logichooks/conditionalStepTimeBasedLogicHook.spec.js +91 -0
  18. package/test/scripting/logichooks/convos/conditional_steps.convo.txt +12 -0
  19. package/test/scripting/logichooks/convos/conditional_steps_business_hours.convo.txt +16 -0
  20. package/test/scripting/logichooks/convos/conditional_steps_cap_value_based.convo.txt +12 -0
  21. package/test/scripting/logichooks/convos/conditional_steps_followed_by_bot_msg.convo.txt +15 -0
  22. package/test/scripting/logichooks/convos/conditional_steps_followed_by_me.convo.txt +18 -0
  23. package/test/scripting/logichooks/convos/conditional_steps_json_path_based.convo.txt.convo.txt +12 -0
  24. package/test/scripting/logichooks/convos/conditional_steps_multiple_condition_groups.convo.txt +20 -0
  25. package/test/scripting/logichooks/convos/conditional_steps_multiple_condition_groups_no_assertion.convo.txt +20 -0
  26. package/test/scripting/logichooks/convos/conditional_steps_time_based.convo.txt +12 -0
  27. package/test/scripting/logichooks/customConditionalStepLogicHook.spec.js +105 -0
  28. package/test/scripting/scriptingProvider.spec.js +1 -1
  29. package/test/scripting/logichooks/convos/custom_embedded_skip.convo.txt +0 -11
  30. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_me.convo.txt +0 -11
  31. package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_nothing.convo.txt +0 -8
  32. package/test/scripting/logichooks/customEmbeddedSkip.json +0 -14
  33. package/test/scripting/logichooks/customEmbeddedSkip.spec.js +0 -58
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.18";
40
+ var version$1 = "1.13.19";
41
41
  var description = "The Selenium for Chatbots";
42
42
  var main = "index.js";
43
43
  var module = "dist/botium-es.js";
@@ -88,6 +88,7 @@ var dependencies = {
88
88
  "mime-types": "^2.1.35",
89
89
  mkdirp: "^3.0.1",
90
90
  moment: "^2.29.4",
91
+ "moment-timezone": "^0.5.43",
91
92
  mustache: "^4.2.0",
92
93
  "promise-retry": "^2.0.1",
93
94
  "promise.allsettled": "^1.0.6",
@@ -1160,6 +1161,18 @@ var LogicHookConsts = {
1160
1161
  }, {
1161
1162
  name: LOGIC_HOOK_INCLUDE$1,
1162
1163
  className: 'IncludeLogicHook'
1164
+ }, {
1165
+ name: 'CONDITIONAL_STEP_TIME_BASED',
1166
+ className: 'ConditionalTimeBasedLogicHook'
1167
+ }, {
1168
+ name: 'CONDITIONAL_STEP_BUSINESS_HOURS',
1169
+ className: 'ConditionalBusinessHoursLogicHook'
1170
+ }, {
1171
+ name: 'CONDITIONAL_STEP_CAPABILITY_VALUE_BASED',
1172
+ className: 'ConditionalCapabilityValueBasedLogicHook'
1173
+ }, {
1174
+ name: 'CONDITIONAL_STEP_JSON_PATH_BASED',
1175
+ className: 'ConditionalJsonPathBasedLogicHook.js'
1163
1176
  }],
1164
1177
  DEFAULT_USER_INPUTS: [{
1165
1178
  name: 'BUTTON',
@@ -3034,6 +3047,7 @@ class Convo$6 {
3034
3047
  throw failErr;
3035
3048
  }
3036
3049
  } else if (convoStep.sender === 'bot') {
3050
+ const previousWaitForBotSays = waitForBotSays;
3037
3051
  if (waitForBotSays) {
3038
3052
  botMsg = null;
3039
3053
  } else {
@@ -3089,13 +3103,22 @@ class Convo$6 {
3089
3103
  } catch (failErr) {}
3090
3104
  throw failErr;
3091
3105
  }
3092
- if (convoStep.skip === true) {
3093
- skipTranscriptStep = true;
3106
+ if (convoStep.conditional) {
3094
3107
  const nextConvoStep = this.conversation[i + 1];
3095
- if (nextConvoStep && nextConvoStep.sender === 'bot') {
3096
- waitForBotSays = false;
3108
+ if (!previousWaitForBotSays) {
3109
+ skipTranscriptStep = true;
3110
+ }
3111
+ waitForBotSays = false;
3112
+ if (!nextConvoStep || nextConvoStep.sender !== 'bot' || !nextConvoStep.logicHooks || !nextConvoStep.logicHooks.some(lh => lh.name.toUpperCase().startsWith('CONDITIONAL_STEP'))) {
3113
+ waitForBotSays = true;
3114
+ } else {
3115
+ const conditionalLogicHook = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3116
+ const nextConditionalLogicHook = nextConvoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3117
+ waitForBotSays = conditionalLogicHook.args[1] !== nextConditionalLogicHook.args[1];
3118
+ }
3119
+ if (convoStep.conditional.skip) {
3120
+ continue;
3097
3121
  }
3098
- continue;
3099
3122
  }
3100
3123
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3101
3124
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);