fix(测试跟踪): 修复任务中心场景显示执行类型失败的缺陷

--bug=1032254 --user=王孝刚 【测试跟踪】测试计划-批量执行-任务中心-场景测试任务-类型显示错误
https://www.tapd.cn/55049933/s/1429258
This commit is contained in:
wxg0103 2023-10-20 19:30:15 +08:00 committed by 刘瑞斌
parent ec71c80e8a
commit 20885a16e1
2 changed files with 44 additions and 2 deletions

View File

@ -6,7 +6,12 @@
:label="$t('api_test.definition.request.response_body')"
name="body"
class="pane">
<ms-sql-result-table v-if="isSqlType" :body="response.body" />
<ms-sql-result-table v-if="isSqlType && !response.contentType" :body="response.body" />
<el-row v-else-if="isPicture && activeName === 'body'">
<el-col :span="24">
<el-image :src="srcUrl" fit="contain" style="width: 100%;height: 100%;"></el-image>
</el-col>
</el-row>
<ms-code-edit v-else :mode="mode" :read-only="true" :data="response.body" :modes="modes" ref="codeEdit" />
</el-tab-pane>
@ -86,6 +91,17 @@ export default {
modes: ['text', 'json', 'xml', 'html'],
sqlModes: ['text', 'table'],
mode: BODY_FORMAT.TEXT,
contentType: [
'image/png',
'image/jpeg',
'image/gif',
'image/bmp',
'image/webp',
'image/svg+xml',
'image/apng',
'image/avif'
],
srcUrl: '',
};
},
@ -105,6 +121,26 @@ export default {
if (this.response.headers.indexOf('Content-Type: application/json') > 0) {
this.mode = BODY_FORMAT.JSON;
}
if (this.response.contentType && this.contentType.includes(this.response.contentType)) {
this.modes.push('picture')
this.srcUrl = 'data:' + this.response.contentType + ';base64,' + this.response.imageUrl;
}
if (this.response && this.response.contentType) {
switch (this.response.contentType) {
case 'application/json':
this.mode = BODY_FORMAT.JSON;
break;
case 'text/html':
this.mode = BODY_FORMAT.HTML;
break;
case 'text/xml':
this.mode = BODY_FORMAT.XML;
break;
default:
this.mode = BODY_FORMAT.TEXT;
break;
}
}
},
computed: {
@ -115,6 +151,9 @@ export default {
this.mode === 'table'
);
},
isPicture() {
return this.response.contentType && this.contentType.includes(this.response.contentType) && this.mode === 'picture';
},
},
};
</script>

View File

@ -1049,7 +1049,10 @@ public class TestPlanService {
} else if (StringUtils.equals(triggerMode, ReportTriggerMode.MANUAL.name())) {
scenarioRequest.setTriggerMode(ReportTriggerMode.MANUAL.name());
scenarioRequest.setRunMode(ApiRunMode.JENKINS_SCENARIO_PLAN.name());
} else {
} else if (StringUtils.equals(triggerMode, ReportTriggerMode.BATCH.name())) {
scenarioRequest.setTriggerMode(ReportTriggerMode.BATCH.name());
scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name());
}else{
scenarioRequest.setTriggerMode(ReportTriggerMode.SCHEDULE.name());
scenarioRequest.setRunMode(ApiRunMode.SCHEDULE_SCENARIO_PLAN.name());
}