fix(接口测试): 修复增加文档结构后另存新用例问题

--bug=1008041 --user=赵勇 【接口定义】-TEST中添加文档结构断言后-另存为新用例报错且CASE中没有添加的断言规则 https://www.tapd.cn/55049933/s/1070121
This commit is contained in:
fit2-zhao 2021-11-18 19:21:22 +08:00 committed by fit2-zhao
parent 3e33ef293d
commit 491afb54ca
3 changed files with 17 additions and 6 deletions

View File

@ -152,13 +152,13 @@ export default {
methods: {
setJSONData(data) {
this.checked = false;
this.document.data.jsonFollowAPI = "";
this.document.data.xmlFollowAPI = "";
this.tableData = data;
if (this.document.type === "JSON") {
this.document.data.json = this.tableData;
this.document.data.jsonFollowAPI = this.apiId;
} else if (this.document.type === "XML") {
this.document.data.xml = this.tableData;
this.document.data.xmlFollowAPI = this.apiId;
}
},
checkedAPI() {

View File

@ -99,7 +99,6 @@ export default {
let url = "/api/definition/jsonGenerator";
this.$post(url, {raw: this.json, type: this.document.type}, response => {
if (response.data) {
console.log(response.data)
this.$emit('setJSONData', response.data);
}
});

View File

@ -1,5 +1,5 @@
<template>
<div v-if="request.hashTree && request.hashTree.length > 0">
<div v-if="loaded">
<p class="tip">
{{ $t('test_track.plan_view.step') }}
</p>
@ -120,6 +120,11 @@ export default {
default: false
}
},
watch: {
'request.body.typeChange'() {
this.showHide();
},
},
data() {
let validateURL = (rule, value, callback) => {
try {
@ -130,6 +135,7 @@ export default {
};
return {
activeName: "headers",
loaded: true,
rules: {
name: [
{max: 300, message: this.$t('commons.input_limit', [1, 300]), trigger: 'blur'}
@ -171,7 +177,7 @@ export default {
this.reload();
},
addAssertions() {
let assertions = new Assertions({id:getUUID()});
let assertions = new Assertions({id: getUUID()});
if (!this.request.hashTree) {
this.request.hashTree = [];
}
@ -179,7 +185,7 @@ export default {
this.reload();
},
addExtract() {
let jsonPostProcessor = new Extract({id:getUUID()});
let jsonPostProcessor = new Extract({id: getUUID()});
if (!this.request.hashTree) {
this.request.hashTree = [];
}
@ -208,6 +214,12 @@ export default {
this.isReloadData = false
})
},
showHide() {
this.loaded = false
this.$nextTick(() => {
this.loaded = true
})
},
init() {
if (!this.request.body) {
this.request.body = new Body();