Merge branch 'master' of https://github.com/metersphere/metersphere
This commit is contained in:
commit
2dee505e53
|
@ -13,4 +13,5 @@ public class ApiTestCaseResult extends ApiTestCaseWithBLOBs {
|
|||
private String execResult;
|
||||
private Long execTime;
|
||||
private boolean active = false;
|
||||
private boolean responseActive = false;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,17 @@
|
|||
<ms-tcp-basis-parameters :request="apiCase.request" v-if="api.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="apiCase.request" v-if="api.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="apiCase.request" v-if="api.protocol==='DUBBO'"/>
|
||||
|
||||
<!-- HTTP 请求返回数据 -->
|
||||
<p class="tip">
|
||||
{{$t('api_test.definition.request.res_param')}}
|
||||
<i class="icon el-icon-arrow-right" :class="{'is-responseActive': apiCase.responseActive}" @click="responseActive(apiCase)"/>
|
||||
</p>
|
||||
<el-collapse-transition>
|
||||
<div v-if="apiCase.responseActive">
|
||||
<ms-request-result-tail :response="responseData"/>
|
||||
</div>
|
||||
</el-collapse-transition>
|
||||
<!-- 保存操作 -->
|
||||
<el-button type="primary" size="small" style="margin: 20px; float: right" @click="saveTestCase(apiCase)" v-tester>
|
||||
{{ $t('commons.save') }}
|
||||
|
@ -81,20 +92,21 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {getCurrentProjectID, getUUID} from "../../../../../../common/js/utils";
|
||||
import {PRIORITY, RESULT_MAP} from "../../model/JsonData";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsTipButton from "../../../../common/components/MsTipButton";
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
|
||||
import MsApiAssertions from "../assertion/ApiAssertions";
|
||||
import MsSqlBasisParameters from "../request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
import {getCurrentProjectID, getUUID} from "../../../../../../common/js/utils";
|
||||
import {PRIORITY, RESULT_MAP} from "../../model/JsonData";
|
||||
import MsTag from "../../../../common/components/MsTag";
|
||||
import MsTipButton from "../../../../common/components/MsTipButton";
|
||||
import MsApiRequestForm from "../request/http/ApiRequestForm";
|
||||
import ApiEnvironmentConfig from "../environment/ApiEnvironmentConfig";
|
||||
import MsApiAssertions from "../assertion/ApiAssertions";
|
||||
import MsSqlBasisParameters from "../request/database/BasisParameters";
|
||||
import MsTcpBasisParameters from "../request/tcp/TcpBasisParameters";
|
||||
import MsDubboBasisParameters from "../request/dubbo/BasisParameters";
|
||||
import MsApiExtendBtns from "../reference/ApiExtendBtns";
|
||||
import MsInputTag from "@/business/components/api/automation/scenario/MsInputTag";
|
||||
import MsRequestResultTail from "../response/RequestResultTail";
|
||||
|
||||
export default {
|
||||
export default {
|
||||
name: "ApiCaseItem",
|
||||
components: {
|
||||
MsInputTag,
|
||||
|
@ -106,7 +118,8 @@ export default {
|
|||
MsSqlBasisParameters,
|
||||
MsTcpBasisParameters,
|
||||
MsDubboBasisParameters,
|
||||
MsApiExtendBtns
|
||||
MsApiExtendBtns,
|
||||
MsRequestResultTail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -120,6 +133,7 @@ export default {
|
|||
checkedCases: new Set(),
|
||||
visible: false,
|
||||
condition: {},
|
||||
responseData: {type: 'HTTP', responseResult: {}, subRequestResults: []},
|
||||
isShowInput: false,
|
||||
}
|
||||
},
|
||||
|
@ -128,7 +142,7 @@ export default {
|
|||
type: Object,
|
||||
default() {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
},
|
||||
environment: {},
|
||||
index: {
|
||||
|
@ -147,7 +161,6 @@ export default {
|
|||
},
|
||||
watch: {},
|
||||
methods: {
|
||||
|
||||
deleteCase(index, row) {
|
||||
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ?", '', {
|
||||
confirmButtonText: this.$t('commons.confirm'),
|
||||
|
@ -162,6 +175,18 @@ export default {
|
|||
});
|
||||
|
||||
},
|
||||
getExecResult() {
|
||||
// 执行结果信息
|
||||
if (this.apiCase) {
|
||||
let url = "/api/definition/report/getReport/" + this.apiCase.id;
|
||||
this.$get(url, response => {
|
||||
if (response.data) {
|
||||
let data = JSON.parse(response.data.content);
|
||||
this.responseData = data;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
singleRun(data) {
|
||||
this.$emit('singleRun', data);
|
||||
},
|
||||
|
@ -228,6 +253,12 @@ export default {
|
|||
active(item) {
|
||||
item.active = !item.active;
|
||||
},
|
||||
responseActive(item) {
|
||||
item.responseActive = !item.responseActive;
|
||||
if (item.responseActive) {
|
||||
this.getExecResult();
|
||||
}
|
||||
},
|
||||
getResult(data) {
|
||||
if (RESULT_MAP.get(data)) {
|
||||
return RESULT_MAP.get(data);
|
||||
|
@ -281,44 +312,48 @@ export default {
|
|||
return bodyUploadFiles;
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.ms-api-select {
|
||||
.ms-api-select {
|
||||
margin-left: 20px;
|
||||
width: 80px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-api-header-select {
|
||||
.ms-api-header-select {
|
||||
margin-left: 20px;
|
||||
min-width: 100px;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-api-label {
|
||||
.ms-api-label {
|
||||
color: #CCCCCC;
|
||||
}
|
||||
}
|
||||
|
||||
.ms-api-col {
|
||||
.ms-api-col {
|
||||
background-color: #7C3985;
|
||||
border-color: #7C3985;
|
||||
margin-right: 10px;
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
|
||||
.icon.is-active {
|
||||
.icon.is-active {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
}
|
||||
|
||||
.tip {
|
||||
.icon.is-responseActive {
|
||||
transform: rotate(90deg);
|
||||
}
|
||||
|
||||
.tip {
|
||||
padding: 3px 5px;
|
||||
font-size: 16px;
|
||||
border-radius: 4px;
|
||||
border-left: 4px solid #783887;
|
||||
margin: 20px 0;
|
||||
}
|
||||
}
|
||||
|
||||
.is-selected {
|
||||
.is-selected {
|
||||
background: #EFF7FF;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue