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.
Files changed (84) hide show
  1. package/dist/botium-cjs.js +91 -51
  2. package/dist/botium-cjs.js.map +1 -1
  3. package/dist/botium-es.js +91 -50
  4. package/dist/botium-es.js.map +1 -1
  5. package/package.json +35 -40
  6. package/src/BotDriver.js +1 -1
  7. package/src/Events.js +1 -3
  8. package/src/containers/GridContainer.js +0 -4
  9. package/src/mocks/BotiumMockScripting.js +3 -0
  10. package/src/scripting/Convo.js +10 -0
  11. package/src/utils/boolean.js +39 -0
  12. package/test/compiler/compilercsv.spec.js +34 -0
  13. package/test/compiler/compilermarkdown.spec.js +11 -0
  14. package/test/compiler/compilertxt.spec.js +21 -0
  15. package/test/compiler/compilerxlsx.spec.js +27 -0
  16. package/test/compiler/precompilerjson.spec.js +1 -0
  17. package/test/compiler/precompilermarkdownrasa.spec.js +1 -0
  18. package/test/connectors/pluginconnectorcontainer.spec.js +1 -0
  19. package/test/connectors/simplerest.spec.js +3 -1
  20. package/test/convo/failure.spec.js +1 -0
  21. package/test/convo/fillAndApplyScriptingMemory.spec.js +56 -0
  22. package/test/convo/partialconvo.spec.js +3 -0
  23. package/test/convo/retry.spec.js +9 -0
  24. package/test/convo/retryasserter.spec.js +9 -0
  25. package/test/convo/transcript.spec.js +33 -0
  26. package/test/convo/tree.spec.js +5 -0
  27. package/test/driver/capabilities.spec.js +16 -0
  28. package/test/helpers/capabilitiesutils.spec.js +8 -0
  29. package/test/helpers/transcriptutils.spec.js +1 -0
  30. package/test/hooks/customhooks.spec.js +3 -0
  31. package/test/logichooks/hookfromsrc.spec.js +3 -0
  32. package/test/logichooks/textfromhook.spec.js +1 -0
  33. package/test/plugins/plugins.spec.js +3 -0
  34. package/test/scripting/asserters/buttonsAsserter.spec.js +15 -0
  35. package/test/scripting/asserters/cardsAsserter.spec.js +12 -0
  36. package/test/scripting/asserters/convoStepParameters.spec.js +11 -0
  37. package/test/scripting/asserters/entitiesAsserter.spec.js +1 -0
  38. package/test/scripting/asserters/entityValuesAsserter.spec.js +7 -0
  39. package/test/scripting/asserters/formsAsserter.spec.js +10 -0
  40. package/test/scripting/asserters/intentAsserter.spec.js +4 -0
  41. package/test/scripting/asserters/intentUniqueAsserter.spec.js +2 -0
  42. package/test/scripting/asserters/jsonpathAsserter.spec.js +25 -0
  43. package/test/scripting/asserters/mediaAsserter.spec.js +20 -0
  44. package/test/scripting/asserters/responseLengthAsserter.spec.js +4 -0
  45. package/test/scripting/asserters/textAsserter.spec.js +1 -0
  46. package/test/scripting/asserters/textContainsAllAsserter.spec.js +1 -0
  47. package/test/scripting/asserters/textContainsAnyAsserter.spec.js +1 -0
  48. package/test/scripting/asserters/textEqualsAsserter.spec.js +1 -0
  49. package/test/scripting/asserters/textRegexpAllAsserter.spec.js +1 -0
  50. package/test/scripting/asserters/textRegexpAnyAsserter.spec.js +1 -0
  51. package/test/scripting/asserters/textWildcardAllAsserter.spec.js +1 -0
  52. package/test/scripting/asserters/textWildcardAnyAsserter.spec.js +1 -0
  53. package/test/scripting/asserters/textWildcardExactAllAsserter.spec.js +1 -0
  54. package/test/scripting/asserters/textWildcardExactAnyAsserter.spec.js +1 -0
  55. package/test/scripting/asserters/werAsserter.spec.js +6 -0
  56. package/test/scripting/logichooks/convos/scripting_memory_resolved_args.convo.txt +11 -0
  57. package/test/scripting/logichooks/customConditionalStepLogicHook.spec.js +2 -0
  58. package/test/scripting/logichooks/localvsglobal.spec.js +1 -0
  59. package/test/scripting/logichooks/pauseLogic.spec.js +4 -0
  60. package/test/scripting/logichooks/setClearScriptingMemory.spec.js +17 -0
  61. package/test/scripting/logichooks/updateCustom.spec.js +2 -0
  62. package/test/scripting/matching/matchingmode.spec.js +48 -0
  63. package/test/scripting/scriptingModificator.spec.js +1 -0
  64. package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +4 -0
  65. package/test/scripting/scriptingmemory/regexp.spec.js +1 -0
  66. package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +3 -0
  67. package/test/scripting/txt/decompile.spec.js +20 -0
  68. package/test/scripting/userinputs/buttonInputConvos.spec.js +1 -0
  69. package/test/scripting/userinputs/defaultUserInputs.spec.js +13 -0
  70. package/test/scripting/userinputs/mediaInputConvos.spec.js +10 -0
  71. package/test/scripting/utteranceexpansion/associateByIndex.spec.js +2 -0
  72. package/test/security/allowUnsafe.spec.js +5 -0
  73. package/test/utils.spec.js +2 -0
  74. package/samples/postman/Botium Agent Sample.postman_collection.json +0 -834
  75. package/samples/postman/README.md +0 -5
  76. package/samples/postman/botiumFluent.js +0 -37
  77. package/src/grid/agent/AgentWorker.js +0 -204
  78. package/src/grid/agent/agent.js +0 -96
  79. package/src/grid/agent/agentworkerpool.js +0 -58
  80. package/src/grid/agent/routes.js +0 -353
  81. package/src/grid/agent/swagger.json +0 -327
  82. package/src/grid/agent/swaggerDef.json +0 -8
  83. package/src/grid/agent/views/index.html +0 -39
  84. package/test/grid/agent/client.js +0 -65
