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
|
@@ -41,6 +41,7 @@ describe('compiler.compilertxt', function () {
|
|
|
41
41
|
compiler.Compile(scriptBuffer, 'SCRIPTING_TYPE_CONVO')
|
|
42
42
|
assert.equal(context.convos[0].conversation.length, 0)
|
|
43
43
|
})
|
|
44
|
+
|
|
44
45
|
it('should read ! as not', async function () {
|
|
45
46
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation.convo.txt'))
|
|
46
47
|
const context = buildContext()
|
|
@@ -53,6 +54,7 @@ describe('compiler.compilertxt', function () {
|
|
|
53
54
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2')
|
|
54
55
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
55
56
|
})
|
|
57
|
+
|
|
56
58
|
it('should read !! as !', async function () {
|
|
57
59
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_exclamation.convo.txt'))
|
|
58
60
|
const context = buildContext()
|
|
@@ -64,6 +66,7 @@ describe('compiler.compilertxt', function () {
|
|
|
64
66
|
assert.equal(context.convos[0].conversation[1].messageText, '!test 2')
|
|
65
67
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
66
68
|
})
|
|
69
|
+
|
|
67
70
|
it('should read n*! as (n-1)*!', async function () {
|
|
68
71
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_exclamation.convo.txt'))
|
|
69
72
|
const context = buildContext()
|
|
@@ -76,6 +79,7 @@ describe('compiler.compilertxt', function () {
|
|
|
76
79
|
assert.equal(context.convos[0].conversation[1].messageText, '!!!test 2')
|
|
77
80
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
78
81
|
})
|
|
82
|
+
|
|
79
83
|
it('should read ! as ! in second line', async function () {
|
|
80
84
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation_secline.convo.txt'))
|
|
81
85
|
const context = buildContext()
|
|
@@ -87,6 +91,7 @@ describe('compiler.compilertxt', function () {
|
|
|
87
91
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2\n!test 2')
|
|
88
92
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
89
93
|
})
|
|
94
|
+
|
|
90
95
|
it('should read ? as optional', async function () {
|
|
91
96
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question.convo.txt'))
|
|
92
97
|
const context = buildContext()
|
|
@@ -99,6 +104,7 @@ describe('compiler.compilertxt', function () {
|
|
|
99
104
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2')
|
|
100
105
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
101
106
|
})
|
|
107
|
+
|
|
102
108
|
it('should read ?? as ?', async function () {
|
|
103
109
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question.convo.txt'))
|
|
104
110
|
const context = buildContext()
|
|
@@ -110,6 +116,7 @@ describe('compiler.compilertxt', function () {
|
|
|
110
116
|
assert.equal(context.convos[0].conversation[1].messageText, '?test 2')
|
|
111
117
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
112
118
|
})
|
|
119
|
+
|
|
113
120
|
it('should read ?! as optional and not', async function () {
|
|
114
121
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_exclamation.convo.txt'))
|
|
115
122
|
const context = buildContext()
|
|
@@ -123,6 +130,7 @@ describe('compiler.compilertxt', function () {
|
|
|
123
130
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
124
131
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
125
132
|
})
|
|
133
|
+
|
|
126
134
|
it('should read ??! as ?!', async function () {
|
|
127
135
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question_exclamation.convo.txt'))
|
|
128
136
|
const context = buildContext()
|
|
@@ -136,6 +144,7 @@ describe('compiler.compilertxt', function () {
|
|
|
136
144
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
137
145
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
138
146
|
})
|
|
147
|
+
|
|
139
148
|
it('should read n*? as (n-1)*?', async function () {
|
|
140
149
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_question.convo.txt'))
|
|
141
150
|
const context = buildContext()
|
|
@@ -148,6 +157,7 @@ describe('compiler.compilertxt', function () {
|
|
|
148
157
|
assert.equal(context.convos[0].conversation[1].messageText, '???test 2')
|
|
149
158
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
150
159
|
})
|
|
160
|
+
|
|
151
161
|
it('should read ? as ? in second line', async function () {
|
|
152
162
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_secline.convo.txt'))
|
|
153
163
|
const context = buildContext()
|
|
@@ -159,6 +169,7 @@ describe('compiler.compilertxt', function () {
|
|
|
159
169
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2\n?test 2')
|
|
160
170
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
161
171
|
})
|
|
172
|
+
|
|
162
173
|
it('should allow text starting with ##', async function () {
|
|
163
174
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_hashmark.convo.txt'))
|
|
164
175
|
const context = buildContext()
|
|
@@ -184,6 +195,7 @@ describe('compiler.compilertxt', function () {
|
|
|
184
195
|
assert.equal(convo.conversation[0].messageText, 'Hallo\n\nHallo2')
|
|
185
196
|
assert.equal(convo.conversation[1].messageText, 'Hallo\n\nHallo2')
|
|
186
197
|
})
|
|
198
|
+
|
|
187
199
|
it('should read msg if there is just text', async function () {
|
|
188
200
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_just_text.convo.txt'))
|
|
189
201
|
const context = buildContext()
|
|
@@ -197,6 +209,7 @@ describe('compiler.compilertxt', function () {
|
|
|
197
209
|
assert.equal(convo.conversation[0].messageText, 'Hello')
|
|
198
210
|
assert.equal(convo.conversation[1].messageText, 'Hi')
|
|
199
211
|
})
|
|
212
|
+
|
|
200
213
|
it('should read msg if there is just text, even if it is not separated by newline', async function () {
|
|
201
214
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_just_text_no_separator_row.convo.txt'))
|
|
202
215
|
const context = buildContext()
|
|
@@ -210,6 +223,7 @@ describe('compiler.compilertxt', function () {
|
|
|
210
223
|
assert.equal(convo.conversation[0].messageText, 'Hello')
|
|
211
224
|
assert.equal(convo.conversation[1].messageText, 'Hi')
|
|
212
225
|
})
|
|
226
|
+
|
|
213
227
|
it('should read nothing if there is nothing', async function () {
|
|
214
228
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_empty.convo.txt'))
|
|
215
229
|
const context = buildContext()
|
|
@@ -224,6 +238,7 @@ describe('compiler.compilertxt', function () {
|
|
|
224
238
|
assert.equal(convo.conversation[0].logicHooks.length, 0)
|
|
225
239
|
assert.equal(convo.conversation[1].messageText, 'Hi')
|
|
226
240
|
})
|
|
241
|
+
|
|
227
242
|
it('should read empty row if there are at least 2 empty rows', async function () {
|
|
228
243
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_just_emptyrow.convo.txt'))
|
|
229
244
|
const context = buildContext()
|
|
@@ -238,6 +253,7 @@ describe('compiler.compilertxt', function () {
|
|
|
238
253
|
assert.equal(convo.conversation[0].logicHooks.length, 0)
|
|
239
254
|
assert.equal(convo.conversation[1].messageText, 'Hi ')
|
|
240
255
|
})
|
|
256
|
+
|
|
241
257
|
it('should read nothing if there is nothing (even no separator)', async function () {
|
|
242
258
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_no_separator_row.convo.txt'))
|
|
243
259
|
const context = buildContext()
|
|
@@ -286,6 +302,7 @@ describe('compiler.compilertxt', function () {
|
|
|
286
302
|
assert.equal(convo.conversation[0].logicHooks.length, 1)
|
|
287
303
|
assert.equal(convo.conversation[1].messageText, 'Hi')
|
|
288
304
|
})
|
|
305
|
+
|
|
289
306
|
it('should read logicHook if there is just logicHook, even if it is not separated by newline', async function () {
|
|
290
307
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_just_asserter_no_separator_row.convo.txt'))
|
|
291
308
|
const context = buildContextWithPause()
|
|
@@ -300,6 +317,7 @@ describe('compiler.compilertxt', function () {
|
|
|
300
317
|
assert.equal(convo.conversation[0].logicHooks.length, 1)
|
|
301
318
|
assert.equal(convo.conversation[1].messageText, 'Hi')
|
|
302
319
|
})
|
|
320
|
+
|
|
303
321
|
it('should throw error if there is message after logichook', async function () {
|
|
304
322
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_emptyrow_text_after_logichook.convo.txt'))
|
|
305
323
|
const context = buildContextWithPause()
|
|
@@ -313,6 +331,7 @@ describe('compiler.compilertxt', function () {
|
|
|
313
331
|
assert.equal(err.message, 'Failed to parse conversation. No text expected here: \'Hi!\' in convo:\n PAUSE 100\nHi!\n')
|
|
314
332
|
}
|
|
315
333
|
})
|
|
334
|
+
|
|
316
335
|
it('should consider modificator for asserter', async function () {
|
|
317
336
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_asserter_modificator.convo.txt'))
|
|
318
337
|
const context = buildContextWithPause()
|
|
@@ -326,6 +345,7 @@ describe('compiler.compilertxt', function () {
|
|
|
326
345
|
assert.equal(convo.conversation[0].asserters.length, 1)
|
|
327
346
|
assert.deepEqual(convo.conversation[0].asserters[0], { name: 'BUTTONS', args: ['Test1', 'Test2'], not: true, optional: false })
|
|
328
347
|
})
|
|
348
|
+
|
|
329
349
|
it('should allow escape pipe for args', async function () {
|
|
330
350
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_args_escape.convo.txt'))
|
|
331
351
|
const context = buildContextWithPause()
|
|
@@ -339,6 +359,7 @@ describe('compiler.compilertxt', function () {
|
|
|
339
359
|
assert.equal(convo.conversation[0].asserters.length, 1)
|
|
340
360
|
assert.deepEqual(convo.conversation[0].asserters[0], { name: 'BUTTONS', args: ['Test|1', 'Test|2'], not: false, optional: false })
|
|
341
361
|
})
|
|
362
|
+
|
|
342
363
|
it('should read file with mixed new line characters', async function () {
|
|
343
364
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_mixed_new_line_characters.convo.txt'))
|
|
344
365
|
const context = buildContext()
|
|
@@ -50,6 +50,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
50
50
|
assert.equal(context.convos[1].conversation[1].messageText, 'test 2')
|
|
51
51
|
assert.lengthOf(context.utterances, 0)
|
|
52
52
|
})
|
|
53
|
+
|
|
53
54
|
it('should read 2 convos and 2 utterances', async function () {
|
|
54
55
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_2utterances.xlsx'))
|
|
55
56
|
const context = buildContext()
|
|
@@ -72,6 +73,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
72
73
|
assert.equal(context.utterances[0].name, 'TESTUTT1')
|
|
73
74
|
assert.equal(context.utterances[1].name, 'TESTUTT2')
|
|
74
75
|
})
|
|
76
|
+
|
|
75
77
|
it('should read utterances from default worksheet', async function () {
|
|
76
78
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2utterances.xlsx'))
|
|
77
79
|
const context = buildContext()
|
|
@@ -84,6 +86,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
84
86
|
assert.lengthOf(context.convos, 0)
|
|
85
87
|
assert.lengthOf(context.utterances, 2)
|
|
86
88
|
})
|
|
89
|
+
|
|
87
90
|
it('should read 2 utterances', async function () {
|
|
88
91
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2utterances.xlsx'))
|
|
89
92
|
const context = buildContext()
|
|
@@ -99,6 +102,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
99
102
|
assert.equal(context.utterances[0].name, 'TESTUTT1')
|
|
100
103
|
assert.equal(context.utterances[1].name, 'TESTUTT2')
|
|
101
104
|
})
|
|
105
|
+
|
|
102
106
|
it('should read 2 utterances separated by empty lines', async function () {
|
|
103
107
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2utterances_emptylines.xlsx'))
|
|
104
108
|
const context = buildContext()
|
|
@@ -116,6 +120,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
116
120
|
assert.equal(context.utterances[1].name, 'TESTUTT2')
|
|
117
121
|
assert.equal(context.utterances[1].utterances.length, 3)
|
|
118
122
|
})
|
|
123
|
+
|
|
119
124
|
it('should read 2 convos from given region by letter', async function () {
|
|
120
125
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_middle.xlsx'))
|
|
121
126
|
const context = buildContext()
|
|
@@ -133,6 +138,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
133
138
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2')
|
|
134
139
|
assert.lengthOf(context.utterances, 0)
|
|
135
140
|
})
|
|
141
|
+
|
|
136
142
|
it('should read 2 convos from given region by index', async function () {
|
|
137
143
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_middle.xlsx'))
|
|
138
144
|
const context = buildContext()
|
|
@@ -151,6 +157,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
151
157
|
assert.lengthOf(context.utterances, 0)
|
|
152
158
|
})
|
|
153
159
|
})
|
|
160
|
+
|
|
154
161
|
describe('negating', function () {
|
|
155
162
|
it('should read ! as not', async function () {
|
|
156
163
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation.xlsx'))
|
|
@@ -164,6 +171,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
164
171
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2')
|
|
165
172
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
166
173
|
})
|
|
174
|
+
|
|
167
175
|
it('should read !! as !', async function () {
|
|
168
176
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_exclamation.xlsx'))
|
|
169
177
|
const context = buildContext()
|
|
@@ -175,6 +183,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
175
183
|
assert.equal(context.convos[0].conversation[1].messageText, '!test 2')
|
|
176
184
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
177
185
|
})
|
|
186
|
+
|
|
178
187
|
it('should read n*! as (n-1)*!', async function () {
|
|
179
188
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_exclamation.xlsx'))
|
|
180
189
|
const context = buildContext()
|
|
@@ -187,6 +196,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
187
196
|
assert.equal(context.convos[0].conversation[1].messageText, '!!!test 2')
|
|
188
197
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
189
198
|
})
|
|
199
|
+
|
|
190
200
|
it('should read ! as ! in second line', async function () {
|
|
191
201
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_exclamation_secline.xlsx'))
|
|
192
202
|
const context = buildContext()
|
|
@@ -199,6 +209,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
199
209
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
200
210
|
})
|
|
201
211
|
})
|
|
212
|
+
|
|
202
213
|
describe('optional', function () {
|
|
203
214
|
it('should read ? as optional', async function () {
|
|
204
215
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question.xlsx'))
|
|
@@ -212,6 +223,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
212
223
|
assert.equal(context.convos[0].conversation[1].messageText, 'test 2')
|
|
213
224
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
214
225
|
})
|
|
226
|
+
|
|
215
227
|
it('should read ?? as ?', async function () {
|
|
216
228
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question.xlsx'))
|
|
217
229
|
const context = buildContext()
|
|
@@ -223,6 +235,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
223
235
|
assert.equal(context.convos[0].conversation[1].messageText, '?test 2')
|
|
224
236
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
225
237
|
})
|
|
238
|
+
|
|
226
239
|
it('should read n*? as (n-1)*?', async function () {
|
|
227
240
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_four_question.xlsx'))
|
|
228
241
|
const context = buildContext()
|
|
@@ -235,6 +248,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
235
248
|
assert.equal(context.convos[0].conversation[1].messageText, '???test 2')
|
|
236
249
|
assert.equal(context.convos[0].conversation[1].optional, false)
|
|
237
250
|
})
|
|
251
|
+
|
|
238
252
|
it('should read ? as ? in second line', async function () {
|
|
239
253
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_secline.xlsx'))
|
|
240
254
|
const context = buildContext()
|
|
@@ -247,6 +261,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
247
261
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
248
262
|
})
|
|
249
263
|
})
|
|
264
|
+
|
|
250
265
|
describe('optional and negate', function () {
|
|
251
266
|
it('should read ?! as optional and not', async function () {
|
|
252
267
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_question_exclamation.xlsx'))
|
|
@@ -260,6 +275,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
260
275
|
assert.equal(context.convos[0].conversation[1].optional, true)
|
|
261
276
|
assert.equal(context.convos[0].conversation[1].not, true)
|
|
262
277
|
})
|
|
278
|
+
|
|
263
279
|
it('should read ??! as ?!', async function () {
|
|
264
280
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_with_two_question_exclamation.xlsx'))
|
|
265
281
|
const context = buildContext()
|
|
@@ -272,6 +288,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
272
288
|
assert.equal(context.convos[0].conversation[1].not, false)
|
|
273
289
|
})
|
|
274
290
|
})
|
|
291
|
+
|
|
275
292
|
describe('logichooks', function () {
|
|
276
293
|
it('should accept logic hook if it is before message', async function () {
|
|
277
294
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_logichook_after.xlsx'))
|
|
@@ -284,6 +301,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
284
301
|
const convo = context.convos[0]
|
|
285
302
|
assert.equal(convo.conversation[0].logicHooks.length, 1)
|
|
286
303
|
})
|
|
304
|
+
|
|
287
305
|
it('should throw error if logic hook is after message', async function () {
|
|
288
306
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_logichook_before.xlsx'))
|
|
289
307
|
const context = buildContextWithPause()
|
|
@@ -324,6 +342,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
324
342
|
assert.equal(context.convos[3].conversation[1].messageText, 'test 4')
|
|
325
343
|
assert.lengthOf(context.utterances, 0)
|
|
326
344
|
})
|
|
345
|
+
|
|
327
346
|
it('should read 2 convos and no utterances in simplified mode forced', async function () {
|
|
328
347
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_simplified_to_force.xlsx'))
|
|
329
348
|
const context = buildContext()
|
|
@@ -343,6 +362,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
343
362
|
assert.equal(context.convos[1].conversation[1].messageText, 'test 4')
|
|
344
363
|
assert.lengthOf(context.utterances, 0)
|
|
345
364
|
})
|
|
365
|
+
|
|
346
366
|
it('should sort convos by position in file', async function () {
|
|
347
367
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_sortorder.xlsx'))
|
|
348
368
|
const context = buildContext()
|
|
@@ -359,6 +379,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
359
379
|
assert.equal(context.convos[3].header.name, 'Convos1-A011')
|
|
360
380
|
assert.equal(context.convos[4].header.name, 'Convos1-A014')
|
|
361
381
|
})
|
|
382
|
+
|
|
362
383
|
it('should fail on intermixing q&a and convo sections', async function () {
|
|
363
384
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_mix_qa_and_convos.xlsx'))
|
|
364
385
|
const context = buildContext()
|
|
@@ -374,6 +395,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
374
395
|
assert.isTrue(err.message.indexOf('Excel sheet "Convos1" invalid. Detected intermixed Q&A sections (for instance A5) and convo sections (for instance A2,B3)') >= 0)
|
|
375
396
|
}
|
|
376
397
|
})
|
|
398
|
+
|
|
377
399
|
it('should read sheet names from filter with full match', async function () {
|
|
378
400
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_sheetnames.xlsx'))
|
|
379
401
|
const context = buildContext()
|
|
@@ -386,6 +408,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
386
408
|
compiler.Compile(scriptBuffer, 'SCRIPTING_TYPE_CONVO')
|
|
387
409
|
assert.lengthOf(context.convos, 2)
|
|
388
410
|
})
|
|
411
|
+
|
|
389
412
|
it('should read sheet names from filter with wildcard', async function () {
|
|
390
413
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_sheetnames.xlsx'))
|
|
391
414
|
const context = buildContext()
|
|
@@ -398,6 +421,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
398
421
|
compiler.Compile(scriptBuffer, 'SCRIPTING_TYPE_CONVO')
|
|
399
422
|
assert.lengthOf(context.convos, 3)
|
|
400
423
|
})
|
|
424
|
+
|
|
401
425
|
it('should read 3 convos with name', async function () {
|
|
402
426
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_with_names.xlsx'))
|
|
403
427
|
const context = buildContext()
|
|
@@ -422,6 +446,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
422
446
|
|
|
423
447
|
assert.lengthOf(context.utterances, 0)
|
|
424
448
|
})
|
|
449
|
+
|
|
425
450
|
it('should read 3 convos with name (forced)', async function () {
|
|
426
451
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_with_names_noheader.xlsx'))
|
|
427
452
|
const context = buildContext()
|
|
@@ -448,6 +473,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
448
473
|
|
|
449
474
|
assert.lengthOf(context.utterances, 0)
|
|
450
475
|
})
|
|
476
|
+
|
|
451
477
|
it('should read 3 convos without name (forced)', async function () {
|
|
452
478
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_without_names.xlsx'))
|
|
453
479
|
const context = buildContext()
|
|
@@ -473,6 +499,7 @@ describe('compiler.compilerxlsx', function () {
|
|
|
473
499
|
|
|
474
500
|
assert.lengthOf(context.utterances, 0)
|
|
475
501
|
})
|
|
502
|
+
|
|
476
503
|
it('should read 3 convos without name (forced) 2', async function () {
|
|
477
504
|
const scriptBuffer = fs.readFileSync(path.resolve(__dirname, CONVOS_DIR, 'convos_2convos_without_names_noheader.xlsx'))
|
|
478
505
|
const context = buildContext()
|
|
@@ -310,6 +310,7 @@ describe('connectors.simplerest', function () {
|
|
|
310
310
|
scope.persist(false)
|
|
311
311
|
})
|
|
312
312
|
|
|
313
|
+
/*
|
|
313
314
|
it('error case chat endpoint timeout', async function () {
|
|
314
315
|
const caps = {
|
|
315
316
|
[Capabilities.CONTAINERMODE]: 'simplerest',
|
|
@@ -319,7 +320,7 @@ describe('connectors.simplerest', function () {
|
|
|
319
320
|
}
|
|
320
321
|
const scope = nock('https://mock2.com')
|
|
321
322
|
.get('/endpointTimeout')
|
|
322
|
-
.
|
|
323
|
+
.delay(200)
|
|
323
324
|
.reply(200, {
|
|
324
325
|
status: 'ok'
|
|
325
326
|
})
|
|
@@ -340,6 +341,7 @@ describe('connectors.simplerest', function () {
|
|
|
340
341
|
await container.Clean()
|
|
341
342
|
scope.persist(false)
|
|
342
343
|
})
|
|
344
|
+
*/
|
|
343
345
|
|
|
344
346
|
it('should follow redirect', async function () {
|
|
345
347
|
const caps = {
|