botium-core 1.15.12 → 1.15.13

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "botium-core",
3
- "version": "1.15.12",
3
+ "version": "1.15.13",
4
4
  "description": "The Selenium for Chatbots",
5
5
  "main": "index.js",
6
6
  "module": "dist/botium-es.js",
@@ -5,18 +5,21 @@ class BotiumMockAsserter {
5
5
  this.name = fromJson.name
6
6
  this.args = _.cloneDeep(fromJson.args)
7
7
  this.not = fromJson.not
8
+ this.resolvedArgs = fromJson.resolvedArgs || null
8
9
  }
9
10
  }
10
11
  class BotiumMockUserInput {
11
12
  constructor (fromJson = {}) {
12
13
  this.name = fromJson.name
13
14
  this.args = _.cloneDeep(fromJson.args)
15
+ this.resolvedArgs = fromJson.resolvedArgs || null
14
16
  }
15
17
  }
16
18
  class BotiumMockLogicHook {
17
19
  constructor (fromJson = {}) {
18
20
  this.name = fromJson.name
19
21
  this.args = _.cloneDeep(fromJson.args)
22
+ this.resolvedArgs = fromJson.resolvedArgs || null
20
23
  }
21
24
  }
22
25
 
@@ -703,6 +703,16 @@ class Convo {
703
703
  } finally {
704
704
  if (convoStep.sender !== 'begin' && convoStep.sender !== 'end' && !skipTranscriptStep) {
705
705
  transcriptStep.scriptingMemory = Object.assign({}, scriptingMemory)
706
+ if (container.caps[Capabilities.SCRIPTING_ENABLE_MEMORY] && transcriptStep.expected) {
707
+ const _resolveItemArgs = (items) => {
708
+ (items || []).forEach(item => {
709
+ item.resolvedArgs = ScriptingMemory.applyToArgs(item.args, scriptingMemory, container.caps)
710
+ })
711
+ }
712
+ _resolveItemArgs(transcriptStep.expected.asserters)
713
+ _resolveItemArgs(transcriptStep.expected.logicHooks)
714
+ _resolveItemArgs(transcriptStep.expected.userInputs)
715
+ }
706
716
  transcriptStep.stepEnd = new Date()
707
717
  transcriptSteps.push(transcriptStep)
708
718
  }
@@ -0,0 +1,11 @@
1
+ scripting_memory_resolved_args
2
+
3
+ #begin
4
+ SET_SCRIPTING_MEMORY myword|hello
5
+
6
+ #me
7
+ say hello world
8
+
9
+ #bot
10
+ say hello world
11
+ TEXT_CONTAINS_ANY $myword
@@ -160,6 +160,20 @@ describe('scripting.logichooks.global.setClearScriptingMemory', function () {
160
160
  assert.isTrue(err.message.indexOf('no result from JSON-Path query') >= 0)
161
161
  }
162
162
  })
163
+
164
+ it('should populate resolvedArgs on transcript asserters', async function () {
165
+ this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'scripting_memory_resolved_args.convo.txt')
166
+ assert.equal(this.compiler.convos.length, 1)
167
+
168
+ const transcript = await this.compiler.convos[0].Run(this.container)
169
+ assert.equal(transcript.steps.length, 2)
170
+
171
+ const botStep = transcript.steps[1]
172
+ assert.isArray(botStep.expected.asserters)
173
+ assert.equal(botStep.expected.asserters.length, 1)
174
+ assert.deepEqual(botStep.expected.asserters[0].args, ['$myword'])
175
+ assert.deepEqual(botStep.expected.asserters[0].resolvedArgs, ['hello'])
176
+ })
163
177
  })
164
178
 
165
179
  describe('global', function () {