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
@@ -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.18";
84
+ var version$1 = "1.13.19";
85
85
  var description = "The Selenium for Chatbots";
86
86
  var main = "index.js";
87
87
  var module$1 = "dist/botium-es.js";
@@ -132,6 +132,7 @@ var dependencies = {
132
132
  "mime-types": "^2.1.35",
133
133
  mkdirp: "^3.0.1",
134
134
  moment: "^2.29.4",
135
+ "moment-timezone": "^0.5.43",
135
136
  mustache: "^4.2.0",
136
137
  "promise-retry": "^2.0.1",
137
138
  "promise.allsettled": "^1.0.6",
@@ -1204,6 +1205,18 @@ var LogicHookConsts = {
1204
1205
  }, {
1205
1206
  name: LOGIC_HOOK_INCLUDE$1,
1206
1207
  className: 'IncludeLogicHook'
1208
+ }, {
1209
+ name: 'CONDITIONAL_STEP_TIME_BASED',
1210
+ className: 'ConditionalTimeBasedLogicHook'
1211
+ }, {
1212
+ name: 'CONDITIONAL_STEP_BUSINESS_HOURS',
1213
+ className: 'ConditionalBusinessHoursLogicHook'
1214
+ }, {
1215
+ name: 'CONDITIONAL_STEP_CAPABILITY_VALUE_BASED',
1216
+ className: 'ConditionalCapabilityValueBasedLogicHook'
1217
+ }, {
1218
+ name: 'CONDITIONAL_STEP_JSON_PATH_BASED',
1219
+ className: 'ConditionalJsonPathBasedLogicHook.js'
1207
1220
  }],
1208
1221
  DEFAULT_USER_INPUTS: [{
1209
1222
  name: 'BUTTON',
@@ -3078,6 +3091,7 @@ class Convo$6 {
3078
3091
  throw failErr;
3079
3092
  }
3080
3093
  } else if (convoStep.sender === 'bot') {
3094
+ const previousWaitForBotSays = waitForBotSays;
3081
3095
  if (waitForBotSays) {
3082
3096
  botMsg = null;
3083
3097
  } else {
@@ -3133,13 +3147,22 @@ class Convo$6 {
3133
3147
  } catch (failErr) {}
3134
3148
  throw failErr;
3135
3149
  }
3136
- if (convoStep.skip === true) {
3137
- skipTranscriptStep = true;
3150
+ if (convoStep.conditional) {
3138
3151
  const nextConvoStep = this.conversation[i + 1];
3139
- if (nextConvoStep && nextConvoStep.sender === 'bot') {
3140
- waitForBotSays = false;
3152
+ if (!previousWaitForBotSays) {
3153
+ skipTranscriptStep = true;
3154
+ }
3155
+ waitForBotSays = false;
3156
+ if (!nextConvoStep || nextConvoStep.sender !== 'bot' || !nextConvoStep.logicHooks || !nextConvoStep.logicHooks.some(lh => lh.name.toUpperCase().startsWith('CONDITIONAL_STEP'))) {
3157
+ waitForBotSays = true;
3158
+ } else {
3159
+ const conditionalLogicHook = convoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3160
+ const nextConditionalLogicHook = nextConvoStep.logicHooks.find(lh => lh.name.startsWith('CONDITIONAL_STEP'));
3161
+ waitForBotSays = conditionalLogicHook.args[1] !== nextConditionalLogicHook.args[1];
3162
+ }
3163
+ if (convoStep.conditional.skip) {
3164
+ continue;
3141
3165
  }
3142
- continue;
3143
3166
  }
3144
3167
  if (!botMsg || !botMsg.messageText && !botMsg.media && !botMsg.buttons && !botMsg.cards && !botMsg.sourceData && !botMsg.nlp) {
3145
3168
  const failErr = new BotiumError$4(`${this.header.name}/${convoStep.stepTag}: bot says nothing`);