botium-core 1.13.19 → 1.14.0
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 +298 -382
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +298 -380
- package/dist/botium-es.js.map +1 -1
- package/package.json +20 -25
- package/samples/extensions/asserterHooks/botium.json +1 -0
- package/samples/extensions/logichooks/botium.json +1 -0
- package/samples/extensions/logichooks/custom/MyAsserter.js +3 -3
- package/src/Capabilities.js +2 -1
- package/src/containers/PluginConnectorContainer.js +8 -0
- package/src/containers/plugins/SimpleRestContainer.js +17 -9
- package/src/containers/plugins/index.js +29 -41
- package/src/helpers/HookUtils.js +32 -68
- package/src/scripting/ScriptingMemory.js +0 -24
- package/src/scripting/logichook/LogicHookUtils.js +27 -47
- package/test/compiler/precompilerscript.spec.js +24 -26
- package/test/connectors/pluginconnectorcontainer.spec.js +60 -0
- package/test/connectors/simplerest.spec.js +24 -27
- package/test/convo/fillAndApplyScriptingMemory.spec.js +1 -47
- package/test/hooks/customhooks.spec.js +3 -25
- package/test/logichooks/hookfromsrc.spec.js +13 -3
- package/test/plugins/plugins.spec.js +29 -2
- package/test/security/allowUnsafe.spec.js +20 -129
- package/LICENSES-3RDPARTY.txt +0 -6450
- package/test/scripting/asserters/convos/customembeddedasserterwithhugo.convo.txt +0 -7
- package/test/scripting/asserters/convos/customembeddedasserterwithouthugo.convo.txt +0 -7
- package/test/scripting/asserters/customEmbeddedAsserter.json +0 -14
- package/test/scripting/asserters/customEmbeddedAsserter.spec.js +0 -55
- package/test/scripting/logichooks/convos/custom_embedded.convo.txt +0 -8
- package/test/scripting/logichooks/customEmbedded.json +0 -14
- package/test/scripting/logichooks/customEmbedded.spec.js +0 -44
- package/test/security/convos/withscriptingmemoryfunction.convo.txt +0 -5
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ASSERTERS": [
|
|
3
|
-
{
|
|
4
|
-
"ref": "MY-ASSERTER-NAME",
|
|
5
|
-
"src": {
|
|
6
|
-
"assertConvoStep": "if (botMsg.messageText !== 'Hello hugo') throw `expected hugo, got ${JSON.stringify(botMsg)}`"
|
|
7
|
-
},
|
|
8
|
-
"global": false,
|
|
9
|
-
"args": {
|
|
10
|
-
"my-arg-1": "something"
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
]
|
|
14
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const assert = require('chai').assert
|
|
3
|
-
const BotDriver = require('../../..').BotDriver
|
|
4
|
-
const Capabilities = require('../../..').Capabilities
|
|
5
|
-
const myCaps = require('./customEmbeddedAsserter')
|
|
6
|
-
|
|
7
|
-
const echoConnector = () => ({ queueBotSays }) => {
|
|
8
|
-
return {
|
|
9
|
-
UserSays (msg) {
|
|
10
|
-
const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
|
|
11
|
-
queueBotSays(botMsg)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const buildDriver = async (mergeCaps) => {
|
|
17
|
-
const myCaps = Object.assign({
|
|
18
|
-
[Capabilities.PROJECTNAME]: 'convo.customasserters',
|
|
19
|
-
[Capabilities.CONTAINERMODE]: echoConnector()
|
|
20
|
-
}, mergeCaps)
|
|
21
|
-
|
|
22
|
-
const result = {}
|
|
23
|
-
result.driver = new BotDriver(myCaps)
|
|
24
|
-
result.compiler = result.driver.BuildCompiler()
|
|
25
|
-
result.container = await result.driver.Build()
|
|
26
|
-
return result
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
describe('convo.customasserters', function () {
|
|
30
|
-
beforeEach(async function () {
|
|
31
|
-
const { compiler, container } = await buildDriver(myCaps)
|
|
32
|
-
this.compiler = compiler
|
|
33
|
-
this.container = container
|
|
34
|
-
await this.container.Start()
|
|
35
|
-
})
|
|
36
|
-
afterEach(async function () {
|
|
37
|
-
await this.container.Stop()
|
|
38
|
-
await this.container.Clean()
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it('should fail', async function () {
|
|
42
|
-
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'customembeddedasserterwithouthugo.convo.txt')
|
|
43
|
-
try {
|
|
44
|
-
await this.compiler.convos[0].Run(this.container)
|
|
45
|
-
} catch (err) {
|
|
46
|
-
assert.isTrue(err.message.indexOf('expected hugo') >= 0)
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
assert.fail('should have failed without retry')
|
|
50
|
-
})
|
|
51
|
-
it('should succeed', async function () {
|
|
52
|
-
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'customembeddedasserterwithhugo.convo.txt')
|
|
53
|
-
await this.compiler.convos[0].Run(this.container)
|
|
54
|
-
})
|
|
55
|
-
})
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
|
-
const BotDriver = require('../../..').BotDriver
|
|
3
|
-
const Capabilities = require('../../..').Capabilities
|
|
4
|
-
const myCaps = require('./customEmbedded')
|
|
5
|
-
|
|
6
|
-
const echoConnector = () => ({ queueBotSays }) => {
|
|
7
|
-
return {
|
|
8
|
-
UserSays (msg) {
|
|
9
|
-
const botMsg = { sender: 'bot', sourceData: msg.sourceData, messageText: msg.messageText }
|
|
10
|
-
queueBotSays(botMsg)
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const buildDriver = async (mergeCaps) => {
|
|
16
|
-
const myCaps = Object.assign({
|
|
17
|
-
[Capabilities.PROJECTNAME]: 'convo.customasserters',
|
|
18
|
-
[Capabilities.CONTAINERMODE]: echoConnector()
|
|
19
|
-
}, mergeCaps)
|
|
20
|
-
|
|
21
|
-
const result = {}
|
|
22
|
-
result.driver = new BotDriver(myCaps)
|
|
23
|
-
result.compiler = result.driver.BuildCompiler()
|
|
24
|
-
result.container = await result.driver.Build()
|
|
25
|
-
return result
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
describe('convo.customasserters', function () {
|
|
29
|
-
beforeEach(async function () {
|
|
30
|
-
const { compiler, container } = await buildDriver(myCaps)
|
|
31
|
-
this.compiler = compiler
|
|
32
|
-
this.container = container
|
|
33
|
-
await this.container.Start()
|
|
34
|
-
})
|
|
35
|
-
afterEach(async function () {
|
|
36
|
-
await this.container.Stop()
|
|
37
|
-
await this.container.Clean()
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('should success', async function () {
|
|
41
|
-
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded.convo.txt')
|
|
42
|
-
await this.compiler.convos[0].Run(this.container)
|
|
43
|
-
})
|
|
44
|
-
})
|