fix(接口自动化): 测试报告优化
This commit is contained in:
parent
a73b202551
commit
48e6e82451
|
@ -17,15 +17,21 @@
|
||||||
|
|
||||||
<el-col :span="5">
|
<el-col :span="5">
|
||||||
<el-tooltip effect="dark" :content="request.responseResult.responseCode" placement="bottom" :open-delay="800">
|
<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-tooltip>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="3">
|
<el-col :span="3">
|
||||||
{{request.responseResult.responseTime}} ms
|
<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>
|
||||||
|
|
||||||
<el-col :span="2">
|
<el-col :span="2">
|
||||||
<div class="success">
|
<div>
|
||||||
<el-tag size="mini" type="success" v-if="request.success">
|
<el-tag size="mini" type="success" v-if="request.success">
|
||||||
{{ $t('api_report.success') }}
|
{{ $t('api_report.success') }}
|
||||||
</el-tag>
|
</el-tag>
|
||||||
|
|
|
@ -8,33 +8,10 @@
|
||||||
</div>
|
</div>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="10">
|
<el-col :span="10">
|
||||||
<div class="name">{{request.name}}</div>
|
|
||||||
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
|
<el-tooltip effect="dark" :content="request.url" placement="bottom" :open-delay="800">
|
||||||
<div class="url">{{request.url}}</div>
|
<div class="url">{{request.url}}</div>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</el-col>
|
</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>
|
</el-row>
|
||||||
</div>
|
</div>
|
||||||
<el-collapse-transition>
|
<el-collapse-transition>
|
||||||
|
@ -52,7 +29,6 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<ms-request-metric :request="request"/>
|
|
||||||
<ms-request-text v-if="isCodeEditAlive" :request="request"/>
|
<ms-request-text v-if="isCodeEditAlive" :request="request"/>
|
||||||
<br>
|
<br>
|
||||||
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>
|
<ms-response-text :request-type="requestType" v-if="isCodeEditAlive" :response="request.responseResult"/>
|
||||||
|
|
|
@ -32,36 +32,40 @@
|
||||||
methods: {
|
methods: {
|
||||||
setFiles(item, bodyUploadFiles, obj) {
|
setFiles(item, bodyUploadFiles, obj) {
|
||||||
if (item.body) {
|
if (item.body) {
|
||||||
item.body.kvs.forEach(param => {
|
if (item.body.kvs) {
|
||||||
if (param.files) {
|
item.body.kvs.forEach(param => {
|
||||||
param.files.forEach(item => {
|
if (param.files) {
|
||||||
if (item.file) {
|
param.files.forEach(item => {
|
||||||
if (!item.id) {
|
if (item.file) {
|
||||||
let fileId = getUUID().substring(0, 12);
|
if (!item.id) {
|
||||||
item.name = item.file.name;
|
let fileId = getUUID().substring(0, 12);
|
||||||
item.id = fileId;
|
item.name = item.file.name;
|
||||||
|
item.id = fileId;
|
||||||
|
}
|
||||||
|
obj.bodyUploadIds.push(item.id);
|
||||||
|
bodyUploadFiles.push(item.file);
|
||||||
}
|
}
|
||||||
obj.bodyUploadIds.push(item.id);
|
});
|
||||||
bodyUploadFiles.push(item.file);
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
if (item.body.binary) {
|
||||||
});
|
item.body.binary.forEach(param => {
|
||||||
item.body.binary.forEach(param => {
|
if (param.files) {
|
||||||
if (param.files) {
|
param.files.forEach(item => {
|
||||||
param.files.forEach(item => {
|
if (item.file) {
|
||||||
if (item.file) {
|
if (!item.id) {
|
||||||
if (!item.id) {
|
let fileId = getUUID().substring(0, 12);
|
||||||
let fileId = getUUID().substring(0, 12);
|
item.name = item.file.name;
|
||||||
item.name = item.file.name;
|
item.id = fileId;
|
||||||
item.id = fileId;
|
}
|
||||||
|
obj.bodyUploadIds.push(item.id);
|
||||||
|
bodyUploadFiles.push(item.file);
|
||||||
}
|
}
|
||||||
obj.bodyUploadIds.push(item.id);
|
});
|
||||||
bodyUploadFiles.push(item.file);
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
recursiveFile(arr, bodyUploadFiles, obj) {
|
recursiveFile(arr, bodyUploadFiles, obj) {
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<!-- 场景步骤-->
|
<!-- 场景步骤-->
|
||||||
<div v-loading="isReloadData">
|
<div v-loading="loading">
|
||||||
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
|
<p class="tip">{{$t('api_test.automation.scenario_step')}} </p>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="21">
|
<el-col :span="21">
|
||||||
|
@ -157,13 +157,13 @@
|
||||||
</el-row>
|
</el-row>
|
||||||
</div>
|
</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"
|
<el-tree node-key="resourceId" :props="props" :data="scenarioDefinition"
|
||||||
:default-expanded-keys="expandedNode"
|
:default-expanded-keys="expandedNode"
|
||||||
:expand-on-click-node="false"
|
:expand-on-click-node="false"
|
||||||
@node-expand="nodeExpand"
|
@node-expand="nodeExpand"
|
||||||
@node-collapse="nodeCollapse"
|
@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%">
|
<span class="custom-tree-node father" slot-scope="{ node, data}" style="width: 96%">
|
||||||
<template>
|
<template>
|
||||||
<!-- 场景 -->
|
<!-- 场景 -->
|
||||||
|
@ -344,7 +344,7 @@
|
||||||
options: API_STATUS,
|
options: API_STATUS,
|
||||||
levels: PRIORITY,
|
levels: PRIORITY,
|
||||||
scenario: {},
|
scenario: {},
|
||||||
isReloadData: false,
|
loading: false,
|
||||||
apiListVisible: false,
|
apiListVisible: false,
|
||||||
customizeVisible: false,
|
customizeVisible: false,
|
||||||
scenarioVisible: false,
|
scenarioVisible: false,
|
||||||
|
@ -565,9 +565,9 @@
|
||||||
this.reload();
|
this.reload();
|
||||||
},
|
},
|
||||||
reload() {
|
reload() {
|
||||||
this.isReloadData = true
|
this.loading = true
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.isReloadData = false
|
this.loading = false
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
runDebug() {
|
runDebug() {
|
||||||
|
@ -744,7 +744,7 @@
|
||||||
},
|
},
|
||||||
runRefresh() {
|
runRefresh() {
|
||||||
this.debugVisible = true;
|
this.debugVisible = true;
|
||||||
this.isReloadData = false;
|
this.loading = false;
|
||||||
},
|
},
|
||||||
showScenarioParameters() {
|
showScenarioParameters() {
|
||||||
this.$refs.scenarioParameters.open(this.currentScenario.variables);
|
this.$refs.scenarioParameters.open(this.currentScenario.variables);
|
||||||
|
|
Loading…
Reference in New Issue