@@ -1,353 +0,0 @@
1
- const express = require('express')
2
- const debug = require('debug')('botium-core-agent-routes')
3
-
4
- const router = express.Router()
5
- const workerpool = require('./agentworkerpool')
6
-
7
- /**
8
- * @swagger
9
- * definitions:
10
- * AgentStatus:
11
- * type: object
12
- * properties:
13
- * software:
14
- * type: string
15
- * version:
16
- * type: string
17
- * maxWorkers:
18
- * type: integer
19
- * currentWorkers:
20
- * type: integer
21
- * BotMessage:
22
- * type: object
23
- * properties:
24
- * messageText:
25
- * type: string
26
- * sender:
27
- * type: string
28
- * channel:
29
- * type: string
30
- * sourceData:
31
- * type: object
32
- * sourceAction:
33
- * type: string
34
- * KeyValues:
35
- * type: object
36
- * description: A generic list of Key/Value pairs
37
- * additionalProperties: true
38
- */
39
-
40
- /**
41
- * @swagger
42
- * /api/status:
43
- * get:
44
- * description: Returns Botium Agent Status
45
- * produces:
46
- * - application/json
47
- * responses:
48
- * 200:
49
- * description: AgentStatus
50
- * schema:
51
- * $ref: '#/definitions/AgentStatus'
52
- */
53
- router.get('/api/status', (req, res) => {
54
- res.json(workerpool.getStatus())
55
- })
56
-
57
- /**
58
- * @swagger
59
- * /api/build:
60
- * post:
61
- * description: Builds Botium driver for given capabilities, sources and envs in a separate worker slot
62
- * produces:
63
- * - application/json
64
- * parameters:
65
- * - name: driverParameters
66
- * description: Botium Driver parameters
67
- * in: body
68
- * required: true
69
- * schema:
70
- * properties:
71
- * Capabilities:
72
- * $ref: '#/definitions/KeyValues'
73
- * Sources:
74
- * $ref: '#/definitions/KeyValues'
75
- * Envs:
76
- * $ref: '#/definitions/KeyValues'
77
- * responses:
78
- * 200:
79
- * description: Botium worker slot
80
- * schema:
81
- * properties:
82
- * slot:
83
- * type: integer
84
- */
85
- router.post('/api/build', (req, res, next) => {
86
- workerpool.allocate()
87
- .then((worker) => {
88
- debug(`agent client connected, worker slot ${worker.args.slot}`)
89
- worker.Build(req.body.Capabilities, req.body.Sources, req.body.Envs)
90
- .then(() => {
91
- res.status(200).json({ slot: worker.args.slot })
92
- })
93
- .catch((err) => {
94
- workerpool.free(worker).catch(debug)
95
- next(err)
96
- })
97
- })
98
- .catch(next)
99
- })
100
-
101
- /**
102
- * @swagger
103
- * /api/start/{slot}:
104
- * post:
105
- * description: Starts Botium driver for given worker slot
106
- * produces:
107
- * - application/json
108
- * parameters:
109
- * - name: slot
110
- * description: Worker slot
111
- * in: path
112
- * required: true
113
- * type: integer
114
- * responses:
115
- * 200:
116
- * description: Botium driver started
117
- */
118
- router.post('/api/start/:slot', (req, res, next) => {
119
- workerpool.get(req.params.slot)
120
- .then((worker) => {
121
- worker.Start()
122
- .then(() => {
123
- res.status(200).send()
124
- })
125
- .catch(next)
126
- })
127
- .catch(next)
128
- })
129
-
130
- /**
131
- * @swagger
132
- * /api/usersays/{slot}:
133
- * post:
134
- * description: Sends user message to Botium driver for given worker slot
135
- * produces:
136
- * - application/json
137
- * parameters:
138
- * - name: slot
139
- * description: Worker slot
140
- * in: path
141
- * required: true
142
- * type: integer
143
- * - name: msg
144
- * description: User message
145
- * in: body
146
- * required: true
147
- * schema:
148
- * $ref: '#/definitions/BotMessage'
149
- * responses:
150
- * 200:
151
- * description: Message sent
152
- */
153
- router.post('/api/usersays/:slot', (req, res, next) => {
154
- workerpool.get(req.params.slot)
155
- .then((worker) => {
156
- worker.UserSays(req.body)
157
- .then(() => {
158
- res.status(200).send()
159
- })
160
- .catch(next)
161
- })
162
- .catch(next)
163
- })
164
-
165
- /**
166
- * @swagger
167
- * /api/botsays/{slot}:
168
- * post:
169
- * description: Retrieves bot message from Botium driver for given worker slot
170
- * produces:
171
- * - application/json
172
- * parameters:
173
- * - name: slot
174
- * description: Worker slot
175
- * in: path
176
- * required: true
177
- * type: integer
178
- * - name: args
179
- * description: Wait arguments
180
- * in: body
181
- * required: false
182
- * schema:
183
- * properties:
184
- * channel:
185
- * type: string
186
- * timeoutMillis:
187
- * type: integer
188
- * responses:
189
- * 200:
190
- * description: Message retrieved
191
- * schema:
192
- * $ref: '#/definitions/BotMessage'
193
- */
194
- router.post('/api/botsays/:slot', (req, res, next) => {
195
- workerpool.get(req.params.slot)
196
- .then((worker) => {
197
- worker.WaitBotSays(req.body.channel, req.body.timeoutMillis)
198
- .then((botMsg) => {
199
- res.status(200).json(botMsg || {})
200
- })
201
- .catch(next)
202
- })
203
- .catch(next)
204
- })
205
-
206
- /**
207
- * @swagger
208
- * /api/stop/{slot}:
209
- * post:
210
- * description: Stops Botium driver for given worker slot
211
- * produces:
212
- * - application/json
213
- * parameters:
214
- * - name: slot
215
- * description: Worker slot
216
- * in: path
217
- * required: true
218
- * type: integer
219
- * responses:
220
- * 200:
221
- * description: Botium driver stopped
222
- */
223
- router.post('/api/stop/:slot', (req, res, next) => {
224
- workerpool.get(req.params.slot)
225
- .then((worker) => {
226
- worker.Stop()
227
- .then(() => {
228
- res.status(200).send()
229
- })
230
- .catch(next)
231
- })
232
- .catch(next)
233
- })
234
-
235
- /**
236
- * @swagger
237
- * /api/runscript/{slot}:
238
- * post:
239
- * description: Run the Botium script for given worker slot, starting and stopping container as needed
240
- * produces:
241
- * - application/json
242
- * consumes:
243
- * - text/plain
244
- * parameters:
245
- * - name: slot
246
- * description: Worker slot
247
- * in: path
248
- * required: true
249
- * type: integer
250
- * - name: script
251
- * description: Botium script
252
- * in: body
253
- * required: true
254
- * schema:
255
- * type: string
256
- * responses:
257
- * 200:
258
- * description: Script successful
259
- */
260
- router.post('/api/runscript/:slot', (req, res, next) => {
261
- if (!req.body) return next(new Error('no script body given'))
262
-
263
- workerpool.get(req.params.slot)
264
- .then((worker) => {
265
- worker.Start()
266
- .then(() => worker.RunScript(req.body))
267
- .then(() => worker.Stop())
268
- .then(() => {
269
- res.status(200).send()
270
- })
271
- .catch((err) => {
272
- worker.Stop().then(() => next(err)).catch(next)
273
- })
274
- })
275
- .catch(next)
276
- })
277
-
278
- /**
279
- * @swagger
280
- * /api/runscript_body/{slot}:
281
- * post:
282
- * description: Run the Botium script for given worker slot, starting and stopping container as needed
283
- * produces:
284
- * - application/json
285
- * consumes:
286
- * - application/json
287
- * parameters:
288
- * - name: slot
289
- * description: Worker slot
290
- * in: path
291
- * required: true
292
- * type: integer
293
- * - name: args
294
- * description: Script arguments
295
- * in: body
296
- * required: true
297
- * schema:
298
- * properties:
299
- * script:
300
- * type: string
301
- * description: Botium script
302
- * responses:
303
- * 200:
304
- * description: Script successful
305
- */
306
- router.post('/api/runscript_body/:slot', (req, res, next) => {
307
- if (!req.body || !req.body.script) return next(new Error('no script parameter given'))
308
-
309
- workerpool.get(req.params.slot)
310
- .then((worker) => {
311
- worker.Start()
312
- .then(() => worker.RunScript(req.body.script))
313
- .then(() => worker.Stop())
314
- .then(() => {
315
- res.status(200).send()
316
- })
317
- .catch((err) => {
318
- worker.Stop().then(() => next(err)).catch(next)
319
- })
320
- })
321
- .catch(next)
322
- })
323
-
324
- /**
325
- * @swagger
326
- * /api/clean/{slot}:
327
- * post:
328
- * description: Cleans Botium driver for given worker slot and free worker slot
329
- * produces:
330
- * - application/json
331
- * parameters:
332
- * - name: slot
333
- * description: Worker slot
334
- * in: path
335
- * required: true
336
- * type: integer
337
- * responses:
338
- * 200:
339
- * description: Botium driver cleaned and worker slot available
340
- */
341
- router.post('/api/clean/:slot', (req, res, next) => {
342
- workerpool.get(req.params.slot)
343
- .then((worker) => {
344
- workerpool.free(worker)
345
- .then(() => {
346
- res.status(200).send()
347
- })
348
- .catch(next)
349
- })
350
- .catch(next)
351
- })
352
-
353
- module.exports = router
@@ -1,327 +0,0 @@
1
- {
2
- "info": {
3
- "title": "Botium Agent API",
4
- "version": "1.0.0",
5
- "description": "Botium Agent API to be used with Postman, Tosca or any other 3rd party test runner"
6
- },
7
- "basePath": "/",
8
- "swagger": "2.0",
9
- "paths": {
10
- "/api/status": {
11
- "get": {
12
- "description": "Returns Botium Agent Status",
13
- "produces": [
14
- "application/json"
15
- ],
16
- "responses": {
17
- "200": {
18
- "description": "AgentStatus",
19
- "schema": {
20
- "$ref": "#/definitions/AgentStatus"
21
- }
22
- }
23
- }
24
- }
25
- },
26
- "/api/build": {
27
- "post": {
28
- "description": "Builds Botium driver for given capabilities, sources and envs in a separate worker slot",
29
- "produces": [
30
- "application/json"
31
- ],
32
- "parameters": [
33
- {
34
- "name": "driverParameters",
35
- "description": "Botium Driver parameters",
36
- "in": "body",
37
- "required": true,
38
- "schema": {
39
- "properties": {
40
- "Capabilities": {
41
- "$ref": "#/definitions/KeyValues"
42
- },
43
- "Sources": {
44
- "$ref": "#/definitions/KeyValues"
45
- },
46
- "Envs": {
47
- "$ref": "#/definitions/KeyValues"
48
- }
49
- }
50
- }
51
- }
52
- ],
53
- "responses": {
54
- "200": {
55
- "description": "Botium worker slot",
56
- "schema": {
57
- "properties": {
58
- "slot": {
59
- "type": "integer"
60
- }
61
- }
62
- }
63
- }
64
- }
65
- }
66
- },
67
- "/api/start/{slot}": {
68
- "post": {
69
- "description": "Starts Botium driver for given worker slot",
70
- "produces": [
71
- "application/json"
72
- ],
73
- "parameters": [
74
- {
75
- "name": "slot",
76
- "description": "Worker slot",
77
- "in": "path",
78
- "required": true,
79
- "type": "integer"
80
- }
81
- ],
82
- "responses": {
83
- "200": {
84
- "description": "Botium driver started"
85
- }
86
- }
87
- }
88
- },
89
- "/api/usersays/{slot}": {
90
- "post": {
91
- "description": "Sends user message to Botium driver for given worker slot",
92
- "produces": [
93
- "application/json"
94
- ],
95
- "parameters": [
96
- {
97
- "name": "slot",
98
- "description": "Worker slot",
99
- "in": "path",
100
- "required": true,
101
- "type": "integer"
102
- },
103
- {
104
- "name": "msg",
105
- "description": "User message",
106
- "in": "body",
107
- "required": true,
108
- "schema": {
109
- "$ref": "#/definitions/BotMessage"
110
- }
111
- }
112
- ],
113
- "responses": {
114
- "200": {
115
- "description": "Message sent"
116
- }
117
- }
118
- }
119
- },
120
- "/api/botsays/{slot}": {
121
- "post": {
122
- "description": "Retrieves bot message from Botium driver for given worker slot",
123
- "produces": [
124
- "application/json"
125
- ],
126
- "parameters": [
127
- {
128
- "name": "slot",
129
- "description": "Worker slot",
130
- "in": "path",
131
- "required": true,
132
- "type": "integer"
133
- },
134
- {
135
- "name": "args",
136
- "description": "Wait arguments",
137
- "in": "body",
138
- "required": false,
139
- "schema": {
140
- "properties": {
141
- "channel": {
142
- "type": "string"
143
- },
144
- "timeoutMillis": {
145
- "type": "integer"
146
- }
147
- }
148
- }
149
- }
150
- ],
151
- "responses": {
152
- "200": {
153
- "description": "Message retrieved",
154
- "schema": {
155
- "$ref": "#/definitions/BotMessage"
156
- }
157
- }
158
- }
159
- }
160
- },
161
- "/api/stop/{slot}": {
162
- "post": {
163
- "description": "Stops Botium driver for given worker slot",
164
- "produces": [
165
- "application/json"
166
- ],
167
- "parameters": [
168
- {
169
- "name": "slot",
170
- "description": "Worker slot",
171
- "in": "path",
172
- "required": true,
173
- "type": "integer"
174
- }
175
- ],
176
- "responses": {
177
- "200": {
178
- "description": "Botium driver stopped"
179
- }
180
- }
181
- }
182
- },
183
- "/api/runscript/{slot}": {
184
- "post": {
185
- "description": "Run the Botium script for given worker slot, starting and stopping container as needed",
186
- "produces": [
187
- "application/json"
188
- ],
189
- "consumes": [
190
- "text/plain"
191
- ],
192
- "parameters": [
193
- {
194
- "name": "slot",
195
- "description": "Worker slot",
196
- "in": "path",
197
- "required": true,
198
- "type": "integer"
199
- },
200
- {
201
- "name": "script",
202
- "description": "Botium script",
203
- "in": "body",
204
- "required": true,
205
- "schema": {
206
- "type": "string"
207
- }
208
- }
209
- ],
210
- "responses": {
211
- "200": {
212
- "description": "Script successful"
213
- }
214
- }
215
- }
216
- },
217
- "/api/runscript_body/{slot}": {
218
- "post": {
219
- "description": "Run the Botium script for given worker slot, starting and stopping container as needed",
220
- "produces": [
221
- "application/json"
222
- ],
223
- "consumes": [
224
- "application/json"
225
- ],
226
- "parameters": [
227
- {
228
- "name": "slot",
229
- "description": "Worker slot",
230
- "in": "path",
231
- "required": true,
232
- "type": "integer"
233
- },
234
- {
235
- "name": "args",
236
- "description": "Script arguments",
237
- "in": "body",
238
- "required": true,
239
- "schema": {
240
- "properties": {
241
- "script": {
242
- "type": "string",
243
- "description": "Botium script"
244
- }
245
- }
246
- }
247
- }
248
- ],
249
- "responses": {
250
- "200": {
251
- "description": "Script successful"
252
- }
253
- }
254
- }
255
- },
256
- "/api/clean/{slot}": {
257
- "post": {
258
- "description": "Cleans Botium driver for given worker slot and free worker slot",
259
- "produces": [
260
- "application/json"
261
- ],
262
- "parameters": [
263
- {
264
- "name": "slot",
265
- "description": "Worker slot",
266
- "in": "path",
267
- "required": true,
268
- "type": "integer"
269
- }
270
- ],
271
- "responses": {
272
- "200": {
273
- "description": "Botium driver cleaned and worker slot available"
274
- }
275
- }
276
- }
277
- }
278
- },
279
- "definitions": {
280
- "AgentStatus": {
281
- "type": "object",
282
- "properties": {
283
- "software": {
284
- "type": "string"
285
- },
286
- "version": {
287
- "type": "string"
288
- },
289
- "maxWorkers": {
290
- "type": "integer"
291
- },
292
- "currentWorkers": {
293
- "type": "integer"
294
- }
295
- }
296
- },
297
- "BotMessage": {
298
- "type": "object",
299
- "properties": {
300
- "messageText": {
301
- "type": "string"
302
- },
303
- "sender": {
304
- "type": "string"
305
- },
306
- "channel": {
307
- "type": "string"
308
- },
309
- "sourceData": {
310
- "type": "object"
311
- },
312
- "sourceAction": {
313
- "type": "string"
314
- }
315
- }
316
- },
317
- "KeyValues": {
318
- "type": "object",
319
- "description": "A generic list of Key/Value pairs",
320
- "additionalProperties": true
321
- }
322
- },
323
- "responses": {},
324
- "parameters": {},
325
- "securityDefinitions": {},
326
- "tags": []
327
- }
@@ -1,8 +0,0 @@
1
- {
2
- "info": {
3
- "title": "Botium Agent API",
4
- "version": "1.0.0",
5
- "description": "Botium Agent API to be used with Postman, Tosca or any other 3rd party test runner"
6
- },
7
- "basePath": "/"
8
- }