botium-core 1.15.10 → 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/dist/botium-cjs.js +91 -51
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +91 -50
- package/dist/botium-es.js.map +1 -1
- package/package.json +35 -40
- package/src/BotDriver.js +1 -1
- package/src/Events.js +1 -3
- package/src/containers/GridContainer.js +0 -4
- package/src/mocks/BotiumMockScripting.js +3 -0
- package/src/scripting/Convo.js +10 -0
- package/src/utils/boolean.js +39 -0
- package/test/compiler/compilercsv.spec.js +34 -0
- package/test/compiler/compilermarkdown.spec.js +11 -0
- package/test/compiler/compilertxt.spec.js +21 -0
- package/test/compiler/compilerxlsx.spec.js +27 -0
- package/test/compiler/precompilerjson.spec.js +1 -0
- package/test/compiler/precompilermarkdownrasa.spec.js +1 -0
- package/test/connectors/pluginconnectorcontainer.spec.js +1 -0
- package/test/connectors/simplerest.spec.js +3 -1
- package/test/convo/failure.spec.js +1 -0
- package/test/convo/fillAndApplyScriptingMemory.spec.js +56 -0
- package/test/convo/partialconvo.spec.js +3 -0
- package/test/convo/retry.spec.js +9 -0
- package/test/convo/retryasserter.spec.js +9 -0
- package/test/convo/transcript.spec.js +33 -0
- package/test/convo/tree.spec.js +5 -0
- package/test/driver/capabilities.spec.js +16 -0
- package/test/helpers/capabilitiesutils.spec.js +8 -0
- package/test/helpers/transcriptutils.spec.js +1 -0
- package/test/hooks/customhooks.spec.js +3 -0
- package/test/logichooks/hookfromsrc.spec.js +3 -0
- package/test/logichooks/textfromhook.spec.js +1 -0
- package/test/plugins/plugins.spec.js +3 -0
- package/test/scripting/asserters/buttonsAsserter.spec.js +15 -0
- package/test/scripting/asserters/cardsAsserter.spec.js +12 -0
- package/test/scripting/asserters/convoStepParameters.spec.js +11 -0
- package/test/scripting/asserters/entitiesAsserter.spec.js +1 -0
- package/test/scripting/asserters/entityValuesAsserter.spec.js +7 -0
- package/test/scripting/asserters/formsAsserter.spec.js +10 -0
- package/test/scripting/asserters/intentAsserter.spec.js +4 -0
- package/test/scripting/asserters/intentUniqueAsserter.spec.js +2 -0
- package/test/scripting/asserters/jsonpathAsserter.spec.js +25 -0
- package/test/scripting/asserters/mediaAsserter.spec.js +20 -0
- package/test/scripting/asserters/responseLengthAsserter.spec.js +4 -0
- package/test/scripting/asserters/textAsserter.spec.js +1 -0
- package/test/scripting/asserters/textContainsAllAsserter.spec.js +1 -0
- package/test/scripting/asserters/textContainsAnyAsserter.spec.js +1 -0
- package/test/scripting/asserters/textEqualsAsserter.spec.js +1 -0
- package/test/scripting/asserters/textRegexpAllAsserter.spec.js +1 -0
- package/test/scripting/asserters/textRegexpAnyAsserter.spec.js +1 -0
- package/test/scripting/asserters/textWildcardAllAsserter.spec.js +1 -0
- package/test/scripting/asserters/textWildcardAnyAsserter.spec.js +1 -0
- package/test/scripting/asserters/textWildcardExactAllAsserter.spec.js +1 -0
- package/test/scripting/asserters/textWildcardExactAnyAsserter.spec.js +1 -0
- package/test/scripting/asserters/werAsserter.spec.js +6 -0
- package/test/scripting/logichooks/convos/scripting_memory_resolved_args.convo.txt +11 -0
- package/test/scripting/logichooks/customConditionalStepLogicHook.spec.js +2 -0
- package/test/scripting/logichooks/localvsglobal.spec.js +1 -0
- package/test/scripting/logichooks/pauseLogic.spec.js +4 -0
- package/test/scripting/logichooks/setClearScriptingMemory.spec.js +17 -0
- package/test/scripting/logichooks/updateCustom.spec.js +2 -0
- package/test/scripting/matching/matchingmode.spec.js +48 -0
- package/test/scripting/scriptingModificator.spec.js +1 -0
- package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +4 -0
- package/test/scripting/scriptingmemory/regexp.spec.js +1 -0
- package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +3 -0
- package/test/scripting/txt/decompile.spec.js +20 -0
- package/test/scripting/userinputs/buttonInputConvos.spec.js +1 -0
- package/test/scripting/userinputs/defaultUserInputs.spec.js +13 -0
- package/test/scripting/userinputs/mediaInputConvos.spec.js +10 -0
- package/test/scripting/utteranceexpansion/associateByIndex.spec.js +2 -0
- package/test/security/allowUnsafe.spec.js +5 -0
- package/test/utils.spec.js +2 -0
- package/samples/postman/Botium Agent Sample.postman_collection.json +0 -834
- package/samples/postman/README.md +0 -5
- package/samples/postman/botiumFluent.js +0 -37
- package/src/grid/agent/AgentWorker.js +0 -204
- package/src/grid/agent/agent.js +0 -96
- package/src/grid/agent/agentworkerpool.js +0 -58
- package/src/grid/agent/routes.js +0 -353
- package/src/grid/agent/swagger.json +0 -327
- package/src/grid/agent/swaggerDef.json +0 -8
- package/src/grid/agent/views/index.html +0 -39
- package/test/grid/agent/client.js +0 -65
|
@@ -69,6 +69,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
69
69
|
this.compiler = driver.BuildCompiler()
|
|
70
70
|
this.container = await driver.Build()
|
|
71
71
|
})
|
|
72
|
+
|
|
72
73
|
afterEach(async function () {
|
|
73
74
|
this.container && await this.container.Clean()
|
|
74
75
|
})
|
|
@@ -82,6 +83,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
82
83
|
assert.isDefined(transcript.scriptingMemory.$myvar)
|
|
83
84
|
assert.equal(transcript.scriptingMemory.$myvar, 'VARVALUE')
|
|
84
85
|
})
|
|
86
|
+
|
|
85
87
|
it('should fill scripting memory from utterances file', async function () {
|
|
86
88
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'utt_memory.convo.txt')
|
|
87
89
|
assert.equal(this.compiler.convos.length, 1)
|
|
@@ -93,6 +95,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
93
95
|
assert.equal(transcript.scriptingMemory.$years, '40')
|
|
94
96
|
assert.equal(transcript.scriptingMemory.$months, '2')
|
|
95
97
|
})
|
|
98
|
+
|
|
96
99
|
it('should fail on invalid scripting memory', async function () {
|
|
97
100
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'memory_fail.convo.txt')
|
|
98
101
|
assert.equal(this.compiler.convos.length, 1)
|
|
@@ -104,6 +107,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
104
107
|
assert.isTrue(err.message.indexOf('Bot response (on Line 9: #me - show var $myvar) "show var VARVALUE" expected to match "show var VARVALUEINVALID"') > 0)
|
|
105
108
|
}
|
|
106
109
|
})
|
|
110
|
+
|
|
107
111
|
it('should normalize bot response', async function () {
|
|
108
112
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'memory_normalize.convo.txt')
|
|
109
113
|
assert.equal(this.compiler.convos.length, 1)
|
|
@@ -113,6 +117,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
113
117
|
assert.isDefined(transcript.scriptingMemory.$state)
|
|
114
118
|
assert.equal(transcript.scriptingMemory.$state, 'Kentucky')
|
|
115
119
|
})
|
|
120
|
+
|
|
116
121
|
it('should normalize bot response 2', async function () {
|
|
117
122
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'memory_dont_override_functions.convo.txt')
|
|
118
123
|
assert.equal(this.compiler.convos.length, 1)
|
|
@@ -121,6 +126,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
121
126
|
assert.isObject(transcript.scriptingMemory)
|
|
122
127
|
assert.isUndefined(transcript.scriptingMemory.$year)
|
|
123
128
|
})
|
|
129
|
+
|
|
124
130
|
it('should append multiline messages from scripting memory', async function () {
|
|
125
131
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'multiline.convo.txt')
|
|
126
132
|
assert.equal(this.compiler.convos.length, 1)
|
|
@@ -163,6 +169,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
163
169
|
const transcript = await compiler.convos[0].Run(container)
|
|
164
170
|
assert.isObject(transcript.scriptingMemory)
|
|
165
171
|
})
|
|
172
|
+
|
|
166
173
|
it('should apply scripting memory in begin args', async function () {
|
|
167
174
|
const myCaps = {
|
|
168
175
|
[Capabilities.PROJECTNAME]: 'convo.scriptingmemory',
|
|
@@ -223,11 +230,13 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
223
230
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence 1', 'test sentence $num', this.convo.scriptingEvents)
|
|
224
231
|
assert.equal(scriptingMemory.$num, '1')
|
|
225
232
|
})
|
|
233
|
+
|
|
226
234
|
it('should not fill scripting memory from invalid text', async function () {
|
|
227
235
|
const scriptingMemory = {}
|
|
228
236
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence', 'test sentence $num', this.convo.scriptingEvents)
|
|
229
237
|
assert.isUndefined(scriptingMemory.$num)
|
|
230
238
|
})
|
|
239
|
+
|
|
231
240
|
it('should fill scripting memory from one utterance', async function () {
|
|
232
241
|
this.scriptingProvider.AddUtterances({
|
|
233
242
|
name: 'utt1',
|
|
@@ -238,6 +247,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
238
247
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence 1', 'utt1', this.convo.scriptingEvents)
|
|
239
248
|
assert.equal(scriptingMemory.$num, '1')
|
|
240
249
|
})
|
|
250
|
+
|
|
241
251
|
it('should fill multiple scripting memory from one utterance', async function () {
|
|
242
252
|
this.scriptingProvider.AddUtterances({
|
|
243
253
|
name: 'utt1',
|
|
@@ -249,6 +259,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
249
259
|
assert.equal(scriptingMemory.$num1, '1')
|
|
250
260
|
assert.equal(scriptingMemory.$num2, '2')
|
|
251
261
|
})
|
|
262
|
+
|
|
252
263
|
it('should fill scripting memory from two different utterances', async function () {
|
|
253
264
|
this.scriptingProvider.AddUtterances({
|
|
254
265
|
name: 'utt1',
|
|
@@ -260,6 +271,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
260
271
|
assert.equal(scriptingMemory.$months, '2')
|
|
261
272
|
assert.isUndefined(scriptingMemory.$years)
|
|
262
273
|
})
|
|
274
|
+
|
|
263
275
|
it('should replace utterances from scripting memory', async function () {
|
|
264
276
|
// $Years instead of $years to avoid collision with $year embedded variable
|
|
265
277
|
this.scriptingProvider.AddUtterances({
|
|
@@ -274,6 +286,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
274
286
|
assert.equal(tomatch[0], 'i am 2 months old')
|
|
275
287
|
assert.equal(tomatch[1], 'i am $Years years old')
|
|
276
288
|
})
|
|
289
|
+
|
|
277
290
|
it('should accept special regexp characters in utterance when replace utterances from scripting memory in regexp matching mode', async function () {
|
|
278
291
|
this.containerStub.caps[Capabilities.SCRIPTING_MATCHING_MODE] = 'regexp'
|
|
279
292
|
|
|
@@ -284,6 +297,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
284
297
|
assert.isArray(tomatch)
|
|
285
298
|
assert.equal(tomatch[0], '.* sentence 1')
|
|
286
299
|
})
|
|
300
|
+
|
|
287
301
|
it('should accept special regexp characters in utterances when replace utterances from scripting memory in regexp matching mode', async function () {
|
|
288
302
|
this.containerStub.caps[Capabilities.SCRIPTING_MATCHING_MODE] = 'regexp'
|
|
289
303
|
this.scriptingProvider.AddUtterances({
|
|
@@ -298,6 +312,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
298
312
|
assert.isArray(tomatch)
|
|
299
313
|
assert.equal(tomatch[0], '.* sentence 1')
|
|
300
314
|
})
|
|
315
|
+
|
|
301
316
|
it('should accept special regexp characters in utterance when filling scripting memory', async function () {
|
|
302
317
|
const scriptingMemory = {}
|
|
303
318
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, '*test sentence 1*', '*test sentence $num*', this.convo.scriptingEvents)
|
|
@@ -307,6 +322,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
307
322
|
ScriptingMemory.fill(this.containerStub, scriptingMemory1, 'Hier sind deine Erinnerungen: Notiz: 104 | This is a test reminder', 'Hier sind deine Erinnerungen: Notiz: $id | This is a test reminder', this.convo.scriptingEvents)
|
|
308
323
|
assert.equal(scriptingMemory1.$id, '104')
|
|
309
324
|
})
|
|
325
|
+
|
|
310
326
|
it('should accept special regexp characters in utterances when filling scripting memory', async function () {
|
|
311
327
|
this.scriptingProvider.AddUtterances({
|
|
312
328
|
name: 'utt1',
|
|
@@ -316,28 +332,33 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
316
332
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, '[\'I am 2 years old.\']', 'utt1', this.convo.scriptingEvents)
|
|
317
333
|
assert.equal(scriptingMemory.$years, '2')
|
|
318
334
|
})
|
|
335
|
+
|
|
319
336
|
it('should accept newline characters in utterances when filling scripting memory', async function () {
|
|
320
337
|
const scriptingMemory = {}
|
|
321
338
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence header\n\ntest sentence 1', 'test sentence header\n\ntest sentence $num', this.convo.scriptingEvents)
|
|
322
339
|
assert.equal(scriptingMemory.$num, '1')
|
|
323
340
|
})
|
|
341
|
+
|
|
324
342
|
it('should accept variable name case sensitive', async function () {
|
|
325
343
|
const scriptingMemory = {}
|
|
326
344
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence 1', 'test sentence $Num', this.convo.scriptingEvents)
|
|
327
345
|
assert.equal(scriptingMemory.$num, undefined)
|
|
328
346
|
assert.equal(scriptingMemory.$Num, '1')
|
|
329
347
|
})
|
|
348
|
+
|
|
330
349
|
it('should accept variable name as postfix', async function () {
|
|
331
350
|
const scriptingMemory = {}
|
|
332
351
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence a1', 'test sentence a$Num', this.convo.scriptingEvents)
|
|
333
352
|
assert.equal(scriptingMemory.$num, undefined)
|
|
334
353
|
assert.equal(scriptingMemory.$Num, '1')
|
|
335
354
|
})
|
|
355
|
+
|
|
336
356
|
it('should not change scripting memory functions', async function () {
|
|
337
357
|
const scriptingMemory = {}
|
|
338
358
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'test sentence a1', 'test sentence a$now', this.convo.scriptingEvents)
|
|
339
359
|
assert.notEqual(scriptingMemory.$now, '1')
|
|
340
360
|
})
|
|
361
|
+
|
|
341
362
|
it('should match normalized response', async function () {
|
|
342
363
|
let result = '<speak>Kentucky is the 15th state, admitted to the Union in 1792. The capital of Kentucky is Frankfort, and the abbreviation for Kentucky is <break strength=\'strong\'/><say-as interpret-as=\'spell-out\'>KY</say-as>. I\'ve added Kentucky to your Alexa app. Which other state or capital would you like to know about?</speak>'
|
|
343
364
|
const expected = '$state is the 15th state, admitted to the Union in 1792. The capital of Kentucky is Frankfort, and the abbreviation for Kentucky is KY. I\'ve added Kentucky to your Alexa app. Which other state or capital would you like to know about?'
|
|
@@ -348,21 +369,25 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
348
369
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, result, expected, this.convo.scriptingEvents)
|
|
349
370
|
assert.equal(scriptingMemory.$state, 'Kentucky')
|
|
350
371
|
})
|
|
372
|
+
|
|
351
373
|
it('should match not-whitespace (SCRIPTING_MEMORY_MATCHING_MODE == non_whitespace, default)', async function () {
|
|
352
374
|
const scriptingMemory = {}
|
|
353
375
|
ScriptingMemory.fill(this.containerStub, scriptingMemory, 'date: 28.01.2019', 'date: $somedate', this.convo.scriptingEvents)
|
|
354
376
|
assert.equal(scriptingMemory.$somedate, '28.01.2019')
|
|
355
377
|
})
|
|
378
|
+
|
|
356
379
|
it('should match not-whitespace (SCRIPTING_MEMORY_MATCHING_MODE == word)', async function () {
|
|
357
380
|
const scriptingMemory = {}
|
|
358
381
|
ScriptingMemory.fill(this.containerStubMatchingModeWord, scriptingMemory, 'my name is joe.', 'my name is $name', this.convo.scriptingEvents)
|
|
359
382
|
assert.equal(scriptingMemory.$name, 'joe')
|
|
360
383
|
})
|
|
384
|
+
|
|
361
385
|
it('should match multi lines (SCRIPTING_MEMORY_MATCHING_MODE == joker)', async function () {
|
|
362
386
|
const scriptingMemory = {}
|
|
363
387
|
ScriptingMemory.fill(this.containerStubMatchingModeJoker, scriptingMemory, 'test sentence \nline1\r\nline2', 'test sentence $lines', this.convo.scriptingEvents)
|
|
364
388
|
assert.equal(scriptingMemory.$lines, '\nline1\r\nline2')
|
|
365
389
|
})
|
|
390
|
+
|
|
366
391
|
it('should match multi words (SCRIPTING_MEMORY_MATCHING_MODE == joker)', async function () {
|
|
367
392
|
const scriptingMemory = {}
|
|
368
393
|
ScriptingMemory.fill(this.containerStubMatchingModeJoker, scriptingMemory, 'test sentence match1 match2', 'test sentence $words', this.convo.scriptingEvents)
|
|
@@ -473,6 +498,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
473
498
|
}
|
|
474
499
|
assert.equal(ScriptingMemory.applyToArgs(asserter.args, scriptingMemory, CAPS_BASE)[1], 5)
|
|
475
500
|
})
|
|
501
|
+
|
|
476
502
|
it('typo of reference', async function () {
|
|
477
503
|
const asserter = {
|
|
478
504
|
name: 'DUMMY',
|
|
@@ -487,6 +513,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
487
513
|
}
|
|
488
514
|
assert.notEqual(ScriptingMemory.applyToArgs(asserter.args, scriptingMemory, CAPS_BASE)[1], 5)
|
|
489
515
|
})
|
|
516
|
+
|
|
490
517
|
it('as postfix', async function () {
|
|
491
518
|
const asserter = {
|
|
492
519
|
name: 'DUMMY',
|
|
@@ -501,6 +528,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
501
528
|
}
|
|
502
529
|
assert.equal(ScriptingMemory.applyToArgs(asserter.args, scriptingMemory, CAPS_BASE)[1], 'prefix5')
|
|
503
530
|
})
|
|
531
|
+
|
|
504
532
|
it('as prefix', async function () {
|
|
505
533
|
const asserter = {
|
|
506
534
|
name: 'DUMMY',
|
|
@@ -515,6 +543,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
515
543
|
}
|
|
516
544
|
assert.equal(ScriptingMemory.applyToArgs(asserter.args, scriptingMemory, CAPS_BASE)[1], '5er')
|
|
517
545
|
})
|
|
546
|
+
|
|
518
547
|
it('different value', async function () {
|
|
519
548
|
const asserter = {
|
|
520
549
|
name: 'DUMMY',
|
|
@@ -580,6 +609,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
580
609
|
)
|
|
581
610
|
assert.equal(result, new Date().toLocaleString())
|
|
582
611
|
})
|
|
612
|
+
|
|
583
613
|
it('now_EN', async function () {
|
|
584
614
|
const result = ScriptingMemory.apply(
|
|
585
615
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -590,6 +620,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
590
620
|
assert(result.lastIndexOf(':') > 10, 'wrong format')
|
|
591
621
|
assert(result.lastIndexOf(':') > 10, 'wrong format')
|
|
592
622
|
})
|
|
623
|
+
|
|
593
624
|
it('now_DE', async function () {
|
|
594
625
|
const result = ScriptingMemory.apply(
|
|
595
626
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -599,6 +630,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
599
630
|
assert(result.indexOf('.') === 2)
|
|
600
631
|
assert(result.lastIndexOf(':') > 10)
|
|
601
632
|
})
|
|
633
|
+
|
|
602
634
|
it('now_ISO', async function () {
|
|
603
635
|
const result = ScriptingMemory.apply(
|
|
604
636
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -618,6 +650,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
618
650
|
)
|
|
619
651
|
assert.equal(result, new Date().toLocaleDateString())
|
|
620
652
|
})
|
|
653
|
+
|
|
621
654
|
it('date with param', async function () {
|
|
622
655
|
const result = ScriptingMemory.apply(
|
|
623
656
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -626,6 +659,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
626
659
|
)
|
|
627
660
|
assert.equal(result.length, 4)
|
|
628
661
|
})
|
|
662
|
+
|
|
629
663
|
it('date_EN', async function () {
|
|
630
664
|
const result = ScriptingMemory.apply(
|
|
631
665
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -636,6 +670,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
636
670
|
assert(result.indexOf('/') <= 2, 'wrong format')
|
|
637
671
|
assert(result.lastIndexOf('/') <= 5, 'wrong format')
|
|
638
672
|
})
|
|
673
|
+
|
|
639
674
|
it('date_DE', async function () {
|
|
640
675
|
const result = ScriptingMemory.apply(
|
|
641
676
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -646,6 +681,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
646
681
|
assert(result.indexOf('.') === 4, 'wrong format')
|
|
647
682
|
assert(result.lastIndexOf('.') === 7, 'wrong format')
|
|
648
683
|
})
|
|
684
|
+
|
|
649
685
|
it('date_ISO', async function () {
|
|
650
686
|
const result = ScriptingMemory.apply(
|
|
651
687
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -665,6 +701,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
665
701
|
)
|
|
666
702
|
assert(result.indexOf(':') < 3)
|
|
667
703
|
})
|
|
704
|
+
|
|
668
705
|
it('time_EN', async function () {
|
|
669
706
|
const result = ScriptingMemory.apply(
|
|
670
707
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -674,6 +711,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
674
711
|
assert(result.indexOf(':') < 3)
|
|
675
712
|
assert(result.lastIndexOf(' ') < 9)
|
|
676
713
|
})
|
|
714
|
+
|
|
677
715
|
it('time_DE', async function () {
|
|
678
716
|
const result = ScriptingMemory.apply(
|
|
679
717
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -682,6 +720,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
682
720
|
)
|
|
683
721
|
assert(result.indexOf(':') !== result.lastIndexOf(':'))
|
|
684
722
|
})
|
|
723
|
+
|
|
685
724
|
it('time_ISO', async function () {
|
|
686
725
|
const result = ScriptingMemory.apply(
|
|
687
726
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -690,6 +729,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
690
729
|
)
|
|
691
730
|
assert(result.indexOf(':') !== result.lastIndexOf(':'))
|
|
692
731
|
})
|
|
732
|
+
|
|
693
733
|
it('time_HH_MM', async function () {
|
|
694
734
|
const result = ScriptingMemory.apply(
|
|
695
735
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -698,6 +738,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
698
738
|
)
|
|
699
739
|
assert(result.indexOf(':') === 2)
|
|
700
740
|
})
|
|
741
|
+
|
|
701
742
|
it('time_H_A', async function () {
|
|
702
743
|
const result = ScriptingMemory.apply(
|
|
703
744
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -724,6 +765,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
724
765
|
)
|
|
725
766
|
assert.equal(result, moment().add(1, 'day').toDate().toLocaleDateString())
|
|
726
767
|
})
|
|
768
|
+
|
|
727
769
|
it('tomorrow with format', async function () {
|
|
728
770
|
const result = ScriptingMemory.apply(
|
|
729
771
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -732,6 +774,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
732
774
|
)
|
|
733
775
|
assert.equal(result, moment().add(1, 'day').format('YYYY.MM.DD'))
|
|
734
776
|
})
|
|
777
|
+
|
|
735
778
|
it('yesterday without format', async function () {
|
|
736
779
|
const result = ScriptingMemory.apply(
|
|
737
780
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -740,6 +783,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
740
783
|
)
|
|
741
784
|
assert.equal(result, moment().subtract(1, 'day').toDate().toLocaleDateString())
|
|
742
785
|
})
|
|
786
|
+
|
|
743
787
|
it('yesterday with format', async function () {
|
|
744
788
|
const result = ScriptingMemory.apply(
|
|
745
789
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -768,6 +812,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
768
812
|
)
|
|
769
813
|
assert.equal(result, moment().format('MMMM'), '$month invalid')
|
|
770
814
|
})
|
|
815
|
+
|
|
771
816
|
it('month_MM', async function () {
|
|
772
817
|
const result = ScriptingMemory.apply(
|
|
773
818
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -808,6 +853,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
808
853
|
|
|
809
854
|
assert.equal(result, moment().add(1, 'day').format('YYYY.MM.DD'))
|
|
810
855
|
})
|
|
856
|
+
|
|
811
857
|
it('date_subtract', async function () {
|
|
812
858
|
const result = ScriptingMemory.apply(
|
|
813
859
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -817,6 +863,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
817
863
|
|
|
818
864
|
assert.equal(result, moment().subtract(1, 'month').format('YYYY.MM.DD'))
|
|
819
865
|
})
|
|
866
|
+
|
|
820
867
|
it('date_add_dynamic', async function () {
|
|
821
868
|
const result = ScriptingMemory.apply(
|
|
822
869
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -838,6 +885,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
838
885
|
|
|
839
886
|
assert(result.length === 19, '$random invalid')
|
|
840
887
|
})
|
|
888
|
+
|
|
841
889
|
it('random10', async function () {
|
|
842
890
|
const result = ScriptingMemory.apply(
|
|
843
891
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -867,6 +915,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
867
915
|
)
|
|
868
916
|
assert.equal(result, 'botium')
|
|
869
917
|
})
|
|
918
|
+
|
|
870
919
|
it('environment variable reject', async function () {
|
|
871
920
|
process.env.MY_VAR_VALUE = 'botium'
|
|
872
921
|
try {
|
|
@@ -880,6 +929,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
880
929
|
assert.isTrue(err.message.indexOf('Using unsafe scripting memory function $env is not allowed') >= 0)
|
|
881
930
|
}
|
|
882
931
|
})
|
|
932
|
+
|
|
883
933
|
it('cap', async function () {
|
|
884
934
|
const result = ScriptingMemory.apply(
|
|
885
935
|
{ caps: Object.assign({}, CAPS_ENABLE_SCRIPTING_MEMORY, { mycap: 'botium' }) },
|
|
@@ -888,6 +938,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
888
938
|
)
|
|
889
939
|
assert.equal(result, 'botium')
|
|
890
940
|
})
|
|
941
|
+
|
|
891
942
|
it('msg with messageText', async function () {
|
|
892
943
|
const result = ScriptingMemory.apply(
|
|
893
944
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -897,6 +948,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
897
948
|
)
|
|
898
949
|
assert.equal(result, 'botium')
|
|
899
950
|
})
|
|
951
|
+
|
|
900
952
|
it('msg with messageText twice', async function () {
|
|
901
953
|
const result = ScriptingMemory.apply(
|
|
902
954
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -906,6 +958,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
906
958
|
)
|
|
907
959
|
assert.equal(result, 'botium botium')
|
|
908
960
|
})
|
|
961
|
+
|
|
909
962
|
it('msg with sourceData', async function () {
|
|
910
963
|
const result = ScriptingMemory.apply(
|
|
911
964
|
{ caps: CAPS_ENABLE_SCRIPTING_MEMORY },
|
|
@@ -918,6 +971,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
918
971
|
)
|
|
919
972
|
assert.equal(result, 'botium')
|
|
920
973
|
})
|
|
974
|
+
|
|
921
975
|
it('projectname', async function () {
|
|
922
976
|
const result = ScriptingMemory.apply(
|
|
923
977
|
{ caps: Object.assign({}, CAPS_ENABLE_SCRIPTING_MEMORY, { PROJECTNAME: 'botium' }) },
|
|
@@ -926,6 +980,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
926
980
|
)
|
|
927
981
|
assert.equal(result, 'botium')
|
|
928
982
|
})
|
|
983
|
+
|
|
929
984
|
it('testsessionname', async function () {
|
|
930
985
|
const result = ScriptingMemory.apply(
|
|
931
986
|
{ caps: Object.assign({}, CAPS_ENABLE_SCRIPTING_MEMORY, { TESTSESSIONNAME: 'botium' }) },
|
|
@@ -934,6 +989,7 @@ describe('convo.fillAndApplyScriptingMemory', function () {
|
|
|
934
989
|
)
|
|
935
990
|
assert.equal(result, 'botium')
|
|
936
991
|
})
|
|
992
|
+
|
|
937
993
|
it('testcasename', async function () {
|
|
938
994
|
const result = ScriptingMemory.apply(
|
|
939
995
|
{ caps: Object.assign({}, CAPS_ENABLE_SCRIPTING_MEMORY, { TESTCASENAME: 'botium' }) },
|
|
@@ -66,6 +66,7 @@ describe('convo.partialconvo', function () {
|
|
|
66
66
|
assert.equal(transcript.steps[7].actual.sender, 'bot')
|
|
67
67
|
assert.equal(transcript.steps[7].actual.messageText, 'You are logged out!')
|
|
68
68
|
})
|
|
69
|
+
|
|
69
70
|
it('Depth1 xls, everything ok', async function () {
|
|
70
71
|
await _initIt([
|
|
71
72
|
'Password please!',
|
|
@@ -96,6 +97,7 @@ describe('convo.partialconvo', function () {
|
|
|
96
97
|
assert.equal(transcript.steps[7].actual.sender, 'bot')
|
|
97
98
|
assert.equal(transcript.steps[7].actual.messageText, 'You are logged out!')
|
|
98
99
|
})
|
|
100
|
+
|
|
99
101
|
it('Depth1 csv, everything ok', async function () {
|
|
100
102
|
await _initIt([
|
|
101
103
|
'Password please!',
|
|
@@ -126,6 +128,7 @@ describe('convo.partialconvo', function () {
|
|
|
126
128
|
assert.equal(transcript.steps[7].actual.sender, 'bot')
|
|
127
129
|
assert.equal(transcript.steps[7].actual.messageText, 'You are logged out!')
|
|
128
130
|
})
|
|
131
|
+
|
|
129
132
|
it('Wrong botsays in main convo', async function () {
|
|
130
133
|
await _initIt([
|
|
131
134
|
'Password please!',
|
package/test/convo/retry.spec.js
CHANGED
|
@@ -36,6 +36,7 @@ describe('convo.retries', function () {
|
|
|
36
36
|
await this.container.Start()
|
|
37
37
|
}
|
|
38
38
|
})
|
|
39
|
+
|
|
39
40
|
afterEach(async function () {
|
|
40
41
|
await this.container.Stop()
|
|
41
42
|
await this.container.Clean()
|
|
@@ -53,12 +54,14 @@ describe('convo.retries', function () {
|
|
|
53
54
|
}
|
|
54
55
|
assert.fail('should have failed without retry')
|
|
55
56
|
})
|
|
57
|
+
|
|
56
58
|
it('should succeed after one retry with default settings', async function () {
|
|
57
59
|
await this.init(1, 'myerror', 'myerror')
|
|
58
60
|
|
|
59
61
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), '1step.convo.txt')
|
|
60
62
|
await this.compiler.convos[0].Run(this.container)
|
|
61
63
|
})
|
|
64
|
+
|
|
62
65
|
it('should fail after one retry with default settings', async function () {
|
|
63
66
|
await this.init(2, 'myerror', 'myerror')
|
|
64
67
|
|
|
@@ -71,12 +74,14 @@ describe('convo.retries', function () {
|
|
|
71
74
|
}
|
|
72
75
|
assert.fail('should have failed after first retry')
|
|
73
76
|
})
|
|
77
|
+
|
|
74
78
|
it('should succeed after many retries', async function () {
|
|
75
79
|
await this.init(5, 'myerror', 'myerror', 5)
|
|
76
80
|
|
|
77
81
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), '1step.convo.txt')
|
|
78
82
|
await this.compiler.convos[0].Run(this.container)
|
|
79
83
|
})
|
|
84
|
+
|
|
80
85
|
it('should succeed after too less retries', async function () {
|
|
81
86
|
await this.init(5, 'myerror', 'myerror', 4)
|
|
82
87
|
|
|
@@ -89,12 +94,14 @@ describe('convo.retries', function () {
|
|
|
89
94
|
}
|
|
90
95
|
assert.fail('should have failed after four retries')
|
|
91
96
|
})
|
|
97
|
+
|
|
92
98
|
it('should succeed after one retry with regexp pattern', async function () {
|
|
93
99
|
await this.init(1, 'myerror', /myeRRor/i)
|
|
94
100
|
|
|
95
101
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), '1step.convo.txt')
|
|
96
102
|
await this.compiler.convos[0].Run(this.container)
|
|
97
103
|
})
|
|
104
|
+
|
|
98
105
|
it('should fail after one retry with unmatched regexp pattern', async function () {
|
|
99
106
|
await this.init(1, 'myerror', /myeRRor1/i)
|
|
100
107
|
|
|
@@ -107,12 +114,14 @@ describe('convo.retries', function () {
|
|
|
107
114
|
}
|
|
108
115
|
assert.fail('should have failed with unmatched retry pattern')
|
|
109
116
|
})
|
|
117
|
+
|
|
110
118
|
it('should succeed after one retry with regexp pattern array', async function () {
|
|
111
119
|
await this.init(1, 'myerror', [/myeRRor/i, /myeRRor1/i])
|
|
112
120
|
|
|
113
121
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), '1step.convo.txt')
|
|
114
122
|
await this.compiler.convos[0].Run(this.container)
|
|
115
123
|
})
|
|
124
|
+
|
|
116
125
|
it('should fail after one retry with unmatched regexp pattern array', async function () {
|
|
117
126
|
await this.init(1, 'myerror', [/myeRRor1/i, /myeRRor2/i])
|
|
118
127
|
|
|
@@ -58,6 +58,7 @@ describe('convo.retryasserters', function () {
|
|
|
58
58
|
await this.container.Start()
|
|
59
59
|
}
|
|
60
60
|
})
|
|
61
|
+
|
|
61
62
|
afterEach(async function () {
|
|
62
63
|
await this.container.Stop()
|
|
63
64
|
await this.container.Clean()
|
|
@@ -75,12 +76,14 @@ describe('convo.retryasserters', function () {
|
|
|
75
76
|
}
|
|
76
77
|
assert.fail('should have failed without retry')
|
|
77
78
|
})
|
|
79
|
+
|
|
78
80
|
it('should succeed after one retry with default settings', async function () {
|
|
79
81
|
await this.init(1, 'myerror', 'myerror')
|
|
80
82
|
|
|
81
83
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'retryasserter1step.convo.txt')
|
|
82
84
|
await this.compiler.convos[0].Run(this.container)
|
|
83
85
|
})
|
|
86
|
+
|
|
84
87
|
it('should fail after one retry with default settings', async function () {
|
|
85
88
|
await this.init(2, 'myerror', 'myerror')
|
|
86
89
|
|
|
@@ -93,12 +96,14 @@ describe('convo.retryasserters', function () {
|
|
|
93
96
|
}
|
|
94
97
|
assert.fail('should have failed after first retry')
|
|
95
98
|
})
|
|
99
|
+
|
|
96
100
|
it('should succeed after many retries', async function () {
|
|
97
101
|
await this.init(5, 'myerror', 'myerror', 5)
|
|
98
102
|
|
|
99
103
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'retryasserter1step.convo.txt')
|
|
100
104
|
await this.compiler.convos[0].Run(this.container)
|
|
101
105
|
})
|
|
106
|
+
|
|
102
107
|
it('should succeed after too less retries', async function () {
|
|
103
108
|
await this.init(5, 'myerror', 'myerror', 4)
|
|
104
109
|
|
|
@@ -111,12 +116,14 @@ describe('convo.retryasserters', function () {
|
|
|
111
116
|
}
|
|
112
117
|
assert.fail('should have failed after four retries')
|
|
113
118
|
})
|
|
119
|
+
|
|
114
120
|
it('should succeed after one retry with regexp pattern', async function () {
|
|
115
121
|
await this.init(1, 'myerror', /myeRRor/i)
|
|
116
122
|
|
|
117
123
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'retryasserter1step.convo.txt')
|
|
118
124
|
await this.compiler.convos[0].Run(this.container)
|
|
119
125
|
})
|
|
126
|
+
|
|
120
127
|
it('should fail after one retry with unmatched regexp pattern', async function () {
|
|
121
128
|
await this.init(1, 'myerror', /myeRRor1/i)
|
|
122
129
|
|
|
@@ -129,12 +136,14 @@ describe('convo.retryasserters', function () {
|
|
|
129
136
|
}
|
|
130
137
|
assert.fail('should have failed with unmatched retry pattern')
|
|
131
138
|
})
|
|
139
|
+
|
|
132
140
|
it('should succeed after one retry with regexp pattern array', async function () {
|
|
133
141
|
await this.init(1, 'myerror', [/myeRRor/i, /myeRRor1/i])
|
|
134
142
|
|
|
135
143
|
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'retryasserter1step.convo.txt')
|
|
136
144
|
await this.compiler.convos[0].Run(this.container)
|
|
137
145
|
})
|
|
146
|
+
|
|
138
147
|
it('should fail after one retry with unmatched regexp pattern array', async function () {
|
|
139
148
|
await this.init(1, 'myerror', [/myeRRor1/i, /myeRRor2/i])
|
|
140
149
|
|