refactor(接口测试): 优化场景断言,添加断言后置顶 (#13629)
Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
parent
c3ec256a59
commit
7fede2760c
|
@ -395,6 +395,7 @@ import {
|
|||
} from "@/business/components/api/automation/api-automation";
|
||||
import MsComponentConfig from "./component/ComponentConfig";
|
||||
import {ENV_TYPE} from "@/common/js/constants";
|
||||
import {hisDataProcessing} from "@/business/components/api/definition/api-definition";
|
||||
|
||||
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
|
||||
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
|
||||
|
@ -1134,7 +1135,21 @@ export default {
|
|||
}
|
||||
},
|
||||
addComponent(type, plugin) {
|
||||
setComponent(type, this, plugin);
|
||||
let isAssertions = false;
|
||||
if (type === 'Assertions') {
|
||||
this.scenarioDefinition.forEach(item => {
|
||||
if (item.type === type) {
|
||||
item.active = true;
|
||||
isAssertions = true;
|
||||
return;
|
||||
}
|
||||
})
|
||||
if (!isAssertions) {
|
||||
setComponent(type, this, plugin);
|
||||
}
|
||||
} else {
|
||||
setComponent(type, this, plugin);
|
||||
}
|
||||
},
|
||||
nodeClick(data, node) {
|
||||
if ((data.referenced != 'REF' && data.referenced != 'Deleted' && !data.disabled && this.stepFilter) || data.refType === 'CASE') {
|
||||
|
@ -1622,7 +1637,7 @@ export default {
|
|||
} else {
|
||||
this.onSampleError = obj.onSampleError;
|
||||
}
|
||||
this.dataProcessing(obj.hashTree);
|
||||
this.dataProcessing(obj.hashTree, obj);
|
||||
this.scenarioDefinition = obj.hashTree;
|
||||
}
|
||||
}
|
||||
|
@ -1664,9 +1679,16 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
dataProcessing(stepArray) {
|
||||
dataProcessing(stepArray, obj) {
|
||||
if (stepArray) {
|
||||
for (let i in stepArray) {
|
||||
if (stepArray[i].type === "Assertions") {
|
||||
hisDataProcessing(stepArray, obj)
|
||||
let assertions = stepArray[i];
|
||||
stepArray.splice(i, 1);
|
||||
stepArray.unshift(assertions);
|
||||
this.sort();
|
||||
}
|
||||
let typeArray = ["JDBCPostProcessor", "JDBCSampler", "JDBCPreProcessor"]
|
||||
if (typeArray.indexOf(stepArray[i].type) !== -1) {
|
||||
stepArray[i].originalDataSourceId = stepArray[i].dataSourceId;
|
||||
|
@ -1682,7 +1704,7 @@ export default {
|
|||
};
|
||||
}
|
||||
if (stepArray[i].hashTree.length > 0) {
|
||||
this.dataProcessing(stepArray[i].hashTree);
|
||||
this.dataProcessing(stepArray[i].hashTree, stepArray[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@
|
|||
|
||||
<slot name="button" v-if="showVersion"></slot>
|
||||
|
||||
<el-button v-if="showVersion" size="mini" icon="el-icon-copy-document" circle @click="copyRow" style="padding: 5px"
|
||||
<el-button v-if="showVersion && showCopy" size="mini" icon="el-icon-copy-document" circle @click="copyRow"
|
||||
style="padding: 5px"
|
||||
:disabled="(data.disabled && !data.root) || !showVersion "/>
|
||||
|
||||
<el-button v-show="isSingleButton" size="mini" icon="el-icon-delete" type="danger" style="padding: 5px" circle @click="remove"
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
:show-btn="showBtn"
|
||||
:inner-step="innerStep"
|
||||
:show-version="showVersion"
|
||||
:show-copy="false"
|
||||
color="#A30014"
|
||||
background-color="#F7E6E9"
|
||||
:title="$t('api_test.definition.request.scenario_assertions')">
|
||||
|
|
Loading…
Reference in New Issue