botium-core 1.13.17 → 1.13.18
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/README.md +0 -1
- package/dist/botium-cjs.js +95 -15
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +95 -15
- package/dist/botium-es.js.map +1 -1
- package/package.json +1 -1
- package/src/BotDriver.js +2 -2
- package/src/Capabilities.js +6 -0
- package/src/containers/BaseContainer.js +7 -4
- package/src/containers/plugins/SimpleRestContainer.js +49 -0
- package/src/scripting/Convo.js +9 -0
- package/src/scripting/ScriptingProvider.js +19 -2
- package/src/scripting/logichook/asserter/ButtonsAsserter.js +21 -8
- package/src/scripting/logichook/logichooks/ClearQueueLogicHook.js +0 -1
- package/test/connectors/logicHook.js +0 -1
- package/test/connectors/simplerest.spec.js +79 -4
- package/test/scripting/asserters/buttonsAsserter.spec.js +84 -50
- package/test/scripting/logichooks/convos/custom_embedded_skip.convo.txt +11 -0
- package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_me.convo.txt +11 -0
- package/test/scripting/logichooks/convos/custom_embedded_skip_followed_by_nothing.convo.txt +8 -0
- package/test/scripting/logichooks/customEmbeddedSkip.json +14 -0
- package/test/scripting/logichooks/customEmbeddedSkip.spec.js +58 -0
|
@@ -0,0 +1,58 @@
|
|
|
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('./customEmbeddedSkip')
|
|
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.customassertersskip',
|
|
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 skip', 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 success followed by another bot message', async function () {
|
|
42
|
+
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip.convo.txt')
|
|
43
|
+
const transript = await this.compiler.convos[0].Run(this.container)
|
|
44
|
+
assert.equal(transript.steps.length, 2)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('should success followed by me message', async function () {
|
|
48
|
+
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip_followed_by_me.convo.txt')
|
|
49
|
+
const transript = await this.compiler.convos[0].Run(this.container)
|
|
50
|
+
assert.equal(transript.steps.length, 2)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('should success followed by nothing', async function () {
|
|
54
|
+
this.compiler.ReadScript(path.resolve(__dirname, 'convos'), 'custom_embedded_skip_followed_by_nothing.convo.txt')
|
|
55
|
+
const transript = await this.compiler.convos[0].Run(this.container)
|
|
56
|
+
assert.equal(transript.steps.length, 1)
|
|
57
|
+
})
|
|
58
|
+
})
|