botium-core 1.13.10 → 1.13.12
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 +14 -11
- package/dist/botium-cjs.js.map +1 -1
- package/dist/botium-es.js +35 -32
- package/dist/botium-es.js.map +1 -1
- package/package.json +1 -1
- package/src/Defaults.js +0 -1
- package/src/scripting/helper.js +6 -2
- package/test/driver/capabilities.spec.js +7 -7
package/package.json
CHANGED
package/src/Defaults.js
CHANGED
|
@@ -9,7 +9,6 @@ module.exports = {
|
|
|
9
9
|
[Capabilities.TEMPDIR]: 'botiumwork',
|
|
10
10
|
[Capabilities.CLEANUPTEMPDIR]: true,
|
|
11
11
|
[Capabilities.WAITFORBOTTIMEOUT]: 10000,
|
|
12
|
-
[Capabilities.SIMULATE_WRITING_SPEED]: false,
|
|
13
12
|
[Capabilities.SIMPLEREST_PING_RETRIES]: 6,
|
|
14
13
|
[Capabilities.SIMPLEREST_PING_TIMEOUT]: 10000,
|
|
15
14
|
[Capabilities.SIMPLEREST_PING_VERB]: 'GET',
|
package/src/scripting/helper.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const _ = require('lodash')
|
|
2
2
|
const isJSON = require('is-json')
|
|
3
3
|
const speechScorer = require('word-error-rate')
|
|
4
|
+
const debug = require('debug')('botium-core-scripting-helper')
|
|
4
5
|
|
|
5
6
|
const { E_SCRIPTING_MEMORY_COLUMN_MODE } = require('../Enums')
|
|
6
7
|
|
|
@@ -561,7 +562,7 @@ const calculateWer = (str, pattern) => {
|
|
|
561
562
|
continue
|
|
562
563
|
}
|
|
563
564
|
const wordCount = wildcardPart.split(' ').length
|
|
564
|
-
const subsetPhrases = _getSubsets(botMessageWords,
|
|
565
|
+
const subsetPhrases = _getSubsets(botMessageWords, Math.min(wordCount, botMessageWords.length)).map(subset => subset.join(' '))
|
|
565
566
|
let subsetPhraseFound = null
|
|
566
567
|
for (const subsetPhrase of subsetPhrases) {
|
|
567
568
|
const localWer = speechScorer.wordErrorRate(subsetPhrase, wildcardPart).toFixed(2)
|
|
@@ -570,7 +571,9 @@ const calculateWer = (str, pattern) => {
|
|
|
570
571
|
wer = localWer
|
|
571
572
|
}
|
|
572
573
|
}
|
|
573
|
-
|
|
574
|
+
if (_.isNil(subsetPhraseFound)) {
|
|
575
|
+
throw new Error('Word Error Asserter: Something went wrong here, please try to modify your assertion!')
|
|
576
|
+
}
|
|
574
577
|
errors.push(_getErrors(_getWords(wildcardPart), _getWords(subsetPhraseFound)))
|
|
575
578
|
}
|
|
576
579
|
let errCount = 0
|
|
@@ -579,6 +582,7 @@ const calculateWer = (str, pattern) => {
|
|
|
579
582
|
errCount += err.filter(err => err === true).length
|
|
580
583
|
allCount += err.length
|
|
581
584
|
}
|
|
585
|
+
debug(`Word Error Rate Asserter - Compared Bot Message '${botMessage}' / '${utt}': ${(errCount / allCount).toFixed(2)}`)
|
|
582
586
|
return (errCount / allCount).toFixed(2)
|
|
583
587
|
}
|
|
584
588
|
|
|
@@ -60,11 +60,11 @@ describe('driver.capabilities', function () {
|
|
|
60
60
|
describe('capabilities', function () {
|
|
61
61
|
it('should merge boolean caps', function () {
|
|
62
62
|
const myCaps = {
|
|
63
|
-
[Capabilities.
|
|
63
|
+
[Capabilities.SIMPLEREST_PING_PROCESS_RESPONSE]: 'YES'
|
|
64
64
|
}
|
|
65
65
|
const driver = new BotDriver(myCaps)
|
|
66
|
-
assert.isBoolean(driver.caps[Capabilities.
|
|
67
|
-
assert.isTrue(driver.caps[Capabilities.
|
|
66
|
+
assert.isBoolean(driver.caps[Capabilities.SIMPLEREST_PING_PROCESS_RESPONSE])
|
|
67
|
+
assert.isTrue(driver.caps[Capabilities.SIMPLEREST_PING_PROCESS_RESPONSE])
|
|
68
68
|
})
|
|
69
69
|
it('should merge string caps', function () {
|
|
70
70
|
const myCaps = {
|
|
@@ -76,11 +76,11 @@ describe('driver.capabilities', function () {
|
|
|
76
76
|
assert.isString(driver.caps.CAP_STRING_2)
|
|
77
77
|
})
|
|
78
78
|
it('should merge boolean envs', function () {
|
|
79
|
-
process.env.
|
|
79
|
+
process.env.BOTIUM_SIMPLEREST_PING_PROCESS_RESPONSE = 'NO'
|
|
80
80
|
const driver = new BotDriver()
|
|
81
|
-
delete process.env.
|
|
82
|
-
assert.isBoolean(driver.caps[Capabilities.
|
|
83
|
-
assert.isFalse(driver.caps[Capabilities.
|
|
81
|
+
delete process.env.BOTIUM_SIMPLEREST_PING_PROCESS_RESPONSE
|
|
82
|
+
assert.isBoolean(driver.caps[Capabilities.SIMPLEREST_PING_PROCESS_RESPONSE])
|
|
83
|
+
assert.isFalse(driver.caps[Capabilities.SIMPLEREST_PING_PROCESS_RESPONSE])
|
|
84
84
|
})
|
|
85
85
|
it('should parse array caps', function () {
|
|
86
86
|
DefaultCapabilities.MYCAP = []
|