feat(修改系统参数): mock期望设置响应代码中json-schema增加请求参数的选项
mock期望设置响应代码中json-schema增加请求参数的选项
This commit is contained in:
parent
f26cff3372
commit
b9e7250525
|
@ -39,7 +39,8 @@
|
|||
</el-tab-pane>
|
||||
|
||||
<!--场景自定义变量-->
|
||||
<el-tab-pane :label="$t('api_test.automation.scenario_total')" name="variable" v-if="scenarioDefinition != undefined">
|
||||
<el-tab-pane :label="$t('api_test.automation.scenario_total')" name="variable"
|
||||
v-if="scenarioDefinition != undefined">
|
||||
<div>
|
||||
<el-row style="margin-bottom: 10px">
|
||||
<div style="float: left">
|
||||
|
@ -149,10 +150,12 @@
|
|||
<div v-for="(item, index) in scenarioPreRequestParams" :key="index" class="kv-row item">
|
||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||
<el-col class="item">
|
||||
<el-input v-model="item.name" size="small" :readonly="true" @click.native="savePreParams(item.name)"/>
|
||||
<el-input v-model="item.name" size="small" :readonly="true"
|
||||
@click.native="savePreParams(item.name)"/>
|
||||
</el-col>
|
||||
<el-col class="item">
|
||||
<el-input v-model="item.exp" size="small" :readonly="true" @click.native="savePreParams(item.name)"/>
|
||||
<el-input v-model="item.exp" size="small" :readonly="true"
|
||||
@click.native="savePreParams(item.name)"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
|
@ -178,6 +181,22 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane :label="$t('api_test.definition.document.request_info')" v-if="showMockVars">
|
||||
<el-row>
|
||||
<el-col :span="18" class="col-height">
|
||||
<div>
|
||||
<h1>{{ $t('api_test.definition.document.request_info') }}</h1>
|
||||
<el-table border :data="requestValues"
|
||||
class="adjust-table table-content"
|
||||
@row-click="handleRowClick">
|
||||
<el-table-column prop="type" :label="$t('commons.name')" width="150"/>
|
||||
<el-table-column prop="name" :label="$t('api_test.value')" width="250"/>
|
||||
</el-table>
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
<div style="padding-top: 10px;">
|
||||
<el-row type="flex" align="bottom">
|
||||
|
@ -229,6 +248,12 @@
|
|||
return false;
|
||||
}
|
||||
},
|
||||
showMockVars: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
variables: Array,
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
|
@ -275,12 +300,41 @@
|
|||
{name: "number"}
|
||||
],
|
||||
mockFuncs: MOCKJS_FUNC.map(f => {
|
||||
return {name: f.name + " " + f.des + " " + this.$t('api_test.request.parameters_filter_example') + ":" + f.ex, value: f.name}
|
||||
return {
|
||||
name: f.name + " " + f.des + " " + this.$t('api_test.request.parameters_filter_example') + ":" + f.ex,
|
||||
value: f.name
|
||||
}
|
||||
}),
|
||||
jmeterFuncs: JMETER_FUNC,
|
||||
mockVariableFuncs: [],
|
||||
jmeterVariableFuncs: [],
|
||||
dialogVisible: true,
|
||||
requestValues: [
|
||||
{
|
||||
type: this.$t('api_test.request.address'),
|
||||
name: "${address}"
|
||||
},
|
||||
{
|
||||
type: "Header " + this.$t('api_test.definition.document.request_param'),
|
||||
name: "${header.param}"
|
||||
},
|
||||
{
|
||||
type: this.$t('api_test.request.body') + this.$t('api_test.variable'),
|
||||
name: "${body.param}"
|
||||
},
|
||||
{
|
||||
type: this.$t('api_test.request.body') + this.$t('api_test.variable') + " (Raw)",
|
||||
name: "${bodyRaw}"
|
||||
},
|
||||
{
|
||||
type: "Query " + this.$t('api_test.definition.document.request_param'),
|
||||
name: "${query.param}"
|
||||
},
|
||||
{
|
||||
type: "Rest " + this.$t('api_test.definition.document.request_param'),
|
||||
name: "${rest.param}"
|
||||
},
|
||||
],
|
||||
|
||||
// 自定义变量相关
|
||||
defineVariable: "",
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
<ms-json-code-edit
|
||||
v-if="body.format==='JSON-SCHEMA'"
|
||||
:body="body"
|
||||
:show-mock-vars="true"
|
||||
ref="jsonCodeEdit"/>
|
||||
<ms-code-edit
|
||||
v-else-if="codeEditActive && loadIsOver"
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</template>
|
||||
</el-input>
|
||||
<el-autocomplete :disabled="isReadOnly" v-if="suggestions" v-model="item.name" size="small"
|
||||
:fetch-suggestions="querySearch" @change="change" :placeholder="keyText" show-word-limit>
|
||||
:fetch-suggestions="querySearch" @input="change" @change="change" :placeholder="keyText" show-word-limit>
|
||||
<template v-slot:prepend>
|
||||
<el-select v-if="type === 'body'" :disabled="isReadOnly" class="kv-type" v-model="item.type"
|
||||
@change="typeChange(item)">
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div style="min-height: 200px">
|
||||
<json-schema-editor class="schema"
|
||||
:value="schema"
|
||||
:show-mock-vars="showMockVars"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
lang="zh_CN" custom/>
|
||||
|
@ -39,6 +40,12 @@
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
showMockVars: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
scenarioDefinition: Array,
|
||||
},
|
||||
created() {
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<ms-mock :disabled="pickValue.type==='object' || pickKey ==='root' || pickValue.type==='array' || pickValue.type==='null'"
|
||||
:schema="pickValue"
|
||||
:scenario-definition="scenarioDefinition"
|
||||
:show-mock-vars="showMockVars"
|
||||
@editScenarioAdvance="editScenarioAdvance"/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
|
@ -46,6 +47,7 @@
|
|||
<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"
|
||||
:show-mock-vars="showMockVars"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType" @reloadItems="reloadItems"/>
|
||||
</template>
|
||||
|
@ -53,6 +55,7 @@
|
|||
<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"
|
||||
:show-mock-vars="showMockVars"
|
||||
@editScenarioAdvance="editScenarioAdvance"
|
||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
|
||||
</template>
|
||||
|
@ -108,6 +111,12 @@ export default {
|
|||
type: Object,
|
||||
required: true
|
||||
},
|
||||
showMockVars: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
disabled: { //name不可编辑,根节点name不可编辑,数组元素name不可编辑
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
@select="change">
|
||||
<i slot="suffix" class="el-input__icon el-icon-edit pointer" @click="advanced(mock)"></i>
|
||||
</el-autocomplete>
|
||||
<ms-api-variable-advance :scenario-definition="scenarioDefinition" :current-item="mock" ref="variableAdvance"/>
|
||||
<ms-api-variable-advance :show-mock-vars="showMockVars" :scenario-definition="scenarioDefinition" :current-item="mock" ref="variableAdvance"/>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
@ -32,6 +32,12 @@
|
|||
},
|
||||
disabled: Boolean,
|
||||
scenarioDefinition: Array,
|
||||
showMockVars: {
|
||||
type: Boolean,
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
|
Loading…
Reference in New Issue