fix(接口自动化): 测试报告优化

This commit is contained in:
fit2-zhao 2020-12-16 15:30:34 +08:00
parent a73b202551
commit 48e6e82451
4 changed files with 48 additions and 62 deletions

View File

@ -17,15 +17,21 @@
<el-col :span="5">
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
<div class="url" style="color: #5daf34">{{ request.responseResult.responseCode }}</div>
<div style="color: #5daf34" v-if="request.success">{{ request.responseResult.responseCode }}</div>
<div style="color: #FE6F71" v-else>{{ request.responseResult.responseCode }}</div>
</el-tooltip>
</el-col>
<el-col :span="3">
<span v-if="request.success">
{{request.responseResult.responseTime}} ms
</span>
<span style="color: #FE6F71" v-else>
{{request.responseResult.responseTime}} ms
</span>
</el-col>
<el-col :span="2">
<div class="success">
<div>
<el-tag size="mini" type="success" v-if="request.success">
{{ $t('api_report.success') }}
</el-tag>

View File

@ -8,33 +8,10 @@
</div>
</el-col>
<el-col :span="10">
<div class="name">{{request.name}}</div>
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
<div class="url">{{request.url}}</div>
</el-tooltip>
</el-col>
<el-col :span="4">
{{request.startTime | timestampFormatDate(true) }}
</el-col>
<el-col :span="2">
<div class="time">
{{request.responseResult.responseTime}}
</div>
</el-col>
<el-col :span="2">
{{request.error}}
</el-col>
<el-col :span="2">
{{assertion}}
</el-col>
<el-col :span="2">
<el-tag size="mini" type="success" v-if="request.success">
{{$t('api_report.success')}}
</el-tag>
<el-tag size="mini" type="danger" v-else>
{{$t('api_report.fail')}}
</el-tag>
</el-col>
</el-row>
</div>
<el-collapse-transition>
@ -52,7 +29,6 @@
</el-tab-pane>
</el-tabs>
<div v-else>
<ms-request-metric :request="request"/>
<ms-request-text v-if="isCodeEditAlive" :request="request"/>
<br>
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>

View File

@ -32,6 +32,7 @@
methods: {
setFiles(item, bodyUploadFiles, obj) {
if (item.body) {
if (item.body.kvs) {
item.body.kvs.forEach(param => {
if (param.files) {
param.files.forEach(item => {
@ -47,6 +48,8 @@
});
}
});
}
if (item.body.binary) {
item.body.binary.forEach(param => {
if (param.files) {
param.files.forEach(item => {
@ -63,6 +66,7 @@
}
});
}
}
},
recursiveFile(arr, bodyUploadFiles, obj) {
arr.forEach(item => {

View File

@ -113,7 +113,7 @@
</el-form>
<!-- 场景步骤-->
<div v-loading="isReloadData">
<div v-loading="loading">
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
<el-row>
<el-col :span="21">
@ -157,13 +157,13 @@
</el-row>
</div>
<!-- 场景步骤内容 -->
<div style="margin-top: 10px" v-loading="isReloadData">
<div style="margin-top: 10px" v-loading="loading">
<el-tree node-key="resourceId" :props="props" :data="scenarioDefinition"
:default-expanded-keys="expandedNode"
:expand-on-click-node="false"
@node-expand="nodeExpand"
@node-collapse="nodeCollapse"
:allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!isReloadData" draggable>
:allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable>
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
<template>
<!-- 场景 -->
@ -344,7 +344,7 @@
options: API_STATUS,
levels: PRIORITY,
scenario: {},
isReloadData: false,
loading: false,
apiListVisible: false,
customizeVisible: false,
scenarioVisible: false,
@ -565,9 +565,9 @@
this.reload();
},
reload() {
this.isReloadData = true
this.loading = true
this.$nextTick(() => {
this.isReloadData = false
this.loading = false
})
},
runDebug() {
@ -744,7 +744,7 @@
},
runRefresh() {
this.debugVisible = true;
this.isReloadData = false;
this.loading = false;
},
showScenarioParameters() {
this.$refs.scenarioParameters.open(this.currentScenario.variables);