fix(接口测试): 修复执行测试用例显示测试中,无法停止问题

--bug=1009232 --user=赵勇 【接口测试】执行测试用例还是一直执行中【+github#8807】 https://www.tapd.cn/55049933/s/1087011
This commit is contained in:
fit2-zhao 2021-12-27 10:10:42 +08:00 committed by fit2-zhao
parent b3427b0714
commit 6a89622f5e
3 changed files with 125 additions and 127 deletions

View File

@ -60,7 +60,7 @@ export default {
if (this.apiItem && this.apiItem.id) {
let url = "/api/definition/report/getReport/" + this.apiItem.id;
this.$get(url, response => {
if (response.data) {
if (response.data && response.data.content) {
try {
let data = JSON.parse(response.data.content);
this.response = data;

View File

@ -23,7 +23,7 @@ export default {
return {
result: {},
loading: false,
requestResult: {},
requestResult: {responseResult: {}},
reqNumber: 0,
websocket: {}
}
@ -123,6 +123,7 @@ export default {
threadGroup.hashTree.push(item);
})
this.sort(testPlan.hashTree);
this.requestResult.reportId = this.reportId;
let reqObj = {id: this.reportId, testElement: testPlan, type: this.type, clazzName: this.clazzName ? this.clazzName : TYPE_TO_C.get(this.type), projectId: projectId, environmentMap: strMapToObj(this.envMap)};
let bodyFiles = getBodyUploadFiles(reqObj, this.runData);
if (this.runData[0].url) {

View File

@ -1,6 +1,5 @@
<template>
<div class="text-container">
<div class="text-container" v-if="responseResult">
<el-tabs v-model="activeName" v-show="isActive">
<el-tab-pane :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
<ms-sql-result-table v-if="isSqlType" :body="responseResult.body"/>
@ -38,13 +37,13 @@
</template>
<script>
import MsAssertionResults from "./AssertionResults";
import MsCodeEdit from "../MsCodeEdit";
import MsDropdown from "../../../../common/components/MsDropdown";
import {BODY_FORMAT} from "../../model/ApiTestModel";
import MsSqlResultTable from "./SqlResultTable";
import MsAssertionResults from "./AssertionResults";
import MsCodeEdit from "../MsCodeEdit";
import MsDropdown from "../../../../common/components/MsDropdown";
import {BODY_FORMAT} from "../../model/ApiTestModel";
import MsSqlResultTable from "./SqlResultTable";
export default {
export default {
name: "MsResponseResult",
components: {
@ -84,10 +83,8 @@
this.mode = mode;
},
setBodyType() {
if (!this.response.responseResult || !this.response.responseResult.headers) {
return;
}
if (this.response.responseResult.headers.indexOf("Content-Type: application/json") > 0) {
if (this.response && this.response.responseResult && this.response.responseResult.headers
&& this.response.responseResult.headers.indexOf("Content-Type: application/json") > 0) {
this.mode = BODY_FORMAT.JSON;
this.$nextTick(() => {
if (this.$refs.modeDropdown) {
@ -141,46 +138,46 @@
return this.response && this.response.responseResult ? this.response.responseResult : {};
}
}
}
}
</script>
<style scoped>
.text-container .icon {
.text-container .icon {
padding: 5px;
}
}
.text-container .collapse {
.text-container .collapse {
cursor: pointer;
}
}
.text-container .collapse:hover {
.text-container .collapse:hover {
opacity: 0.8;
}
}
.text-container .icon.is-active {
.text-container .icon.is-active {
transform: rotate(90deg);
}
}
.text-container .pane {
.text-container .pane {
background-color: #F5F5F5;
padding: 1px 0;
height: 250px;
overflow-y: auto;
}
}
.text-container .pane.cookie {
.text-container .pane.cookie {
padding: 0;
}
}
/deep/ .el-tabs__nav-wrap::after {
/deep/ .el-tabs__nav-wrap::after {
height: 0px;
}
}
.ms-div {
.ms-div {
margin-top: 20px;
}
}
pre {
pre {
margin: 0;
}
}
</style>