fix(接口自动化): 场景编辑中请求体里没有添加场景变量和前置返回问题修复
--bug=1009947 --user=周骏弘 【接口测试】场景编辑中,请求体里没有添加场景变量和前置返回 https://www.tapd.cn/55049933/s/1098399
This commit is contained in:
parent
1679ddf75e
commit
984efea721
|
@ -544,6 +544,9 @@
|
|||
this.$set(this.currentItem, 'value', '@' + this.itemValue);
|
||||
} else {
|
||||
this.$set(this.currentItem, 'value', this.itemValue);
|
||||
if(this.currentItem.mock != undefined){
|
||||
this.$set(this.currentItem, 'mock', this.itemValue);
|
||||
}
|
||||
}
|
||||
this.itemValueVisible = false;
|
||||
this.mockVariableFuncs = [];
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
:is-read-only="isReadOnly"
|
||||
:parameters="body.kvs"
|
||||
:isShowEnable="isShowEnable"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
type="body"/>
|
||||
</div>
|
||||
<div v-if="body.type == 'JSON'">
|
||||
|
@ -43,6 +45,8 @@
|
|||
<ms-json-code-edit
|
||||
v-if="body.format==='JSON-SCHEMA'"
|
||||
:body="body"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
ref="jsonCodeEdit"/>
|
||||
<ms-code-edit
|
||||
v-else-if="codeEditActive"
|
||||
|
@ -116,7 +120,8 @@ export default {
|
|||
isShowEnable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
},
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -315,6 +320,9 @@ export default {
|
|||
})
|
||||
}
|
||||
},
|
||||
editScenarioAdvance(data) {
|
||||
this.$emit('editScenarioAdvance', data);
|
||||
},
|
||||
},
|
||||
created() {
|
||||
if (!this.body.type) {
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
|
||||
<!--请求体-->
|
||||
<el-tab-pane v-if="isBodyShow" :label="$t('api_test.request.body')" name="body" style="overflow: auto">
|
||||
<ms-api-body @headersChange="reloadBody" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :headers="headers" :body="request.body"/>
|
||||
<ms-api-body @editScenarioAdvance="editScenarioAdvance" :scenario-definition="scenarioDefinition" @headersChange="reloadBody" :is-read-only="isReadOnly" :isShowEnable="isShowEnable" :headers="headers" :body="request.body"/>
|
||||
</el-tab-pane>
|
||||
|
||||
<!-- 认证配置 -->
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
{{ this.$t('commons.import') }}
|
||||
</el-button>
|
||||
<div style="min-height: 200px">
|
||||
<json-schema-editor class="schema" :value="schema" lang="zh_CN" custom/>
|
||||
<json-schema-editor class="schema"
|
||||
:value="schema"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
lang="zh_CN" custom/>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane v-if="showPreview" :label="$t('schema.preview')" name="preview">
|
||||
|
@ -35,6 +39,7 @@
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
created() {
|
||||
if (!this.body.jsonSchema && this.body.raw && this.checkIsJson(this.body.raw)) {
|
||||
|
@ -109,7 +114,10 @@
|
|||
this.schema.root = data;
|
||||
this.body.jsonSchema = this.schema.root;
|
||||
})
|
||||
}
|
||||
},
|
||||
editScenarioAdvance(data) {
|
||||
this.$emit('editScenarioAdvance', data);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -21,7 +21,10 @@
|
|||
</el-select>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<ms-mock :disabled="pickKey ==='root' || pickValue.type==='object' || pickValue.type==='array' || pickValue.type==='null'" :schema="pickValue"/>
|
||||
<ms-mock :disabled="pickValue.type==='object' || pickKey ==='root' || pickValue.type==='array' || pickValue.type==='null'"
|
||||
:schema="pickValue"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-input v-model="pickValue.description" class="ms-col-title" :placeholder="$t('schema.description')" size="small"/>
|
||||
|
@ -40,10 +43,18 @@
|
|||
</el-row>
|
||||
|
||||
<template v-if="!hidden&&pickValue.properties && !isArray && reloadItemOver">
|
||||
<json-schema-editor v-for="(item,key,index) in pickValue.properties" :value="{[key]:item}" :parent="pickValue" :key="index" :deep="deep+1" :root="false" class="children" :lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType" @reloadItems="reloadItems"/>
|
||||
<json-schema-editor v-for="(item,key,index) in pickValue.properties" :value="{[key]:item}"
|
||||
:parent="pickValue" :key="index" :deep="deep+1" :root="false" class="children"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType" @reloadItems="reloadItems"/>
|
||||
</template>
|
||||
<template v-if="isArray && reloadItemOver">
|
||||
<json-schema-editor v-for="(item,key,index) in pickValue.items" :value="{[key]:item}" :parent="pickValue" :key="index" :deep="deep+1" :root="false" class="children" :lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
|
||||
<json-schema-editor v-for="(item,key,index) in pickValue.items" :value="{[key]:item}" :parent="pickValue" :key="index"
|
||||
:deep="deep+1" :root="false" class="children"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
|
||||
</template>
|
||||
<!-- 高级设置-->
|
||||
<el-dialog append-to-body :close-on-click-modal="true" :title="$t('schema.adv_setting')" :visible.sync="modalVisible" :destroy-on-close="true"
|
||||
|
@ -128,7 +139,8 @@ export default {
|
|||
lang: { // i18n language
|
||||
type: String,
|
||||
default: 'zh_CN'
|
||||
}
|
||||
},
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
computed: {
|
||||
pickValue() {
|
||||
|
@ -172,6 +184,7 @@ export default {
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
TYPE_NAME,
|
||||
hidden: false,
|
||||
countAdd: 1,
|
||||
modalVisible: false,
|
||||
|
@ -336,7 +349,10 @@ export default {
|
|||
this.$nextTick(() => {
|
||||
this.reloadItemOver = true;
|
||||
})
|
||||
}
|
||||
},
|
||||
editScenarioAdvance(data) {
|
||||
this.$emit('editScenarioAdvance', data);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
value-key="name"
|
||||
highlight-first-item
|
||||
@select="change">
|
||||
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced()"></i>
|
||||
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced(mock)"></i>
|
||||
</el-autocomplete>
|
||||
|
||||
<ms-advance ref="variableAdvance" :current-item="mock"/>
|
||||
|
@ -31,6 +31,7 @@
|
|||
}
|
||||
},
|
||||
disabled: Boolean,
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -72,8 +73,14 @@
|
|||
},
|
||||
change: function () {
|
||||
},
|
||||
advanced() {
|
||||
this.$refs.variableAdvance.open();
|
||||
advanced(item) {
|
||||
this.mock = item;
|
||||
// 冒泡到父组件,调用父组件的参数设置打开方法
|
||||
if (this.scenarioDefinition != undefined) {
|
||||
this.$emit('editScenarioAdvance', this.mock);
|
||||
} else {
|
||||
this.$refs.variableAdvance.open();
|
||||
}
|
||||
},
|
||||
showEdit() {
|
||||
this.$emit('showEdit')
|
||||
|
@ -95,7 +102,10 @@
|
|||
state.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
editScenarioAdvance(data) {
|
||||
this.$emit('editScenarioAdvance', data);
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in New Issue