botium-core 1.13.12 → 1.13.15

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 (48) hide show
  1. package/dist/botium-cjs.js +109 -57
  2. package/dist/botium-cjs.js.map +1 -1
  3. package/dist/botium-es.js +95 -44
  4. package/dist/botium-es.js.map +1 -1
  5. package/index.js +15 -9
  6. package/package.json +1 -1
  7. package/report.js +6 -5
  8. package/src/Capabilities.js +4 -0
  9. package/src/containers/plugins/SimpleRestContainer.js +50 -22
  10. package/src/helpers/TranscriptUtils.js +12 -0
  11. package/test/compiler/compilermarkdown.spec.js +11 -11
  12. package/test/compiler/compilertxt.spec.js +11 -11
  13. package/test/compiler/compilerxlsx.spec.js +10 -10
  14. package/test/connectors/simplerest.spec.js +53 -4
  15. package/test/helpers/convos/hello.convo.txt +6 -0
  16. package/test/helpers/transcriptutils.spec.js +71 -0
  17. /package/test/compiler/convos/md/{convos_with!.md → convos_with_exclamation.md} +0 -0
  18. /package/test/compiler/convos/md/{convos_with!_secline.md → convos_with_exclamation_secline.md} +0 -0
  19. /package/test/compiler/convos/md/{convos_with!!!!.md → convos_with_four_exclamation.md} +0 -0
  20. /package/test/compiler/convos/md/{convos_with????.md → convos_with_four_question.md} +0 -0
  21. /package/test/compiler/convos/md/{convos_with?.md → convos_with_question.md} +0 -0
  22. /package/test/compiler/convos/md/{convos_with?!.md → convos_with_question_exclamation.md} +0 -0
  23. /package/test/compiler/convos/md/{convos_with?_invalid.md → convos_with_question_invalid.md} +0 -0
  24. /package/test/compiler/convos/md/{convos_with?_secline.md → convos_with_question_secline.md} +0 -0
  25. /package/test/compiler/convos/md/{convos_with!!.md → convos_with_two_exclamation.md} +0 -0
  26. /package/test/compiler/convos/md/{convos_with??.md → convos_with_two_question.md} +0 -0
  27. /package/test/compiler/convos/md/{convos_with??!.md → convos_with_two_question_exclamation.md} +0 -0
  28. /package/test/compiler/convos/txt/{convos_with!.convo.txt → convos_with_exclamation.convo.txt} +0 -0
  29. /package/test/compiler/convos/txt/{convos_with!_secline.convo.txt → convos_with_exclamation_secline.convo.txt} +0 -0
  30. /package/test/compiler/convos/txt/{convos_with!!!!.convo.txt → convos_with_four_exclamation.convo.txt} +0 -0
  31. /package/test/compiler/convos/txt/{convos_with????.convo.txt → convos_with_four_question.convo.txt} +0 -0
  32. /package/test/compiler/convos/txt/{convos_with_#.convo.txt → convos_with_hashmark.convo.txt} +0 -0
  33. /package/test/compiler/convos/txt/{convos_with?.convo.txt → convos_with_question.convo.txt} +0 -0
  34. /package/test/compiler/convos/txt/{convos_with?!.convo.txt → convos_with_question_exclamation.convo.txt} +0 -0
  35. /package/test/compiler/convos/txt/{convos_with?_secline.convo.txt → convos_with_question_secline.convo.txt} +0 -0
  36. /package/test/compiler/convos/txt/{convos_with!!.convo.txt → convos_with_two_exclamation.convo.txt} +0 -0
  37. /package/test/compiler/convos/txt/{convos_with??.convo.txt → convos_with_two_question.convo.txt} +0 -0
  38. /package/test/compiler/convos/txt/{convos_with??!.convo.txt → convos_with_two_question_exclamation.convo.txt} +0 -0
  39. /package/test/compiler/convos/xlsx/{convos_with!.xlsx → convos_with_exclamation.xlsx} +0 -0
  40. /package/test/compiler/convos/xlsx/{convos_with!_secline.xlsx → convos_with_exclamation_secline.xlsx} +0 -0
  41. /package/test/compiler/convos/xlsx/{convos_with!!!!.xlsx → convos_with_four_exclamation.xlsx} +0 -0
  42. /package/test/compiler/convos/xlsx/{convos_with????.xlsx → convos_with_four_question.xlsx} +0 -0
  43. /package/test/compiler/convos/xlsx/{convos_with?.xlsx → convos_with_question.xlsx} +0 -0
  44. /package/test/compiler/convos/xlsx/{convos_with?!.xlsx → convos_with_question_exclamation.xlsx} +0 -0
  45. /package/test/compiler/convos/xlsx/{convos_with?_secline.xlsx → convos_with_question_secline.xlsx} +0 -0
  46. /package/test/compiler/convos/xlsx/{convos_with!!.xlsx → convos_with_two_exclamation.xlsx} +0 -0
  47. /package/test/compiler/convos/xlsx/{convos_with??.xlsx → convos_with_two_question.xlsx} +0 -0
  48. /package/test/compiler/convos/xlsx/{convos_with??!.xlsx → convos_with_two_question_exclamation.xlsx} +0 -0
@@ -0,0 +1,71 @@
1
+ const path = require('path')
2
+ const assert = require('chai').assert
3
+ const BotDriver = require('../../').BotDriver
4
+ const Capabilities = require('../../').Capabilities
5
+ const TranscriptUtils = require('../../').TranscriptUtils
6
+ const debug = require('debug')('botium-test-transcriptutils')
7
+ const util = require('util')
8
+
9
+ const createEchoConnector = () => ({ queueBotSays, caps }) => {
10
+ return {
11
+ UserSays (msg) {
12
+ const prefix = `Testcase "${caps[Capabilities.PROJECTNAME]}"`
13
+ debug(`${prefix} Connector got message ${util.inspect(msg)}`)
14
+ const botMsg = {
15
+ sender: 'bot',
16
+ sourceData: msg.sourceData,
17
+ messageText: msg.messageText
18
+ }
19
+ setTimeout(() => {
20
+ debug(`${prefix} Connector send message ${util.inspect(botMsg)}`)
21
+ return queueBotSays(botMsg)
22
+ }, caps.WAITECHO)
23
+ }
24
+ }
25
+ }
26
+
27
+ describe('helpers.transcriptutils', function () {
28
+ describe('hasTimeout', function () {
29
+ it('should return true ontimeout', async function () {
30
+ const myCaps = {
31
+ [Capabilities.PROJECTNAME]: 'helpers.transcriptutils.hasTimeout should should return true ontimeout',
32
+ [Capabilities.CONTAINERMODE]: createEchoConnector(),
33
+ [Capabilities.WAITFORBOTTIMEOUT]: 0,
34
+ WAITECHO: 20
35
+ }
36
+ const driver = new BotDriver(myCaps)
37
+ const compiler = driver.BuildCompiler()
38
+ const container = await driver.Build()
39
+
40
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'hello.convo.txt')
41
+ assert.equal(compiler.convos.length, 1)
42
+
43
+ try {
44
+ await compiler.convos[0].Run(container)
45
+ assert.fail('should have failed with timeout')
46
+ } catch (err) {
47
+ if (!TranscriptUtils.hasWaitForBotTimeout(err)) {
48
+ throw err
49
+ }
50
+ }
51
+ await container.Clean()
52
+ })
53
+ it('should return false if there is no timeout', async function () {
54
+ const myCaps = {
55
+ [Capabilities.PROJECTNAME]: 'helpers.transcriptutils.hasTimeout should return false if there is no timeout',
56
+ [Capabilities.CONTAINERMODE]: createEchoConnector(),
57
+ [Capabilities.WAITFORBOTTIMEOUT]: 50,
58
+ WAITECHO: 20
59
+ }
60
+ const driver = new BotDriver(myCaps)
61
+ const compiler = driver.BuildCompiler()
62
+ const container = await driver.Build()
63
+
64
+ compiler.ReadScript(path.resolve(__dirname, 'convos'), 'hello.convo.txt')
65
+ assert.equal(compiler.convos.length, 1)
66
+
67
+ await compiler.convos[0].Run(container)
68
+ await container.Clean()
69
+ })
70
+ })
71
+ })