botium-core 1.13.2 → 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.
Files changed (54) hide show
  1. package/.eslintrc.js +6 -3
  2. package/dist/botium-cjs.js +214 -61
  3. package/dist/botium-cjs.js.map +1 -1
  4. package/dist/botium-es.js +213 -61
  5. package/dist/botium-es.js.map +1 -1
  6. package/package.json +3 -1
  7. package/src/Capabilities.js +2 -1
  8. package/src/containers/plugins/SimpleRestContainer.js +20 -16
  9. package/src/grid/inbound/proxy.js +2 -1
  10. package/src/scripting/Convo.js +16 -10
  11. package/src/scripting/MatchFunctions.js +10 -0
  12. package/src/scripting/ScriptingProvider.js +106 -37
  13. package/src/scripting/logichook/LogicHookConsts.js +1 -1
  14. package/src/scripting/logichook/asserter/WerAsserter.js +59 -0
  15. package/src/scripting/logichook/logichooks/UpdateCustomLogicHook.js +3 -2
  16. package/test/compiler/compilercsv.spec.js +104 -3
  17. package/test/compiler/compilerjson.spec.js +0 -2
  18. package/test/compiler/compilerxlsx.spec.js +1 -1
  19. package/test/compiler/convos/csv/utterances_liveperson2.csv +12 -0
  20. package/test/connectors/simplerest.spec.js +1012 -969
  21. package/test/convo/fillAndApplyScriptingMemory.spec.js +804 -785
  22. package/test/convo/partialconvo.spec.js +345 -339
  23. package/test/driver/capabilities.spec.js +156 -151
  24. package/test/logichooks/hookfromsrc.spec.js +79 -73
  25. package/test/plugins/plugins.spec.js +44 -42
  26. package/test/scripting/asserters/buttonsAsserter.spec.js +257 -240
  27. package/test/scripting/asserters/cardsAsserter.spec.js +214 -212
  28. package/test/scripting/asserters/convos/wer_threshold_nok.yml +7 -0
  29. package/test/scripting/asserters/convos/wer_threshold_ok.yml +7 -0
  30. package/test/scripting/asserters/intentConfidenceAsserter.spec.js +34 -35
  31. package/test/scripting/asserters/jsonpathAsserter.spec.js +307 -308
  32. package/test/scripting/asserters/mediaAsserter.spec.js +236 -234
  33. package/test/scripting/asserters/werAsserter.spec.js +51 -0
  34. package/test/scripting/logichooks/setClearScriptingMemory.spec.js +202 -192
  35. package/test/scripting/matching/matchingmode.spec.js +306 -258
  36. package/test/scripting/scriptingProvider.spec.js +666 -633
  37. package/test/scripting/scriptingmemory/fillScriptingMemoryFromFile.spec.js +299 -281
  38. package/test/scripting/scriptingmemory/useScriptingMemoryForAssertion.spec.js +94 -80
  39. package/test/scripting/userinputs/defaultUserInputs.spec.js +233 -127
  40. package/test/scripting/userinputs/mediaInputConvos.spec.js +409 -403
  41. package/test/scripting/utteranceexpansion/associateByIndex.spec.js +259 -0
  42. package/test/scripting/utteranceexpansion/convos/associate_utterances_by_index.json +33 -0
  43. package/test/scripting/utteranceexpansion/convos/media.convo.txt +19 -0
  44. package/test/scripting/utteranceexpansion/files/step0voice0.wav +0 -0
  45. package/test/scripting/utteranceexpansion/files/step0voice1.wav +0 -0
  46. package/test/scripting/utteranceexpansion/files/step0voice2.wav +0 -0
  47. package/test/scripting/utteranceexpansion/files/step1voice0.wav +0 -0
  48. package/test/scripting/utteranceexpansion/files/step2voice0.wav +0 -0
  49. package/test/scripting/utteranceexpansion/files/step2voice1.wav +0 -0
  50. package/test/scripting/utteranceexpansion/files/step2voice2.wav +0 -0
  51. package/test/scripting/utteranceexpansion/files/step2voice4.wav +0 -0
  52. package/test/scripting/utteranceexpansion/files/step2voice5.wav +0 -0
  53. package/test/security/allowUnsafe.spec.js +274 -268
  54. package/test/utils.spec.js +40 -38
