fix(接口测试): 修复多层嵌套事物控制器执行状态显示问题

--bug=1026649 --user=赵勇 【接口测试】github#24702,场景中事务控制器下请求报错,但是事务控制器显示成功 https://www.tapd.cn/55049933/s/1385660

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-06-25 17:34:14 +08:00 committed by fit2-zhao
parent 8ee491dd84
commit dcf7dbbb8a
3 changed files with 17 additions and 13 deletions

View File

@ -377,7 +377,7 @@ public class MsHashTreeService {
Map<String, Boolean> indexKeyMap = new HashMap<>(); Map<String, Boolean> indexKeyMap = new HashMap<>();
StringBuilder builder = new StringBuilder(parentIndex); StringBuilder builder = new StringBuilder(parentIndex);
if (element.has(ENABLE) && element.has(ID) && element.has(INDEX)) { if (element.has(ENABLE) && element.has(ID) && element.has(INDEX)) {
builder.append("_").append(element.getString(INDEX)); builder.append("_").append(element.optString(INDEX));
String key = StringUtils.join(element.optString(ID), builder.toString()); String key = StringUtils.join(element.optString(ID), builder.toString());
indexKeyMap.put(key, element.optBoolean(ENABLE)); indexKeyMap.put(key, element.optBoolean(ENABLE));
} }
@ -435,7 +435,8 @@ public class MsHashTreeService {
} }
private void setCaseEnable(JSONObject element, Map<String, Boolean> keyMap, String parentIndex) { private void setCaseEnable(JSONObject element, Map<String, Boolean> keyMap, String parentIndex) {
if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))) { if (element.has(ENABLE) && BooleanUtils.isFalse(element.optBoolean(ENABLE))
&& StringUtils.equals(element.optString(REFERENCED),REF)) {
element.put(ENABLE, false); element.put(ENABLE, false);
element.put(REF_ENABLE, true); element.put(REF_ENABLE, true);
} else { } else {

View File

@ -128,7 +128,6 @@
<el-col :span="13"> <el-col :span="13">
<env-popover <env-popover
:disabled="scenarioDefinition.length < 1"
:env-map="projectEnvMap" :env-map="projectEnvMap"
:project-ids="projectIds" :project-ids="projectIds"
:result="envResult" :result="envResult"
@ -151,6 +150,7 @@
@click="runDebug" @click="runDebug"
class="ms-message-right" class="ms-message-right"
size="mini" size="mini"
:disabled="scenarioDefinition.length < 1"
@command="handleCommand" @command="handleCommand"
v-permission="[ v-permission="[
'PROJECT_API_SCENARIO:READ+DEBUG', 'PROJECT_API_SCENARIO:READ+DEBUG',
@ -1114,15 +1114,14 @@ export default {
} }
}, },
evaluationParent(node, status) { evaluationParent(node, status) {
if (!node.data.code) { if(node.data.code === "ERROR") {
node.data.code = 'SUCCESS'; return;
} }
if (node.data.code ==='SUCCESS' && status && status === 'SUCCESS') { if (node.data.code === 'FAKE_ERROR') {
node.data.code = 'SUCCESS'; return;
} }
if ((node.data.code ==='SUCCESS' || node.data.code = status ? 'SUCCESS' : 'ERROR';
node.data.code === 'FAKE_ERROR') && if (status === 'FAKE_ERROR') {
status && status === 'FAKE_ERROR') {
node.data.code = 'FAKE_ERROR'; node.data.code = 'FAKE_ERROR';
} }
if (status && status === 'ERROR') { if (status && status === 'ERROR') {
@ -1139,6 +1138,7 @@ export default {
let id = item.data.id || item.data.resourceId; let id = item.data.id || item.data.resourceId;
if (id + '_' + item.data.parentIndex === resourceId) { if (id + '_' + item.data.parentIndex === resourceId) {
item.data.testing = false; item.data.testing = false;
item.data.code = status ? "SUCCESS" : "ERROR";
this.evaluationParent(item.parent, status); this.evaluationParent(item.parent, status);
} }
if (item.childNodes && item.childNodes.length > 0) { if (item.childNodes && item.childNodes.length > 0) {

View File

@ -46,13 +46,11 @@
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-checkbox v-model="cookieShare" @change="setCookieShare">共享cookie</el-checkbox> <el-checkbox v-model="cookieShare" @change="setCookieShare">{{ $t('api_test.scenario.share_cookie') }}</el-checkbox>
<el-checkbox v-model="sampleError" @change="setOnSampleError" style="margin-right: 10px"> <el-checkbox v-model="sampleError" @change="setOnSampleError" style="margin-right: 10px">
{{ $t('commons.failure_continues') }} {{ $t('commons.failure_continues') }}
</el-checkbox> </el-checkbox>
<env-popover <env-popover
:disabled="scenarioDefinition.length < 1"
:isReadOnly="scenarioDefinition.length < 1"
:env-map="projectEnvMap" :env-map="projectEnvMap"
:project-ids="projectIds" :project-ids="projectIds"
@setProjectEnvMap="setProjectEnvMap" @setProjectEnvMap="setProjectEnvMap"
@ -72,6 +70,7 @@
@click="debugScenario" @click="debugScenario"
style="margin: 0px 10px 0px" style="margin: 0px 10px 0px"
size="mini" size="mini"
:disabled="scenarioDefinition.length < 1"
@command="handleCommand" @command="handleCommand"
v-show="!debugLoading"> v-show="!debugLoading">
{{ $t('api_test.request.debug') }} {{ $t('api_test.request.debug') }}
@ -800,6 +799,9 @@ export default {
}); });
}, },
debugScenario() { debugScenario() {
if(this.scenarioDefinition.length < 1){
return;
}
this.debugLoading = true; this.debugLoading = true;
this.$emit('runDebug'); this.$emit('runDebug');
}, },
@ -1493,4 +1495,5 @@ export default {
white-space: nowrap; white-space: nowrap;
width: 120px; width: 120px;
} }
</style> </style>