runner-runtime 1.0.59 → 1.0.60
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/events/index.js +10 -10
- package/libs/utils.js +12 -12
- package/package.json +1 -1
package/events/index.js
CHANGED
|
@@ -26,16 +26,6 @@ const events = {
|
|
|
26
26
|
const exp = variableReplaceForCondition(data?.var, eventRuntimeData?.variables, option),
|
|
27
27
|
compare = data?.compare, value = variableReplaceForCondition(data?.value, eventRuntimeData?.variables, option);
|
|
28
28
|
const isMatched = returnBoolean(exp, compare, value);
|
|
29
|
-
|
|
30
|
-
if (isMatched && _.isArray(finalChildren) && !_.isEmpty(finalChildren)) {
|
|
31
|
-
const { iterationData } = option, iterationDataArr = [iterationData];
|
|
32
|
-
|
|
33
|
-
// if (!_.isEmpty(iterationData) && _.isObject(iterationData)) {
|
|
34
|
-
// iterationDataArr = _.flatMap([iterationData], (element) => _.times(_.size(finalChildren), () => element));
|
|
35
|
-
// }
|
|
36
|
-
await iterationEvent(finalChildren, _.assign(_.cloneDeep(option), { iterationDataArr }), callback, eventRuntimeData, eventResultList)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
29
|
const runtimeState = convertEndRuntimeState(eventRuntimeData, event?.event_id) || {}
|
|
40
30
|
const finalIfData = {
|
|
41
31
|
action: 'request',
|
|
@@ -64,6 +54,16 @@ const events = {
|
|
|
64
54
|
|
|
65
55
|
eventResultList.push(finalIfData?.data)
|
|
66
56
|
callback(finalIfData);
|
|
57
|
+
|
|
58
|
+
if (isMatched && _.isArray(finalChildren) && !_.isEmpty(finalChildren)) {
|
|
59
|
+
const { iterationData } = option, iterationDataArr = [iterationData];
|
|
60
|
+
|
|
61
|
+
// if (!_.isEmpty(iterationData) && _.isObject(iterationData)) {
|
|
62
|
+
// iterationDataArr = _.flatMap([iterationData], (element) => _.times(_.size(finalChildren), () => element));
|
|
63
|
+
// }
|
|
64
|
+
await iterationEvent(finalChildren, _.assign(_.cloneDeep(option), { iterationDataArr }), callback, eventRuntimeData, eventResultList)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
67
|
} catch (e) {
|
|
68
68
|
throw ({
|
|
69
69
|
action: 'systemError',
|
package/libs/utils.js
CHANGED
|
@@ -292,7 +292,7 @@ const returnBoolean = (exp, compare, value) => {
|
|
|
292
292
|
const getCaseInsensitive = (object, keyToFind) => {
|
|
293
293
|
try {
|
|
294
294
|
// 先将要查找的键转换成小写
|
|
295
|
-
const lowerKey =
|
|
295
|
+
const lowerKey = _.toLower(keyToFind);
|
|
296
296
|
|
|
297
297
|
if (!_.isObject(object)) {
|
|
298
298
|
return undefined;
|
|
@@ -300,7 +300,7 @@ const getCaseInsensitive = (object, keyToFind) => {
|
|
|
300
300
|
|
|
301
301
|
// 在对象的所有键中查找
|
|
302
302
|
for (const key in object) {
|
|
303
|
-
if (
|
|
303
|
+
if (_.toLower(key) === lowerKey) {
|
|
304
304
|
return object[key];
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -430,19 +430,19 @@ const formatAutotestReport = (startTimeAt, eventResultList) => {
|
|
|
430
430
|
totalResponseSize = totalResponseSize + _.toInteger(item?.response?.response_size);
|
|
431
431
|
totalResponseTime = totalResponseTime + _.toInteger(item?.response?.response_time);
|
|
432
432
|
|
|
433
|
-
if (!_.isEmpty(item?.status?.assert) && _.isArray(item?.status?.assert)) {
|
|
434
|
-
const assertFailure = _.map(item?.status?.assert, (assertItem) => {
|
|
435
|
-
return assertItem?.passed === false
|
|
436
|
-
})
|
|
437
|
-
|
|
438
|
-
report.assert.total = report.assert.total + _.size(item?.status?.assert);
|
|
439
|
-
report.assert.error = report.assert.error + _.size(assertFailure);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
433
|
if (_.toLower(item?.status?.http) != 'ok') {
|
|
443
434
|
report.http.error++;
|
|
444
435
|
}
|
|
445
436
|
}
|
|
437
|
+
|
|
438
|
+
if (_.includes(['api', 'sample', 'assert', 'assert_visual'], item?.type) && !_.isEmpty(item?.status?.assert) && _.isArray(item?.status?.assert)) {
|
|
439
|
+
const assertFailure = _.map(item?.status?.assert, (assertItem) => {
|
|
440
|
+
return assertItem?.passed === false
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
report.assert.total = report.assert.total + _.size(item?.status?.assert);
|
|
444
|
+
report.assert.error = report.assert.error + _.size(assertFailure);
|
|
445
|
+
}
|
|
446
446
|
})
|
|
447
447
|
|
|
448
448
|
report.http.success = report.http.total - report.http.error;
|
|
@@ -532,7 +532,7 @@ const convertEndRuntimeState = (eventRuntimeData, event_id) => {
|
|
|
532
532
|
}
|
|
533
533
|
_.set(startAllActedUponVars, [key, 'actedUpon'], startActedUpon);
|
|
534
534
|
})
|
|
535
|
-
|
|
535
|
+
|
|
536
536
|
// 当前变量
|
|
537
537
|
const { environment = {}, variables = {}, _globals = {}, iterationData = {} } = _.get(eventRuntimeData, 'variables', {});
|
|
538
538
|
const endVariables = { environment, variables, iterationData, globals: _globals };
|