botium-core 1.13.0 → 1.13.3
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/.eslintrc.js +6 -3
- package/dist/botium-cjs.js +305 -123
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +323 -142
- package/dist/botium-es.js.map +1 -1
- package/package.json +17 -15
- package/src/Capabilities.js +2 -1
- package/src/containers/plugins/SimpleRestContainer.js +23 -16
- package/src/grid/inbound/proxy.js +2 -1
- package/src/helpers/RetryHelper.js +13 -7
- package/src/scripting/Convo.js +36 -10
- package/src/scripting/MatchFunctions.js +10 -0
- package/src/scripting/ScriptingProvider.js +106 -37
- package/src/scripting/logichook/LogicHookConsts.js +1 -1
- package/src/scripting/logichook/LogicHookUtils.js +1 -1
- package/src/scripting/logichook/asserter/WerAsserter.js +59 -0
- package/src/scripting/logichook/logichooks/UpdateCustomLogicHook.js +3 -2
- package/test/compiler/compilercsv.spec.js +104 -3
- package/test/compiler/compilerjson.spec.js +0 -2
- package/test/compiler/compilerxlsx.spec.js +1 -1
- package/test/compiler/convos/csv/utterances_liveperson2.csv +12 -0
- package/test/connectors/simplerest.spec.js +1012 -969
- package/test/convo/fillAndApplyScriptingMemory.spec.js +804 -785
- package/test/convo/partialconvo.spec.js +345 -339
- package/test/convo/retryconvo.spec.js +134 -0
- package/test/driver/capabilities.spec.js +156 -151
- package/test/logichooks/hookfromsrc.spec.js +79 -73
- package/test/plugins/plugins.spec.js +44 -42
- package/test/scripting/asserters/buttonsAsserter.spec.js +257 -240
- package/test/scripting/asserters/cardsAsserter.spec.js +214 -212
- package/test/scripting/asserters/convos/wer_threshold_nok.yml +7 -0
- package/test/scripting/asserters/convos/wer_threshold_ok.yml +7 -0
- package/test/scripting/asserters/intentConfidenceAsserter.spec.js +34 -35
- package/test/scripting/asserters/jsonpathAsserter.spec.js +307 -308
- package/test/scripting/asserters/mediaAsserter.spec.js +236 -234
- package/test/scripting/asserters/werAsserter.spec.js +51 -0
- package/test/scripting/logichooks/setClearScriptingMemory.spec.js +202 -192
- package/test/scripting/matching/matchingmode.spec.js +306 -258
- package/test/scripting/scriptingProvider.spec.js +666 -633
- package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +299 -281
- package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +94 -80
- package/test/scripting/userinputs/defaultUserInputs.spec.js +233 -127
- package/test/scripting/userinputs/mediaInputConvos.spec.js +409 -403
- package/test/scripting/utteranceexpansion/associateByIndex.spec.js +259 -0
- package/test/scripting/utteranceexpansion/convos/associate_utterances_by_index.json +33 -0
- package/test/scripting/utteranceexpansion/convos/media.convo.txt +19 -0
- package/test/scripting/utteranceexpansion/files/step0voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step0voice1.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step0voice2.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step1voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice0.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice1.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice2.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice4.wav +0 -0
- package/test/scripting/utteranceexpansion/files/step2voice5.wav +0 -0
- package/test/security/allowUnsafe.spec.js +274 -268
- package/test/utils.spec.js +40 -38
|
@@ -30,322 +30,328 @@ const emptyMsg = {}
|
|
|
30
30
|
const functionConnector = ({ queueBotSays }) => {
|
|
31
31
|
return {
|
|
32
32
|
UserSays (msg) {
|
|
33
|
-
const botMsg = {
|
|
33
|
+
const botMsg = {
|
|
34
|
+
sender: 'bot',
|
|
35
|
+
sourceData: msg.sourceData,
|
|
36
|
+
messageText: `Response of ${msg.messageText}`
|
|
37
|
+
}
|
|
34
38
|
queueBotSays(botMsg)
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
|
|
39
|
-
describe('
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
43
|
-
}, '1+1')
|
|
44
|
-
})
|
|
45
|
-
it('should accept javascript hook in safe mode', async function () {
|
|
46
|
-
HookUtils.getHook({
|
|
47
|
-
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
48
|
-
}, () => null)
|
|
49
|
-
})
|
|
50
|
-
it('should not accept file hook in safe mode', async function () {
|
|
51
|
-
try {
|
|
43
|
+
describe('security.allowUnsafe', function () {
|
|
44
|
+
describe('hook utils', function () {
|
|
45
|
+
it('should accept string hook in safe mode', async function () {
|
|
52
46
|
HookUtils.getHook({
|
|
53
47
|
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
48
|
+
}, '1+1')
|
|
49
|
+
})
|
|
50
|
+
it('should accept javascript hook in safe mode', async function () {
|
|
51
|
+
HookUtils.getHook({
|
|
52
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
53
|
+
}, () => null)
|
|
54
|
+
})
|
|
55
|
+
it('should not accept file hook in safe mode', async function () {
|
|
56
|
+
try {
|
|
57
|
+
HookUtils.getHook({
|
|
58
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
59
|
+
}, 'test/security/resources/hook-as-file.js')
|
|
60
|
+
assert.fail('should have failed')
|
|
61
|
+
} catch (err) {
|
|
62
|
+
assert.isTrue(err instanceof BotiumError)
|
|
63
|
+
assert.exists(err.context)
|
|
64
|
+
assert.equal(err.context.message, 'Security Error. Using unsafe custom hook with require is not allowed')
|
|
65
|
+
assert.equal(err.context.source, 'HookUtils.js')
|
|
66
|
+
assert.equal(err.context.type, 'security')
|
|
67
|
+
assert.equal(err.context.subtype, 'allow unsafe')
|
|
68
|
+
assert.exists(err.context.cause)
|
|
69
|
+
assert.equal(err.context.cause.hookData, 'test/security/resources/hook-as-file.js')
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
it('should accept file hook in unsafe mode', async function () {
|
|
73
|
+
HookUtils.getHook({
|
|
74
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: true
|
|
54
75
|
}, 'test/security/resources/hook-as-file.js')
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
assert.equal(err.context.type, 'security')
|
|
62
|
-
assert.equal(err.context.subtype, 'allow unsafe')
|
|
63
|
-
assert.exists(err.context.cause)
|
|
64
|
-
assert.equal(err.context.cause.hookData, 'test/security/resources/hook-as-file.js')
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
it('should accept file hook in unsafe mode', async function () {
|
|
68
|
-
HookUtils.getHook({
|
|
69
|
-
[Capabilities.SECURITY_ALLOW_UNSAFE]: true
|
|
70
|
-
}, 'test/security/resources/hook-as-file.js')
|
|
71
|
-
})
|
|
72
|
-
it('should accept require hook in unsafe mode', async function () {
|
|
73
|
-
HookUtils.getHook({
|
|
74
|
-
[Capabilities.SECURITY_ALLOW_UNSAFE]: true
|
|
75
|
-
}, 'hook-as-file')
|
|
76
|
+
})
|
|
77
|
+
it('should accept require hook in unsafe mode', async function () {
|
|
78
|
+
HookUtils.getHook({
|
|
79
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: true
|
|
80
|
+
}, 'hook-as-file')
|
|
81
|
+
})
|
|
76
82
|
})
|
|
77
|
-
})
|
|
78
83
|
|
|
79
|
-
describe('scripting memory', function () {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
84
|
+
describe('scripting memory', function () {
|
|
85
|
+
it('should not throw security error for using inline function', async function () {
|
|
86
|
+
const driver = new BotDriver(myCapsSimpleRest)
|
|
87
|
+
const compiler = driver.BuildCompiler()
|
|
88
|
+
const container = await driver.Build()
|
|
89
|
+
await container.Start()
|
|
90
|
+
|
|
91
|
+
try {
|
|
92
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'withscriptingmemoryfunction.convo.txt')
|
|
93
|
+
await compiler.convos[0].Run(container)
|
|
94
|
+
assert.fail('should have failed')
|
|
95
|
+
} catch (err) {
|
|
96
|
+
assert.isFalse(err.message.indexOf('Security Error. Using unsafe scripting memory function $func is not allowed') >= 0)
|
|
97
|
+
}
|
|
98
|
+
await container.Clean()
|
|
99
|
+
})
|
|
94
100
|
})
|
|
95
|
-
})
|
|
96
101
|
|
|
97
|
-
describe('simple rest, scripting memory', function () {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
102
|
+
describe('simple rest, scripting memory', function () {
|
|
103
|
+
it('should use variables succesful', async function () {
|
|
104
|
+
const myCaps = _getSimpleRestCaps(
|
|
105
|
+
{
|
|
106
|
+
[Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
|
|
107
|
+
FUNCTION_WITHOUT_PARAM: '{{fnc.year}}'
|
|
108
|
+
}
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
await container.Start()
|
|
110
|
+
)
|
|
111
|
+
const driver = new BotDriver(myCaps)
|
|
112
|
+
const container = await driver.Build()
|
|
113
|
+
await container.Start()
|
|
109
114
|
|
|
110
|
-
|
|
115
|
+
await container.pluginInstance._buildRequest(emptyMsg)
|
|
111
116
|
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
await container.Clean()
|
|
118
|
+
})
|
|
114
119
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
+
it('should use env variables succesful', async function () {
|
|
121
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
122
|
+
{
|
|
123
|
+
[Capabilities.SIMPLEREST_BODY_TEMPLATE]: {
|
|
124
|
+
SAMPLE_ENV: '{{#fnc.env}}SAMPLE_ENV{{/fnc.env}}'
|
|
125
|
+
}
|
|
120
126
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
await container.Start()
|
|
127
|
+
))
|
|
128
|
+
const container = await driver.Build()
|
|
129
|
+
await container.Start()
|
|
125
130
|
|
|
126
|
-
|
|
131
|
+
await container.pluginInstance._buildRequest(emptyMsg)
|
|
127
132
|
|
|
128
|
-
|
|
133
|
+
await container.Clean()
|
|
134
|
+
})
|
|
129
135
|
})
|
|
130
|
-
})
|
|
131
136
|
|
|
132
|
-
describe('simple rest, hooks', function () {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
describe('simple rest, hooks', function () {
|
|
138
|
+
it('should create and use simplerest with javascript hook', async function () {
|
|
139
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
140
|
+
{
|
|
141
|
+
[Capabilities.SIMPLEREST_REQUEST_HOOK]: '1+1'
|
|
142
|
+
}
|
|
143
|
+
))
|
|
139
144
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
const compiler = driver.BuildCompiler()
|
|
146
|
+
const container = await driver.Build()
|
|
147
|
+
await container.Start()
|
|
143
148
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
|
|
150
|
+
})
|
|
151
|
+
it('should create and use simplerest with function hooks', async function () {
|
|
152
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
153
|
+
{
|
|
154
|
+
[Capabilities.SIMPLEREST_REQUEST_HOOK]: () => 2
|
|
155
|
+
}
|
|
156
|
+
))
|
|
152
157
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
const compiler = driver.BuildCompiler()
|
|
159
|
+
const container = await driver.Build()
|
|
160
|
+
await container.Start()
|
|
156
161
|
|
|
157
|
-
|
|
162
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'dummy.convo.txt')
|
|
163
|
+
})
|
|
158
164
|
})
|
|
159
|
-
})
|
|
160
165
|
|
|
161
|
-
describe('precompilers', function () {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
describe('precompilers', function () {
|
|
167
|
+
it('should not throw security error for inline script type', async function () {
|
|
168
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
169
|
+
{
|
|
170
|
+
[Capabilities.PRECOMPILERS]: {
|
|
171
|
+
NAME: 'SCRIPT',
|
|
172
|
+
SCRIPT: '1+1'
|
|
173
|
+
}
|
|
168
174
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
175
|
+
))
|
|
176
|
+
|
|
177
|
+
const compiler = driver.BuildCompiler()
|
|
178
|
+
const container = await driver.Build()
|
|
179
|
+
const fileName = 'dummy.convo.txt'
|
|
180
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), fileName)
|
|
181
|
+
assert.equal(compiler.convos.length, 1)
|
|
182
|
+
await container.Clean()
|
|
183
|
+
})
|
|
178
184
|
})
|
|
179
|
-
})
|
|
180
185
|
|
|
181
|
-
describe('base container, hooks', function () {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
186
|
+
describe('base container, hooks', function () {
|
|
187
|
+
it('should not throw security error for using inline hook', async function () {
|
|
188
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
189
|
+
{ [Capabilities.CUSTOMHOOK_ONUSERSAYS]: '1+1' }
|
|
190
|
+
))
|
|
191
|
+
await driver.Build()
|
|
192
|
+
})
|
|
187
193
|
})
|
|
188
|
-
})
|
|
189
194
|
|
|
190
|
-
describe('logic hook, asserter', function () {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
describe('logic hook, asserter', function () {
|
|
196
|
+
it('should load asserter from file', async function () {
|
|
197
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
198
|
+
{
|
|
199
|
+
[Capabilities.ASSERTERS]: [
|
|
200
|
+
{
|
|
201
|
+
ref: 'as-file'
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
))
|
|
201
206
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
driver.BuildCompiler()
|
|
208
|
+
})
|
|
209
|
+
it('should not throw security error for logic hook with inline src', async function () {
|
|
210
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
211
|
+
{
|
|
212
|
+
[Capabilities.LOGIC_HOOKS]: [
|
|
213
|
+
{
|
|
214
|
+
ref: 'MY-LOGICHOOK-NAME',
|
|
215
|
+
src: {
|
|
216
|
+
onMeStart: '1+1'
|
|
217
|
+
},
|
|
218
|
+
global: false,
|
|
219
|
+
args: {
|
|
220
|
+
'my-arg-1': 'something'
|
|
221
|
+
}
|
|
216
222
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
))
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
))
|
|
221
226
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
227
|
+
driver.BuildCompiler()
|
|
228
|
+
})
|
|
229
|
+
it('should not throw security error for global logic hook with inline src', async function () {
|
|
230
|
+
const driver = new BotDriver(_getSimpleRestCaps(
|
|
231
|
+
{
|
|
232
|
+
[Capabilities.LOGIC_HOOKS]: [
|
|
233
|
+
{
|
|
234
|
+
ref: 'MY-LOGICHOOK-NAME',
|
|
235
|
+
src: {
|
|
236
|
+
onMeStart: '1+1'
|
|
237
|
+
},
|
|
238
|
+
global: true,
|
|
239
|
+
args: {
|
|
240
|
+
'my-arg-1': 'something'
|
|
241
|
+
}
|
|
236
242
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
))
|
|
246
|
+
driver.BuildCompiler()
|
|
247
|
+
})
|
|
242
248
|
})
|
|
243
|
-
})
|
|
244
249
|
|
|
245
|
-
describe('connectors', function () {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
+
describe('connectors', function () {
|
|
251
|
+
it('should create simplerest', async function () {
|
|
252
|
+
const driver = new BotDriver(myCapsSimpleRest)
|
|
253
|
+
await driver.Build()
|
|
254
|
+
})
|
|
250
255
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
256
|
+
it('should create any connector from file/dir with added botium-connector prefix', async function () {
|
|
257
|
+
const driver = new BotDriver({
|
|
258
|
+
[Capabilities.CONTAINERMODE]: 'as-file',
|
|
259
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
260
|
+
})
|
|
261
|
+
await driver.Build()
|
|
255
262
|
})
|
|
256
|
-
await driver.Build()
|
|
257
|
-
})
|
|
258
263
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
it('should create any connector from file/dir, if its starts with botium-connector prefix', async function () {
|
|
265
|
+
const driver = new BotDriver({
|
|
266
|
+
[Capabilities.CONTAINERMODE]: 'botium-connector-as-file',
|
|
267
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
268
|
+
})
|
|
269
|
+
await driver.Build()
|
|
263
270
|
})
|
|
264
|
-
await driver.Build()
|
|
265
|
-
})
|
|
266
271
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
272
|
+
it('should create any function connectors', async function () {
|
|
273
|
+
const myCapsFunction = {
|
|
274
|
+
[Capabilities.PROJECTNAME]: 'security.allowUnsafe.connectors',
|
|
275
|
+
[Capabilities.CONTAINERMODE]: functionConnector,
|
|
276
|
+
[Capabilities.SCRIPTING_ENABLE_MEMORY]: true,
|
|
277
|
+
[Capabilities.SECURITY_ALLOW_UNSAFE]: false
|
|
278
|
+
}
|
|
279
|
+
const driver = new BotDriver(myCapsFunction)
|
|
280
|
+
await driver.Build()
|
|
281
|
+
})
|
|
276
282
|
})
|
|
277
|
-
})
|
|
278
283
|
|
|
279
|
-
describe('media input', function () {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
describe('media input', function () {
|
|
285
|
+
it('should fail for downloadMedia global arg without baseDir', async function () {
|
|
286
|
+
const args = {
|
|
287
|
+
downloadMedia: true
|
|
288
|
+
}
|
|
284
289
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
290
|
+
const driver = new BotDriver(_getSimpleRestCaps({
|
|
291
|
+
[Capabilities.USER_INPUTS]: [
|
|
292
|
+
{
|
|
293
|
+
ref: 'MEDIA',
|
|
294
|
+
src: 'MediaInput',
|
|
295
|
+
args
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}))
|
|
299
|
+
const compiler = driver.BuildCompiler()
|
|
300
|
+
const container = await driver.Build()
|
|
301
|
+
await container.Start()
|
|
302
|
+
|
|
303
|
+
try {
|
|
304
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'media.convo.txt')
|
|
305
|
+
await compiler.convos[0].Run(container)
|
|
306
|
+
assert.fail('should have failed')
|
|
307
|
+
} catch (err) {
|
|
308
|
+
assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
|
|
309
|
+
}
|
|
310
|
+
await container && container.Clean()
|
|
311
|
+
})
|
|
307
312
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
it('should fail for downloadMedia global arg as file', async function () {
|
|
314
|
+
const args = {
|
|
315
|
+
downloadMedia: true
|
|
316
|
+
}
|
|
312
317
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
318
|
+
const driver = new BotDriver(_getSimpleRestCaps({
|
|
319
|
+
[Capabilities.USER_INPUTS]: [
|
|
320
|
+
{
|
|
321
|
+
ref: 'MEDIA',
|
|
322
|
+
src: 'MediaInput',
|
|
323
|
+
args
|
|
324
|
+
}
|
|
325
|
+
]
|
|
326
|
+
}))
|
|
327
|
+
const compiler = driver.BuildCompiler()
|
|
328
|
+
const container = await driver.Build()
|
|
329
|
+
await container.Start()
|
|
330
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediaasfile.convo.txt')
|
|
331
|
+
|
|
332
|
+
try {
|
|
333
|
+
await compiler.convos[0].Run(container)
|
|
334
|
+
assert.fail('should have failed')
|
|
335
|
+
} catch (err) {
|
|
336
|
+
assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
|
|
337
|
+
}
|
|
338
|
+
await container && container.Clean()
|
|
339
|
+
})
|
|
335
340
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
341
|
+
it('should fail for wildcard arg', async function () {
|
|
342
|
+
const driver = new BotDriver(_getSimpleRestCaps())
|
|
343
|
+
const compiler = driver.BuildCompiler()
|
|
344
|
+
const container = await driver.Build()
|
|
345
|
+
await container.Start()
|
|
346
|
+
compiler.ReadScript(path.resolve(__dirname, 'convos'), 'mediawildcard.convo.txt')
|
|
347
|
+
|
|
348
|
+
try {
|
|
349
|
+
compiler.ExpandConvos()
|
|
350
|
+
assert.fail('should have failed')
|
|
351
|
+
} catch (err) {
|
|
352
|
+
assert.isTrue(err.message.indexOf('Security Error. Using base dir global argument in MediaInput is required') >= 0)
|
|
353
|
+
}
|
|
354
|
+
await container && container.Clean()
|
|
355
|
+
})
|
|
350
356
|
})
|
|
351
357
|
})
|