fix(接口自动化): 接口相关问题修复

This commit is contained in:
fit2-zhao 2021-05-25 11:33:05 +08:00 committed by fit2-zhao
parent 7572ccdcbb
commit f3fe0d7450
9 changed files with 41 additions and 13 deletions

View File

@ -45,6 +45,9 @@ public class StatusReference {
statusMap.put("DELETE", "删除"); statusMap.put("DELETE", "删除");
statusMap.put("false", ""); statusMap.put("false", "");
statusMap.put("true", ""); statusMap.put("true", "");
statusMap.put("functional", "功能用例");
statusMap.put("performance", "性能用例");
statusMap.put("api", "接口用例");
} }

View File

@ -17,6 +17,7 @@ public class TestCaseReference {
testCaseColumns.put("method", "请求类型"); testCaseColumns.put("method", "请求类型");
testCaseColumns.put("prerequisite", "前置条件"); testCaseColumns.put("prerequisite", "前置条件");
testCaseColumns.put("remark", "备注"); testCaseColumns.put("remark", "备注");
testCaseColumns.put("customNum", "ID");
testCaseColumns.put("steps", "用例步骤"); testCaseColumns.put("steps", "用例步骤");
testCaseColumns.put("other_test_name", "其他名称"); testCaseColumns.put("other_test_name", "其他名称");
testCaseColumns.put("review_status", "评审状态"); testCaseColumns.put("review_status", "评审状态");

View File

@ -400,6 +400,7 @@ export default {
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
this.currentPage = 1;
this.condition.selectAll = false; this.condition.selectAll = false;
this.condition.unSelectIds = []; this.condition.unSelectIds = [];
this.selectDataCounts = 0; this.selectDataCounts = 0;

View File

@ -162,7 +162,7 @@
:allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable ref="stepTree"> :allow-drop="allowDrop" @node-drag-end="allowDrag" @node-click="nodeClick" v-if="!loading" draggable ref="stepTree">
<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%">
<!-- 步骤组件--> <!-- 步骤组件-->
<ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario" <ms-component-config :type="data.type" :scenario="data" :response="response" :currentScenario="currentScenario" :expandedNode="expandedNode"
:currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap" :currentEnvironmentId="currentEnvironmentId" :node="node" :project-list="projectList" :env-map="projectEnvMap"
@remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"/> @remove="remove" @copyRow="copyRow" @suggestClick="suggestClick" @refReload="refReload" @openScenario="openScenario"/>
</span> </span>

View File

@ -23,7 +23,7 @@
<template v-slot:button> <template v-slot:button>
<el-tooltip :content="$t('api_test.run')" placement="top"> <el-tooltip :content="$t('api_test.run')" placement="top">
<el-button @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/> <el-button :disabled="!request.enable" @click="run" icon="el-icon-video-play" style="padding: 5px" class="ms-btn" size="mini" circle/>
</el-tooltip> </el-tooltip>
</template> </template>
@ -118,6 +118,7 @@
}, },
currentEnvironmentId: String, currentEnvironmentId: String,
projectList: Array, projectList: Array,
expandedNode: Array,
envMap: Map envMap: Map
}, },
components: { components: {
@ -328,6 +329,13 @@
if (this.node) { if (this.node) {
this.node.expanded = this.request.active; this.node.expanded = this.request.active;
} }
if (this.node.expanded && this.expandedNode.indexOf(this.request.resourceId) === -1) {
this.expandedNode.push(this.request.resourceId);
} else {
if (this.expandedNode.indexOf(this.request.resourceId) !== -1) {
this.expandedNode.splice(this.expandedNode.indexOf(this.request.resourceId), 1);
}
}
this.reload(); this.reload();
}, },
run() { run() {

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="request-form"> <div class="request-form">
<keep-alive> <keep-alive>
<component v-bind:is="component" :isMax="isMax" :show-btn="showBtn" <component v-bind:is="component" :isMax="isMax" :show-btn="showBtn" :expandedNode="expandedNode"
:scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node" :scenario="scenario" :controller="scenario" :timer="scenario" :assertions="scenario" :extract="scenario" :jsr223-processor="scenario" :request="scenario" :currentScenario="currentScenario" :currentEnvironmentId="currentEnvironmentId" :node="node"
:draggable="draggable" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response" :draggable="draggable" :title="title" :color="titleColor" :background-color="backgroundColor" @suggestClick="suggestClick(node)" :response="response"
@remove="remove" @copyRow="copyRow" @refReload="refReload" @openScenario="openScenario" :project-list="projectList" :env-map="envMap"/> @remove="remove" @copyRow="copyRow" @refReload="refReload" @openScenario="openScenario" :project-list="projectList" :env-map="envMap"/>
@ -12,7 +12,7 @@
<script> <script>
import MsConstantTimer from "./ConstantTimer"; import MsConstantTimer from "./ConstantTimer";
import MsIfController from "./IfController"; import MsIfController from "./IfController";
import MsTransactionController from "./TransactionController"; import MsTransactionController from "./TransactionController";
import {ELEMENT_TYPE} from "../Setting"; import {ELEMENT_TYPE} from "../Setting";
import MsJsr233Processor from "./Jsr233Processor"; import MsJsr233Processor from "./Jsr233Processor";
import MsApiAssertions from "../../../definition/components/assertion/ApiAssertions"; import MsApiAssertions from "../../../definition/components/assertion/ApiAssertions";
@ -24,7 +24,7 @@
export default { export default {
name: "ComponentConfig", name: "ComponentConfig",
components: {MsConstantTimer, MsIfController, MsTransactionController,MsJsr233Processor, MsApiAssertions, MsApiExtract, MsApiComponent, MsLoopController, MsApiScenarioComponent, JmeterElementComponent}, components: {MsConstantTimer, MsIfController, MsTransactionController, MsJsr233Processor, MsApiAssertions, MsApiExtract, MsApiComponent, MsLoopController, MsApiScenarioComponent, JmeterElementComponent},
props: { props: {
type: String, type: String,
scenario: {}, scenario: {},
@ -41,6 +41,7 @@
default: true, default: true,
}, },
currentScenario: {}, currentScenario: {},
expandedNode: Array,
currentEnvironmentId: String, currentEnvironmentId: String,
response: {}, response: {},
node: {}, node: {},

View File

@ -17,7 +17,7 @@
</template> </template>
<template v-slot:button> <template v-slot:button>
<el-button @click="runDebug" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;padding: 5px" size="mini" circle/> <el-button @click="runDebug" :disabled="!controller.enable" :tip="$t('api_test.run')" icon="el-icon-video-play" style="background-color: #409EFF;color: white;padding: 5px" size="mini" circle/>
</template> </template>
<div v-if="controller.loopType==='LOOP_COUNT'" draggable> <div v-if="controller.loopType==='LOOP_COUNT'" draggable>
<el-row> <el-row>
@ -319,7 +319,7 @@
this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios !== null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : ""; this.activeName = this.requestResult && this.requestResult.scenarios && this.requestResult.scenarios !== null && this.requestResult.scenarios.length > 0 ? this.requestResult.scenarios[0].name : "";
// //
this.setResult(this.controller.hashTree); this.setResult(this.controller.hashTree);
this.$emit("refReload",this.node); this.$emit("refReload", this.node);
} catch (e) { } catch (e) {
throw e; throw e;
} }

View File

@ -427,11 +427,13 @@ export default {
watch: { watch: {
selectNodeIds() { selectNodeIds() {
initCondition(this.condition, false); initCondition(this.condition, false);
this.currentPage = 1;
this.condition.moduleIds = []; this.condition.moduleIds = [];
this.condition.moduleIds.push(this.selectNodeIds); this.condition.moduleIds.push(this.selectNodeIds);
this.initTable(); this.initTable();
}, },
currentProtocol() { currentProtocol() {
this.currentPage = 1;
initCondition(this.condition, false); initCondition(this.condition, false);
this.initTable(); this.initTable();
}, },

View File

@ -19,25 +19,36 @@
<el-table-column prop="columnTitle" :label="$t('operating_log.change_field')" width="150px" show-overflow-tooltip/> <el-table-column prop="columnTitle" :label="$t('operating_log.change_field')" width="150px" show-overflow-tooltip/>
<el-table-column prop="originalValue" :label="$t('operating_log.before_change')" width="400px" show-overflow-tooltip> <el-table-column prop="originalValue" :label="$t('operating_log.before_change')" width="400px" show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<pre>{{scope.row.originalValue}} </pre> <span v-if="timeDates.indexOf(scope.row.columnName)!==-1">{{ scope.row.originalValue | timestampFormatDate }}</span>
<pre v-else>{{ scope.row.originalValue }}</pre>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="newValue" :label="$t('operating_log.after_change')" width="400px" show-overflow-tooltip> <el-table-column prop="newValue" :label="$t('operating_log.after_change')" width="400px" show-overflow-tooltip>
<template v-slot:default="scope"> <template v-slot:default="scope">
<pre>{{scope.row.newValue}} </pre> <span v-if="timeDates.indexOf(scope.row.columnName)!==-1">{{ scope.row.newValue | timestampFormatDate }}</span>
<pre v-else>{{ scope.row.newValue }}</pre>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
<div v-else-if="detail && (detail.operType ==='DELETE' || detail.details === null || (detail.details && detail.details.columns && detail.details.columns.length === 0))"> <div v-else-if="detail && (detail.operType ==='DELETE' || detail.details === null || (detail.details && detail.details.columns && detail.details.columns.length === 0))">
<pre>{{detail.operTitle}} </pre> <pre style="overflow: auto">{{detail.operTitle}} </pre>
<span style="color: #409EFF">{{getType(detail.operType)}} </span> <span style="color: #409EFF">{{getType(detail.operType)}} </span>
<span style="color: #409EFF"> {{$t('api_test.home_page.detail_card.success')}}</span> <span style="color: #409EFF"> {{$t('api_test.home_page.detail_card.success')}}</span>
</div> </div>
<div v-else> <div v-else>
<div v-if="detail && detail.details && detail.details.columns" style="margin-left: 20px"> <div v-if="detail && detail.details && detail.details.columns" style="overflow: auto">
<pre style="overflow: auto" v-for="n in detail.details.columns" :key="n.id">{{n.columnTitle}}{{n.originalValue}}</pre> <span v-for="n in detail.details.columns" :key="n.id">
<pre v-if="timeDates.indexOf(n.columnName)!==-1">
{{n.columnTitle}}{{ n.originalValue | timestampFormatDate }}
</pre>
<pre style="overflow: auto" v-else>
{{n.columnTitle}}{{n.originalValue}}
</pre>
</span>
</div> </div>
</div> </div>
</div> </div>
@ -101,7 +112,8 @@
['BATCH_RESTORE', "批量恢复"], ['BATCH_RESTORE', "批量恢复"],
['BATCH_GC', "批量回收"], ['BATCH_GC', "批量回收"],
['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')], ['UN_ASSOCIATE_CASE', this.$t('test_track.case.unlink')],
]) ]),
timeDates: ["plannedStartTime", "plannedEndTime", "startTime", "endTime"],
} }
}, },
methods: { methods: {