@@ -4,104 +4,91 @@ const ButtonsCountAsserter = require('../../../src/scripting/logichook/asserter/
4
4
  const ButtonsCountRecAsserter = require('../../../src/scripting/logichook/asserter/ButtonsCountRecAsserter')
5
5
 
6
6
  describe('scripting.asserters.buttonsAsserter', function () {
7
- beforeEach(async function () {
8
- this.buttonsAsserter = new ButtonsAsserter({
9
- Match: (botresponse, utterance) => botresponse.toLowerCase().indexOf(utterance.toLowerCase()) >= 0
10
- }, {})
11
- })
12
-
13
- it('should succeed on existing button', async function () {
14
- await this.buttonsAsserter.assertConvoStep({
15
- convoStep: { stepTag: 'test' },
16
- args: ['test'],
17
- botMsg: {
18
- buttons: [
19
- {
20
- text: 'test'
21
- }
22
- ]
23
- }
7
+ describe('buttonsAsserter', function () {
8
+ beforeEach(async function () {
9
+ this.buttonsAsserter = new ButtonsAsserter({
10
+ Match: (botresponse, utterance) => botresponse.toLowerCase().indexOf(utterance.toLowerCase()) >= 0
11
+ }, {})
24
12
  })
25
- })
26
- it('should succeed on existing card button', async function () {
27
- await this.buttonsAsserter.assertConvoStep({
28
- convoStep: { stepTag: 'test' },
29
- args: ['test'],
30
- botMsg: {
31
- cards: [
32
- {
33
- buttons: [
34
- {
35
- text: 'test'
36
- }
37
- ]
38
- }
39
- ]
40
- }
13
+
14
+ it('should succeed on existing button', async function () {
15
+ await this.buttonsAsserter.assertConvoStep({
16
+ convoStep: { stepTag: 'test' },
17
+ args: ['test'],
18
+ botMsg: {
19
+ buttons: [
20
+ {
21
+ text: 'test'
22
+ }
23
+ ]
24
+ }
25
+ })
41
26
  })
42
- })
43
- it('should succeed on existing card buttons', async function () {
44
- await this.buttonsAsserter.assertConvoStep({
45
- convoStep: { stepTag: 'test' },
46
- args: ['test', 'test1'],
47
- botMsg: {
48
- buttons: [
49
- {
50
- text: 'test'
51
- }
52
- ],
53
- cards: [
54
- {
55
- buttons: [
56
- {
57
- text: 'test1'
58
- }
59
- ]
60
- }
61
- ]
62
- }
27
+ it('should succeed on existing card button', async function () {
28
+ await this.buttonsAsserter.assertConvoStep({
29
+ convoStep: { stepTag: 'test' },
30
+ args: ['test'],
31
+ botMsg: {
32
+ cards: [
33
+ {
34
+ buttons: [
35
+ {
36
+ text: 'test'
37
+ }
38
+ ]
39
+ }
40
+ ]
41
+ }
42
+ })
63
43
  })
64
- })
65
- it('should succeed on existing card buttons', async function () {
66
- await this.buttonsAsserter.assertConvoStep({
67
- convoStep: { stepTag: 'test' },
68
- args: ['test', 'test1'],
69
- botMsg: {
70
- buttons: [
71
- {
72
- text: 'test'
73
- }
74
- ],
75
- cards: [
76
- {
77
- buttons: [
78
- {
79
- text: 'test1'
80
- }
81
- ]
82
- }
83
- ]
84
- }
44
+ it('should succeed on existing card buttons', async function () {
45
+ await this.buttonsAsserter.assertConvoStep({
46
+ convoStep: { stepTag: 'test' },
47
+ args: ['test', 'test1'],
48
+ botMsg: {
49
+ buttons: [
50
+ {
51
+ text: 'test'
52
+ }
53
+ ],
54
+ cards: [
55
+ {
56
+ buttons: [
57
+ {
58
+ text: 'test1'
59
+ }
60
+ ]
61
+ }
62
+ ]
63
+ }
64
+ })
85
65
  })
86
- })
87
- it('should succeed on not existing button', async function () {
88
- await this.buttonsAsserter.assertNotConvoStep({
89
- convoStep: { stepTag: 'test' },
90
- args: ['test1'],
91
- botMsg: {
92
- buttons: [
93
- {
94
- text: 'test'
95
- }
96
- ]
97
- }
66
+ it('should succeed on existing card buttons 2', async function () {
67
+ await this.buttonsAsserter.assertConvoStep({
68
+ convoStep: { stepTag: 'test' },
69
+ args: ['test', 'test1'],
70
+ botMsg: {
71
+ buttons: [
72
+ {
73
+ text: 'test'
74
+ }
75
+ ],
76
+ cards: [
77
+ {
78
+ buttons: [
79
+ {
80
+ text: 'test1'
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ }
86
+ })
98
87
  })
99
- })
100
- it('should fail on unexpected button', async function () {
101
- try {
88
+ it('should succeed on not existing button', async function () {
102
89
  await this.buttonsAsserter.assertNotConvoStep({
103
90
  convoStep: { stepTag: 'test' },
104
- args: ['test', 'test1'],
91
+ args: ['test1'],
105
92
  botMsg: {
106
93
  buttons: [
107
94
  {
@@ -110,51 +97,34 @@ describe('scripting.asserters.buttonsAsserter', function () {
110
97
  ]
111
98
  }
112
99
  })
113
- assert.fail('should have failed')
114
- } catch (err) {
115
- assert.isTrue(err.message.indexOf('Not expected button(s) with text "test"') > 0)
116
- assert.isNotNull(err.context)
117
- assert.isNotNull(err.context.cause)
118
- assert.isArray(err.context.cause.expected)
119
- assert.isTrue(err.context.cause.not)
120
- assert.deepEqual(err.context.cause.expected, ['test', 'test1'])
121
- assert.deepEqual(err.context.cause.actual, ['test'])
122
- assert.deepEqual(err.context.cause.diff, ['test'])
123
- }
124
- })
125
- it('should succeed on existing button if has no arg', async function () {
126
- await this.buttonsAsserter.assertConvoStep({
127
- convoStep: { stepTag: 'test' },
128
- args: [],
129
- botMsg: {
130
- buttons: [
131
- {
132
- text: 'test'
100
+ })
101
+ it('should fail on unexpected button', async function () {
102
+ try {
103
+ await this.buttonsAsserter.assertNotConvoStep({
104
+ convoStep: { stepTag: 'test' },
105
+ args: ['test', 'test1'],
106
+ botMsg: {
107
+ buttons: [
108
+ {
109
+ text: 'test'
110
+ }
111
+ ]
133
112
  }
134
- ]
113
+ })
114
+ assert.fail('should have failed')
115
+ } catch (err) {
116
+ assert.isTrue(err.message.indexOf('Not expected button(s) with text "test"') > 0)
117
+ assert.isNotNull(err.context)
118
+ assert.isNotNull(err.context.cause)
119
+ assert.isArray(err.context.cause.expected)
120
+ assert.isTrue(err.context.cause.not)
121
+ assert.deepEqual(err.context.cause.expected, ['test', 'test1'])
122
+ assert.deepEqual(err.context.cause.actual, ['test'])
123
+ assert.deepEqual(err.context.cause.diff, ['test'])
135
124
  }
136
125
  })
137
- })
138
- it('should fail on no button if has no arg', async function () {
139
- try {
140
- await this.buttonsAsserter.assertConvoStep({ convoStep: { stepTag: 'test' } })
141
- assert.fail('should have failed')
142
- } catch (err) {
143
- assert.isTrue(err.message.indexOf('Expected some button(s)') > 0)
144
- assert.isNotNull(err.context)
145
- assert.isNotNull(err.context.cause)
146
- assert.isArray(err.context.cause.expected)
147
- assert.isNotTrue(err.context.cause.not)
148
- assert.deepEqual(err.context.cause.expected, [])
149
- assert.deepEqual(err.context.cause.actual, [])
150
- }
151
- })
152
- it('should succeed on not existing button if has no arg and negated', async function () {
153
- await this.buttonsAsserter.assertNotConvoStep({ convoStep: { stepTag: 'test' } })
154
- })
155
- it('should fail on button if has no arg and negated', async function () {
156
- try {
157
- await this.buttonsAsserter.assertNotConvoStep({
126
+ it('should succeed on existing button if has no arg', async function () {
127
+ await this.buttonsAsserter.assertConvoStep({
158
128
  convoStep: { stepTag: 'test' },
159
129
  args: [],
160
130
  botMsg: {
@@ -165,131 +135,162 @@ describe('scripting.asserters.buttonsAsserter', function () {
165
135
  ]
166
136
  }
167
137
  })
168
- assert.fail('should have failed')
169
- } catch (err) {
170
- assert.isTrue(err.message.indexOf('Not expected button(s) with text "test"') > 0)
171
- assert.isNotNull(err.context)
172
- assert.isNotNull(err.context.cause)
173
- assert.isArray(err.context.cause.expected)
174
- assert.isTrue(err.context.cause.not)
175
- assert.deepEqual(err.context.cause.expected, [])
176
- assert.deepEqual(err.context.cause.actual, ['test'])
177
- }
178
- })
179
- })
180
- describe('scripting.asserters.buttonsCountAsserter', function () {
181
- beforeEach(async function () {
182
- this.buttonsCountAsserter = new ButtonsCountAsserter({}, {})
183
- this.buttonsCountRecAsserter = new ButtonsCountRecAsserter({}, {})
184
- })
185
-
186
- it('should succeed on no args with one button', async function () {
187
- await this.buttonsCountAsserter.assertConvoStep({
188
- convoStep: { stepTag: 'test' },
189
- args: [],
190
- botMsg: {
191
- buttons: [{ text: 'test.jpg' }]
138
+ })
139
+ it('should fail on no button if has no arg', async function () {
140
+ try {
141
+ await this.buttonsAsserter.assertConvoStep({ convoStep: { stepTag: 'test' } })
142
+ assert.fail('should have failed')
143
+ } catch (err) {
144
+ assert.isTrue(err.message.indexOf('Expected some button(s)') > 0)
145
+ assert.isNotNull(err.context)
146
+ assert.isNotNull(err.context.cause)
147
+ assert.isArray(err.context.cause.expected)
148
+ assert.isNotTrue(err.context.cause.not)
149
+ assert.deepEqual(err.context.cause.expected, [])
150
+ assert.deepEqual(err.context.cause.actual, [])
192
151
  }
193
152
  })
194
- })
195
- it('should succeed on 3 with 3 buttons', async function () {
196
- await this.buttonsCountAsserter.assertConvoStep({
197
- convoStep: { stepTag: 'test' },
198
- args: ['3'],
199
- botMsg: {
200
- buttons: [{ text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }],
201
- cards: [
202
- { buttons: [{ text: 'test.jpg' }], cards: [{ buttons: [{ text: 'test.jpg' }] }] }
203
- ]
153
+ it('should succeed on not existing button if has no arg and negated', async function () {
154
+ await this.buttonsAsserter.assertNotConvoStep({ convoStep: { stepTag: 'test' } })
155
+ })
156
+ it('should fail on button if has no arg and negated', async function () {
157
+ try {
158
+ await this.buttonsAsserter.assertNotConvoStep({
159
+ convoStep: { stepTag: 'test' },
160
+ args: [],
161
+ botMsg: {
162
+ buttons: [
163
+ {
164
+ text: 'test'
165
+ }
166
+ ]
167
+ }
168
+ })
169
+ assert.fail('should have failed')
170
+ } catch (err) {
171
+ assert.isTrue(err.message.indexOf('Not expected button(s) with text "test"') > 0)
172
+ assert.isNotNull(err.context)
173
+ assert.isNotNull(err.context.cause)
174
+ assert.isArray(err.context.cause.expected)
175
+ assert.isTrue(err.context.cause.not)
176
+ assert.deepEqual(err.context.cause.expected, [])
177
+ assert.deepEqual(err.context.cause.actual, ['test'])
204
178
  }
205
179
  })
206
180
  })
207
- it('should fail on 3 with 4 buttons', async function () {
208
- try {
181
+ describe('buttonsCountAsserter', function () {
182
+ beforeEach(async function () {
183
+ this.buttonsCountAsserter = new ButtonsCountAsserter({}, {})
184
+ this.buttonsCountRecAsserter = new ButtonsCountRecAsserter({}, {})
185
+ })
186
+
187
+ it('should succeed on no args with one button', async function () {
209
188
  await this.buttonsCountAsserter.assertConvoStep({
210
189
  convoStep: { stepTag: 'test' },
211
- args: ['3'],
190
+ args: [],
212
191
  botMsg: {
213
- buttons: [{ text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }],
214
- cards: [
215
- { buttons: [{ text: 'test.jpg' }], cards: [{ buttons: [{ text: 'test.jpg' }] }] }
216
- ]
192
+ buttons: [{ text: 'test.jpg' }]
217
193
  }
218
194
  })
219
- assert.fail('should have failed')
220
- } catch (err) {
221
- assert.isTrue(err.message.indexOf('Expected Buttons count 4 to be 3') >= 0)
222
- }
223
- })
224
- it('should fail on >3 with 3 buttons', async function () {
225
- try {
195
+ })
196
+ it('should succeed on 3 with 3 buttons', async function () {
226
197
  await this.buttonsCountAsserter.assertConvoStep({
227
198
  convoStep: { stepTag: 'test' },
228
- args: ['>3'],
199
+ args: ['3'],
229
200
  botMsg: {
230
201
  buttons: [{ text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }],
231
202
  cards: [
232
- { buttons: [{ text: 'test.jpg' }], cards: [{ buttons: [{ text: 'test.jpg' }] }] }
203
+ {
204
+ buttons: [{ text: 'test.jpg' }],
205
+ cards: [{ buttons: [{ text: 'test.jpg' }] }]
206
+ }
233
207
  ]
234
208
  }
235
209
  })
236
- assert.fail('should have failed')
237
- } catch (err) {
238
- assert.isTrue(err.message.indexOf('Expected Buttons count 3 to be >3') >= 0)
239
- }
240
- })
241
- it('should succeed on >=3 with rec buttons', async function () {
242
- await this.buttonsCountRecAsserter.assertConvoStep({
243
- convoStep: { stepTag: 'test' },
244
- args: ['>=3'],
245
- botMsg: {
246
- buttons: [{ text: 'test.jpg' }],
247
- cards: [
248
- { buttons: [{ text: 'test.jpg' }], cards: [{ buttons: [{ text: 'test.jpg' }] }] }
249
- ]
250
- }
251
210
  })
252
- })
253
- it('should succeed on 3 with rec buttons', async function () {
254
- await this.buttonsCountRecAsserter.assertConvoStep({
255
- convoStep: { stepTag: 'test' },
256
- args: ['3'],
257
- botMsg: {
258
- buttons: [{ text: 'test.jpg' }],
259
- cards: [
260
- { buttons: [{ text: 'test.jpg' }], cards: [{ buttons: [{ text: 'test.jpg' }] }] }
261
- ]
211
+ it('should fail on 3 with 4 buttons', async function () {
212
+ try {
213
+ await this.buttonsCountAsserter.assertConvoStep({
214
+ convoStep: { stepTag: 'test' },
215
+ args: ['3'],
216
+ botMsg: {
217
+ buttons: [{ text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }],
218
+ cards: [
219
+ {
220
+ buttons: [{ text: 'test.jpg' }],
221
+ cards: [{ buttons: [{ text: 'test.jpg' }] }]
222
+ }
223
+ ]
224
+ }
225
+ })
226
+ assert.fail('should have failed')
227
+ } catch (err) {
228
+ assert.isTrue(err.message.indexOf('Expected Buttons count 4 to be 3') >= 0)
262
229
  }
263
230
  })
264
- })
265
- })
266
-
267
- describe('scripting.asserters.buttonsNormalizeAsserter', function () {
268
- beforeEach(async function () {
269
- this.cardsAsserter = new ButtonsAsserter({
270
- Match: (botresponse, utterance) => botresponse.toLowerCase().indexOf(utterance.toLowerCase()) >= 0
271
- }, { SCRIPTING_NORMALIZE_TEXT: true })
272
- })
273
-
274
- it('should succeed with normalized text', async function () {
275
- await this.cardsAsserter.assertConvoStep({
276
- convoStep: { stepTag: 'test' },
277
- args: ['Test Html header test html text'],
278
- botMsg: {
279
- buttons: [
280
- {
281
- text: '<html><h1>test html header</h1><p>test html text</p>'
231
+ it('should fail on >3 with 3 buttons', async function () {
232
+ try {
233
+ await this.buttonsCountAsserter.assertConvoStep({
234
+ convoStep: { stepTag: 'test' },
235
+ args: ['>3'],
236
+ botMsg: {
237
+ buttons: [{ text: 'test.jpg' }, { text: 'test.jpg' }, { text: 'test.jpg' }],
238
+ cards: [
239
+ {
240
+ buttons: [{ text: 'test.jpg' }],
241
+ cards: [{ buttons: [{ text: 'test.jpg' }] }]
242
+ }
243
+ ]
282
244
  }
283
- ]
245
+ })
246
+ assert.fail('should have failed')
247
+ } catch (err) {
248
+ assert.isTrue(err.message.indexOf('Expected Buttons count 3 to be >3') >= 0)
284
249
  }
285
250
  })
251
+ it('should succeed on >=3 with rec buttons', async function () {
252
+ await this.buttonsCountRecAsserter.assertConvoStep({
253
+ convoStep: { stepTag: 'test' },
254
+ args: ['>=3'],
255
+ botMsg: {
256
+ buttons: [{ text: 'test.jpg' }],
257
+ cards: [
258
+ {
259
+ buttons: [{ text: 'test.jpg' }],
260
+ cards: [{ buttons: [{ text: 'test.jpg' }] }]
261
+ }
262
+ ]
263
+ }
264
+ })
265
+ })
266
+ it('should succeed on 3 with rec buttons', async function () {
267
+ await this.buttonsCountRecAsserter.assertConvoStep({
268
+ convoStep: { stepTag: 'test' },
269
+ args: ['3'],
270
+ botMsg: {
271
+ buttons: [{ text: 'test.jpg' }],
272
+ cards: [
273
+ {
274
+ buttons: [{ text: 'test.jpg' }],
275
+ cards: [{ buttons: [{ text: 'test.jpg' }] }]
276
+ }
277
+ ]
278
+ }
279
+ })
280
+ })
286
281
  })
287
282
 
288
- it('should fail with normalized text', async function () {
289
- try {
283
+ describe('buttonsNormalizeAsserter', function () {
284
+ beforeEach(async function () {
285
+ this.cardsAsserter = new ButtonsAsserter({
286
+ Match: (botresponse, utterance) => botresponse.toLowerCase().indexOf(utterance.toLowerCase()) >= 0
287
+ }, { SCRIPTING_NORMALIZE_TEXT: true })
288
+ })
289
+
290
+ it('should succeed with normalized text', async function () {
290
291
  await this.cardsAsserter.assertConvoStep({
291
292
  convoStep: { stepTag: 'test' },
292
- args: ['Test Html header1 test html text'],
293
+ args: ['Test Html header test html text'],
293
294
  botMsg: {
294
295
  buttons: [
295
296
  {
@@ -298,15 +299,31 @@ describe('scripting.asserters.buttonsNormalizeAsserter', function () {
298
299
  ]
299
300
  }
300
301
  })
301
- assert.fail('should have failed')
302
- } catch (err) {
303
- assert.isTrue(err.message.indexOf('Expected button(s) with text "Test Html header1 test html text"') > 0)
304
- assert.isNotNull(err.context)
305
- assert.isNotNull(err.context.cause)
306
- assert.isArray(err.context.cause.expected)
307
- assert.deepEqual(err.context.cause.expected, ['Test Html header1 test html text'])
308
- assert.deepEqual(err.context.cause.actual, ['test html header test html text'])
309
- assert.deepEqual(err.context.cause.diff, ['Test Html header1 test html text'])
310
- }
302
+ })
303
+
304
+ it('should fail with normalized text', async function () {
305
+ try {
306
+ await this.cardsAsserter.assertConvoStep({
307
+ convoStep: { stepTag: 'test' },
308
+ args: ['Test Html header1 test html text'],
309
+ botMsg: {
310
+ buttons: [
311
+ {
312
+ text: '<html><h1>test html header</h1><p>test html text</p>'
313
+ }
314
+ ]
315
+ }
316
+ })
317
+ assert.fail('should have failed')
318
+ } catch (err) {
319
+ assert.isTrue(err.message.indexOf('Expected button(s) with text "Test Html header1 test html text"') > 0)
320
+ assert.isNotNull(err.context)
321
+ assert.isNotNull(err.context.cause)
322
+ assert.isArray(err.context.cause.expected)
323
+ assert.deepEqual(err.context.cause.expected, ['Test Html header1 test html text'])
324
+ assert.deepEqual(err.context.cause.actual, ['test html header test html text'])
325
+ assert.deepEqual(err.context.cause.diff, ['Test Html header1 test html text'])
326
+ }
327
+ })
311
328
  })
312
329
  })