botium-core 1.13.5 → 1.13.6
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 +21 -7
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +21 -7
- package/dist/botium-es.js.map +1 -1
- package/package.json +1 -1
- package/src/helpers/RetryHelper.js +3 -2
- package/src/scripting/MatchFunctions.js +3 -1
- package/src/scripting/ScriptingProvider.js +14 -4
- package/src/scripting/logichook/asserter/BotRepliesConsumedAsserter.js +1 -1
- package/src/scripting/logichook/asserter/BotRepliesUnconsumedCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ButtonsCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/CardsCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/EntitiesAsserter.js +1 -1
- package/src/scripting/logichook/asserter/EntityContentAsserter.js +2 -2
- package/src/scripting/logichook/asserter/EntityValuesAsserter.js +1 -1
- package/src/scripting/logichook/asserter/FormsAsserter.js +1 -1
- package/src/scripting/logichook/asserter/IntentAsserter.js +3 -3
- package/src/scripting/logichook/asserter/IntentConfidenceAsserter.js +4 -4
- package/src/scripting/logichook/asserter/IntentUniqueAsserter.js +2 -2
- package/src/scripting/logichook/asserter/JsonPathAsserter.js +5 -5
- package/src/scripting/logichook/asserter/JsonPathCountAsserter.js +2 -2
- package/src/scripting/logichook/asserter/MediaAsserter.js +1 -1
- package/src/scripting/logichook/asserter/MediaCountAsserter.js +1 -1
- package/src/scripting/logichook/asserter/MediaCountRecAsserter.js +1 -1
- package/src/scripting/logichook/asserter/PauseAsserter.js +1 -1
- package/src/scripting/logichook/asserter/ResponseLengthAsserter.js +3 -2
- package/src/scripting/logichook/asserter/TextContainsAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextContainsAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextContainsAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextContainsAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextEqualsAnyAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextEqualsAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextRegexpAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextRegexpAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextWildcardAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAllAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAllICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/TextWildcardExactAnyAsserter.js +1 -0
- package/src/scripting/logichook/asserter/TextWildcardExactAnyICAsserter.js +2 -1
- package/src/scripting/logichook/asserter/WerAsserter.js +10 -8
- package/test/convo/transcript.spec.js +6 -6
- package/test/scripting/asserters/convos/{wer_threshold_nok.yml → wer_threshold_nok_float.yml} +0 -0
- package/test/scripting/asserters/convos/wer_threshold_nok_percentage.yml +7 -0
- package/test/scripting/asserters/convos/{wer_threshold_ok.yml → wer_threshold_ok_float.yml} +0 -0
- package/test/scripting/asserters/convos/wer_threshold_ok_percentage.yml +7 -0
- package/test/scripting/asserters/entityContentAsserter.spec.js +2 -7
- package/test/scripting/asserters/intentAsserter.spec.js +1 -1
- package/test/scripting/asserters/jsonpathAsserter.spec.js +1 -1
- package/test/scripting/asserters/werAsserter.spec.js +25 -5
- package/test/scripting/matching/matchingmode.spec.js +42 -2
- package/test/scripting/scriptingModificator.spec.js +1 -2
package/package.json
CHANGED
|
@@ -25,8 +25,9 @@ module.exports = class RetryHelper {
|
|
|
25
25
|
factor: caps[`RETRY_${section.toUpperCase()}_FACTOR`] || (_.isNil(options.factor) ? 1 : options.factor),
|
|
26
26
|
minTimeout: caps[`RETRY_${section.toUpperCase()}_MINTIMEOUT`] || (_.isNil(options.minTimeout) ? 1000 : options.minTimeout)
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
if (this.retrySettings.retries > 0) {
|
|
29
|
+
debug(`Retry for ${section} is enabled. Settings: ${JSON.stringify(this.retrySettings)} Patterns: ${JSON.stringify(this.retryErrorPatterns.map(r => r.toString()))}`)
|
|
30
|
+
}
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
shouldRetry (err) {
|
|
@@ -83,7 +83,9 @@ const equals = (ignoreCase) => (botresponse, utterance) => {
|
|
|
83
83
|
const wer = () => (botresponse, utterance, args) => {
|
|
84
84
|
botresponse = _normalize(botresponse || '')
|
|
85
85
|
utterance = toString(utterance || '')
|
|
86
|
-
|
|
86
|
+
|
|
87
|
+
const threshold = ([',', '.'].find(p => `${args[0]}`.includes(p)) ? parseFloat(args[0]) : parseInt(args[0]) / 100)
|
|
88
|
+
return speechScorer.wordErrorRate(botresponse, utterance) <= threshold
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
const getMatchFunction = (matchingMode) => {
|
|
@@ -135,7 +135,7 @@ module.exports = class ScriptingProvider {
|
|
|
135
135
|
}
|
|
136
136
|
debug(`assertBotResponse ${stepTag} ${meMsg ? `(${meMsg}) ` : ''}BOT: ${botresponse} = ${tomatch} ...`)
|
|
137
137
|
const found = _.find(tomatch, (utt) => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]))
|
|
138
|
-
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? '
|
|
138
|
+
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter'
|
|
139
139
|
if (_.isNil(found)) {
|
|
140
140
|
let message = `${stepTag}: Bot response `
|
|
141
141
|
message += meMsg ? `(on ${meMsg}) ` : ''
|
|
@@ -148,13 +148,18 @@ module.exports = class ScriptingProvider {
|
|
|
148
148
|
{
|
|
149
149
|
type: 'asserter',
|
|
150
150
|
source: asserterType,
|
|
151
|
+
params: {
|
|
152
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
153
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
154
|
+
},
|
|
151
155
|
context: {
|
|
152
156
|
stepTag
|
|
153
157
|
},
|
|
154
158
|
cause: {
|
|
155
159
|
expected: tomatch,
|
|
156
160
|
actual: botresponse,
|
|
157
|
-
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
|
|
161
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
162
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
158
163
|
}
|
|
159
164
|
}
|
|
160
165
|
)
|
|
@@ -166,7 +171,7 @@ module.exports = class ScriptingProvider {
|
|
|
166
171
|
}
|
|
167
172
|
debug(`assertBotNotResponse ${stepTag} ${meMsg ? `(${meMsg}) ` : ''}BOT: ${botresponse} != ${nottomatch} ...`)
|
|
168
173
|
const found = _.find(nottomatch, (utt) => this.matchFn(botresponse, utt, this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS]))
|
|
169
|
-
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? '
|
|
174
|
+
const asserterType = this.caps[Capabilities.SCRIPTING_MATCHING_MODE] === 'wer' ? 'Word Error Rate Asserter' : 'Text Match Asserter'
|
|
170
175
|
if (!_.isNil(found)) {
|
|
171
176
|
let message = `${stepTag}: Bot response `
|
|
172
177
|
message += meMsg ? `(on ${meMsg}) ` : ''
|
|
@@ -179,6 +184,10 @@ module.exports = class ScriptingProvider {
|
|
|
179
184
|
{
|
|
180
185
|
type: 'asserter',
|
|
181
186
|
source: asserterType,
|
|
187
|
+
params: {
|
|
188
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
189
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
190
|
+
},
|
|
182
191
|
context: {
|
|
183
192
|
stepTag
|
|
184
193
|
},
|
|
@@ -186,7 +195,8 @@ module.exports = class ScriptingProvider {
|
|
|
186
195
|
not: true,
|
|
187
196
|
expected: nottomatch,
|
|
188
197
|
actual: botresponse,
|
|
189
|
-
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE]
|
|
198
|
+
matchingMode: this.caps[Capabilities.SCRIPTING_MATCHING_MODE],
|
|
199
|
+
args: this.caps[Capabilities.SCRIPTING_MATCHING_MODE_ARGS] || null
|
|
190
200
|
}
|
|
191
201
|
}
|
|
192
202
|
)
|
|
@@ -3,7 +3,7 @@ const BaseCountAsserter = require('./BaseCountAsserter')
|
|
|
3
3
|
module.exports = class BotRepliesConsumedAsserter extends BaseCountAsserter {
|
|
4
4
|
constructor (context, caps = {}) {
|
|
5
5
|
super(context, caps, 'BotReplies')
|
|
6
|
-
this.name = '
|
|
6
|
+
this.name = 'Bot Replies Consumed Asserter'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
async _getCount (argv) { return argv.container._QueueLength() }
|
|
@@ -3,7 +3,7 @@ const BaseCountAsserter = require('./BaseCountAsserter')
|
|
|
3
3
|
module.exports = class BotRepliesUnconsumedCountAsserter extends BaseCountAsserter {
|
|
4
4
|
constructor (context, caps = {}) {
|
|
5
5
|
super(context, caps, 'unconsumed bot replies')
|
|
6
|
-
this.name = '
|
|
6
|
+
this.name = 'Bot Replies Unconsumed Count Asserter'
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
async _getCount (argv) { return argv.container._QueueLength() }
|
|
@@ -8,7 +8,7 @@ const _buttonsCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class ButtonsCountAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Buttons')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Buttons Count Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _buttonsCount(argv) }
|
|
@@ -8,7 +8,7 @@ const _buttonsCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class ButtonsCountRecAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Buttons')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Buttons Count (recursive) Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _buttonsCount(argv) }
|
|
@@ -8,7 +8,7 @@ const _cardsCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class CardsCountAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Cards')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Cards Count Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _cardsCount(argv) }
|
|
@@ -8,7 +8,7 @@ const _cardsCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class CardsCountRecAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Cards')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Cards Count (recursive) Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _cardsCount(argv) }
|
|
@@ -6,12 +6,12 @@ module.exports = class EntityContentAsserter {
|
|
|
6
6
|
constructor (context, caps = {}) {
|
|
7
7
|
this.context = context
|
|
8
8
|
this.caps = caps
|
|
9
|
-
this.name = '
|
|
9
|
+
this.name = 'NLU Entity Content Asserter'
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
assertConvoStep ({ convo, convoStep, args, botMsg }) {
|
|
13
13
|
if (!args || args.length < 2) {
|
|
14
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
14
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: ${this.name} Missing argument`,
|
|
15
15
|
{
|
|
16
16
|
type: 'asserter',
|
|
17
17
|
subtype: 'wrong parameters',
|
|
@@ -6,7 +6,7 @@ module.exports = class EntityValuesAsserter {
|
|
|
6
6
|
constructor (context, caps = {}) {
|
|
7
7
|
this.context = context
|
|
8
8
|
this.caps = caps
|
|
9
|
-
this.name = '
|
|
9
|
+
this.name = 'NLU Entity Values Asserter'
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
assertConvoStep ({ convo, convoStep, args, botMsg }) {
|
|
@@ -5,12 +5,12 @@ module.exports = class IntentAsserter {
|
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
this.context = context
|
|
7
7
|
this.caps = caps
|
|
8
|
-
this.name = '
|
|
8
|
+
this.name = 'NLU Intent Asserter'
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
assertConvoStep ({ convo, convoStep, args, botMsg }) {
|
|
12
12
|
if (!args || args.length < 1) {
|
|
13
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
13
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: ${this.name} Missing argument`,
|
|
14
14
|
{
|
|
15
15
|
type: 'asserter',
|
|
16
16
|
subtype: 'wrong parameters',
|
|
@@ -20,7 +20,7 @@ module.exports = class IntentAsserter {
|
|
|
20
20
|
))
|
|
21
21
|
}
|
|
22
22
|
if (args.length > 1) {
|
|
23
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
23
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: ${this.name} Too much arguments "${args}"`,
|
|
24
24
|
{
|
|
25
25
|
type: 'asserter',
|
|
26
26
|
subtype: 'wrong parameters',
|
|
@@ -17,12 +17,12 @@ module.exports = class IntentConfidenceAsserter {
|
|
|
17
17
|
throw Error(`IntentConfidenceAsserter Excepted minimum is not valid ${this.globalExpectedMinimum}`)
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
this.name = '
|
|
20
|
+
this.name = 'NLU Intent Confidence Asserter'
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
assertConvoStep ({ convo, convoStep, args, botMsg, isGlobal }) {
|
|
24
24
|
if (args.length > 1) {
|
|
25
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
25
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: ${this.name} Too much arguments "${args}"`,
|
|
26
26
|
{
|
|
27
27
|
type: 'asserter',
|
|
28
28
|
subtype: 'wrong parameters',
|
|
@@ -35,7 +35,7 @@ module.exports = class IntentConfidenceAsserter {
|
|
|
35
35
|
const hasLocalExpectedMinimum = args && args.length
|
|
36
36
|
|
|
37
37
|
if (!this.hasGlobalExpectedMinimum && !hasLocalExpectedMinimum) {
|
|
38
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
38
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: NLU Intent Confidence Asserter configured neither global, nor local`,
|
|
39
39
|
{
|
|
40
40
|
type: 'asserter',
|
|
41
41
|
subtype: 'wrong parameters',
|
|
@@ -53,7 +53,7 @@ module.exports = class IntentConfidenceAsserter {
|
|
|
53
53
|
if (hasLocalExpectedMinimum) {
|
|
54
54
|
expectedMinimum = Number(args[0])
|
|
55
55
|
if (parseInt(expectedMinimum, 10) !== expectedMinimum) {
|
|
56
|
-
return Promise.reject(new BotiumError(`${convoStep.stepTag}:
|
|
56
|
+
return Promise.reject(new BotiumError(`${convoStep.stepTag}: NLU Intent Confidence Asserter Wrong argument. It must be integer "${args[0]}"`,
|
|
57
57
|
{
|
|
58
58
|
type: 'asserter',
|
|
59
59
|
subtype: 'wrong parameters',
|
|
@@ -5,13 +5,13 @@ module.exports = class IntentUniqueAsserter {
|
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
this.context = context
|
|
7
7
|
this.caps = caps
|
|
8
|
-
this.name = '
|
|
8
|
+
this.name = 'NLU Intent Unique Asserter'
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
assertConvoStep ({ convo, convoStep, args, botMsg }) {
|
|
12
12
|
if (args.length > 0) {
|
|
13
13
|
return Promise.reject(new BotiumError(
|
|
14
|
-
`${convoStep.stepTag}:
|
|
14
|
+
`${convoStep.stepTag}: ${this.name} Too much argument "${args}"`,
|
|
15
15
|
{
|
|
16
16
|
type: 'asserter',
|
|
17
17
|
subtype: 'wrong parameters',
|
|
@@ -10,7 +10,7 @@ module.exports = class JsonPathAsserter {
|
|
|
10
10
|
this.context = context
|
|
11
11
|
this.caps = caps
|
|
12
12
|
this.globalArgs = globalArgs
|
|
13
|
-
this.name = context.ref || '
|
|
13
|
+
this.name = context.ref || 'JsonPath Asserter'
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
assertNotConvoStep (params) {
|
|
@@ -24,7 +24,7 @@ module.exports = class JsonPathAsserter {
|
|
|
24
24
|
_getConfig (convoStep, args) {
|
|
25
25
|
if (this.globalArgs && this.globalArgs.path) {
|
|
26
26
|
if (args && args.length > 1) {
|
|
27
|
-
throw new BotiumError(`${convoStep.stepTag}:
|
|
27
|
+
throw new BotiumError(`${convoStep.stepTag}: ${this.name} 0 or 1 arguments expected "${toString(args)}"`,
|
|
28
28
|
{
|
|
29
29
|
type: 'asserter',
|
|
30
30
|
subtype: 'wrong parameters',
|
|
@@ -44,7 +44,7 @@ module.exports = class JsonPathAsserter {
|
|
|
44
44
|
if (_.has(this.globalArgs, 'argCount')) {
|
|
45
45
|
const argCount = this.globalArgs.argCount
|
|
46
46
|
if (argCount === 0 && args && args.length > 0) {
|
|
47
|
-
throw new BotiumError(`${convoStep.stepTag}:
|
|
47
|
+
throw new BotiumError(`${convoStep.stepTag}: ${this.name} ${argCount} arguments expected "${toString(args)}"`,
|
|
48
48
|
{
|
|
49
49
|
type: 'asserter',
|
|
50
50
|
subtype: 'wrong parameters',
|
|
@@ -56,7 +56,7 @@ module.exports = class JsonPathAsserter {
|
|
|
56
56
|
}
|
|
57
57
|
)
|
|
58
58
|
} else if (!args || args.length !== argCount) {
|
|
59
|
-
throw new BotiumError(`${convoStep.stepTag}:
|
|
59
|
+
throw new BotiumError(`${convoStep.stepTag}: ${this.name} ${argCount} arguments expected "${toString(args)}"`,
|
|
60
60
|
{
|
|
61
61
|
type: 'asserter',
|
|
62
62
|
subtype: 'wrong parameters',
|
|
@@ -75,7 +75,7 @@ module.exports = class JsonPathAsserter {
|
|
|
75
75
|
}
|
|
76
76
|
} else {
|
|
77
77
|
if (!args || args.length === 0 || args.length > 2) {
|
|
78
|
-
throw new BotiumError(`${convoStep.stepTag}:
|
|
78
|
+
throw new BotiumError(`${convoStep.stepTag}: ${this.name} 1 or 2 arguments expected "${toString(args)}"`,
|
|
79
79
|
{
|
|
80
80
|
type: 'asserter',
|
|
81
81
|
subtype: 'wrong parameters',
|
|
@@ -11,7 +11,7 @@ const _jsonPathCount = ({ botMsg, args }) => {
|
|
|
11
11
|
module.exports = class JsonPathCountAsserter extends BaseCountAsserter {
|
|
12
12
|
constructor (context, caps = {}) {
|
|
13
13
|
super(context, caps, 'JsonPath', 1)
|
|
14
|
-
this.name = '
|
|
14
|
+
this.name = 'JsonPath Count Asserter'
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
async _getCount (argv) { return _jsonPathCount(argv) }
|
|
@@ -20,7 +20,7 @@ module.exports = class JsonPathCountAsserter extends BaseCountAsserter {
|
|
|
20
20
|
const { args, convoStep } = argv
|
|
21
21
|
|
|
22
22
|
if (!args || args.length < 1 || args.length > 2) {
|
|
23
|
-
throw new BotiumError(`${convoStep.stepTag}:
|
|
23
|
+
throw new BotiumError(`${convoStep.stepTag}: ${this.name} 1 or 2 arguments expected "${args}"`,
|
|
24
24
|
{
|
|
25
25
|
type: 'asserter',
|
|
26
26
|
subtype: 'wrong parameters',
|
|
@@ -8,7 +8,7 @@ const _mediaCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class MediaCountAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Media')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Media Attachment Count Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _mediaCount(argv) }
|
|
@@ -8,7 +8,7 @@ const _mediaCount = ({ botMsg }) => {
|
|
|
8
8
|
module.exports = class MediaCountRecAsserter extends BaseCountAsserter {
|
|
9
9
|
constructor (context, caps = {}) {
|
|
10
10
|
super(context, caps, 'Media')
|
|
11
|
-
this.name = '
|
|
11
|
+
this.name = 'Media Count (recursive) Asserter'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
async _getCount (argv) { return _mediaCount(argv) }
|
|
@@ -12,6 +12,7 @@ module.exports = class ResponseLengthAsserter {
|
|
|
12
12
|
if (globalArgs && globalArgs.maximumCount) {
|
|
13
13
|
this.globalMaximumCount = Number(globalArgs.maximumCount)
|
|
14
14
|
}
|
|
15
|
+
this.name = 'Response Length Asserter'
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
assertConvoStep ({ convo, convoStep, args, botMsg }) {
|
|
@@ -32,7 +33,7 @@ module.exports = class ResponseLengthAsserter {
|
|
|
32
33
|
return Promise.reject(new BotiumError(`${convoStep.stepTag}: Expected maximum response count ${checkCount}, found ${botMsg.messageText.length}`,
|
|
33
34
|
{
|
|
34
35
|
type: 'asserter',
|
|
35
|
-
source:
|
|
36
|
+
source: this.name,
|
|
36
37
|
context: {
|
|
37
38
|
constructor: {
|
|
38
39
|
globalArgs: this.globalArgs
|
|
@@ -57,7 +58,7 @@ module.exports = class ResponseLengthAsserter {
|
|
|
57
58
|
return Promise.reject(new BotiumError(`${convoStep.stepTag}: Expected maximum response length ${checkLength} characters, found ${textToCheck.length}`,
|
|
58
59
|
{
|
|
59
60
|
type: 'asserter',
|
|
60
|
-
source:
|
|
61
|
+
source: this.name,
|
|
61
62
|
context: {
|
|
62
63
|
constructor: {
|
|
63
64
|
globalArgs: this.globalArgs
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextContainsAllAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.include(false), 'all')
|
|
7
|
+
this.name = 'Text Contains All Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextContainsAllICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.include(true), 'all')
|
|
7
|
+
this.name = 'Text Contains All (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -4,5 +4,6 @@ const MatchFunctions = require('../../MatchFunctions')
|
|
|
4
4
|
module.exports = class TextContainsAnyAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.include(false), 'any')
|
|
7
|
+
this.name = 'Text Contains Any Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextContainsAnyICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.include(true), 'any')
|
|
7
|
+
this.name = 'Text Contains Any (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextEqualsAnyAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.equals(false), 'any', true)
|
|
7
|
+
this.name = 'Text Equals Any Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextEqualsAnyICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.equals(true), 'any', true)
|
|
7
|
+
this.name = 'Text Equals Any (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextRegexpAllAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.regexp(false), 'all')
|
|
7
|
+
this.name = 'Text Regexp All Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextRegexpAllICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.regexp(true), 'all')
|
|
7
|
+
this.name = 'Text Regexp All (ignore all) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -4,5 +4,6 @@ const MatchFunctions = require('../../MatchFunctions')
|
|
|
4
4
|
module.exports = class TextRegexpAnyAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.regexp(false), 'any')
|
|
7
|
+
this.name = 'Text Regexp Any Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextRegexpAnyICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.regexp(true), 'any')
|
|
7
|
+
this.name = 'Text Regexp Any (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardAllAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcard(false), 'all')
|
|
7
|
+
this.name = 'Text Wildcard All Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardAllICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcard(true), 'all')
|
|
7
|
+
this.name = 'Text Wildcard All (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -4,5 +4,6 @@ const MatchFunctions = require('../../MatchFunctions')
|
|
|
4
4
|
module.exports = class TextWildcardAnyAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcard(false), 'any')
|
|
7
|
+
this.name = 'Text Wildcard Any Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardAnyICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcard(true), 'any')
|
|
7
|
+
this.name = 'Text Wildcard Any (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardExactAllAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcardExact(false), 'all')
|
|
7
|
+
this.name = 'Text Wildcard Exact All Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardExactAllICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcardExact(true), 'all')
|
|
7
|
+
this.name = 'Text Wildcard Exact All (ignore) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -4,5 +4,6 @@ const MatchFunctions = require('../../MatchFunctions')
|
|
|
4
4
|
module.exports = class TextWildcardExactAnyAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcardExact(false), 'any')
|
|
7
|
+
this.name = 'Text Wildcard Exact Any Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
const BaseTextAsserter = require('./BaseTextAsserter')
|
|
2
2
|
const MatchFunctions = require('../../MatchFunctions')
|
|
3
3
|
|
|
4
|
-
module.exports = class
|
|
4
|
+
module.exports = class TextWildcardExactAnyICAsserter extends BaseTextAsserter {
|
|
5
5
|
constructor (context, caps = {}) {
|
|
6
6
|
super(context, caps, MatchFunctions.wildcardExact(true), 'any')
|
|
7
|
+
this.name = 'Text Wildcard Exact Any (ignore case) Asserter'
|
|
7
8
|
}
|
|
8
9
|
}
|