refactor(接口测试): 去掉mock的小铅笔
--bug=1017964 --user=王孝刚 【接口测试】mock期望 - 响应体中的mock和jmeter函数不生效 https://www.tapd.cn/55049933/s/1288723
This commit is contained in:
parent
f60fd53ffe
commit
6bd21b3314
|
@ -13,6 +13,7 @@
|
||||||
:show-mock-vars="showMockVars"
|
:show-mock-vars="showMockVars"
|
||||||
:scenario-definition="scenarioDefinition"
|
:scenario-definition="scenarioDefinition"
|
||||||
@editScenarioAdvance="editScenarioAdvance"
|
@editScenarioAdvance="editScenarioAdvance"
|
||||||
|
:need-mock="needMock"
|
||||||
lang="zh_CN" custom/>
|
lang="zh_CN" custom/>
|
||||||
</div>
|
</div>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
@ -54,6 +55,12 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
scenarioDefinition: Array,
|
scenarioDefinition: Array,
|
||||||
|
needMock: {
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
if (!this.body.jsonSchema && this.body.raw && this.checkIsJson(this.body.raw)) {
|
if (!this.body.jsonSchema && this.body.raw && this.checkIsJson(this.body.raw)) {
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
:schema="pickValue"
|
:schema="pickValue"
|
||||||
:scenario-definition="scenarioDefinition"
|
:scenario-definition="scenarioDefinition"
|
||||||
:show-mock-vars="showMockVars"
|
:show-mock-vars="showMockVars"
|
||||||
|
:need-mock="needMock"
|
||||||
@editScenarioAdvance="editScenarioAdvance"/>
|
@editScenarioAdvance="editScenarioAdvance"/>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
@editScenarioAdvance="editScenarioAdvance"
|
@editScenarioAdvance="editScenarioAdvance"
|
||||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"
|
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"
|
||||||
|
:need-mock="needMock"
|
||||||
@reloadItems="reloadItems"/>
|
@reloadItems="reloadItems"/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="!hidden && isArray(pickValue) && reloadItemOver">
|
<template v-if="!hidden && isArray(pickValue) && reloadItemOver">
|
||||||
|
@ -66,6 +68,7 @@
|
||||||
:scenario-definition="scenarioDefinition"
|
:scenario-definition="scenarioDefinition"
|
||||||
:show-mock-vars="showMockVars"
|
:show-mock-vars="showMockVars"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
|
:need-mock="needMock"
|
||||||
@editScenarioAdvance="editScenarioAdvance"
|
@editScenarioAdvance="editScenarioAdvance"
|
||||||
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
|
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -165,6 +168,10 @@ export default {
|
||||||
default: 'zh_CN'
|
default: 'zh_CN'
|
||||||
},
|
},
|
||||||
scenarioDefinition: Array,
|
scenarioDefinition: Array,
|
||||||
|
needMock: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
pickValue() {
|
pickValue() {
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
value-key="name"
|
value-key="name"
|
||||||
highlight-first-item
|
highlight-first-item
|
||||||
@select="change">
|
@select="change">
|
||||||
<i slot="suffix" v-if="!disabled" class="el-input__icon el-icon-edit pointer" @click="advanced(mock)"></i>
|
<i slot="suffix" v-if="!disabled && needMock" class="el-input__icon el-icon-edit pointer"
|
||||||
|
@click="advanced(mock)"></i>
|
||||||
</el-autocomplete>
|
</el-autocomplete>
|
||||||
<ms-api-variable-advance :show-mock-vars="showMockVars" :scenario-definition="scenarioDefinition"
|
<ms-api-variable-advance :show-mock-vars="showMockVars" :scenario-definition="scenarioDefinition"
|
||||||
:current-item="mock" ref="variableAdvance"/>
|
:current-item="mock" ref="variableAdvance"/>
|
||||||
|
@ -39,6 +40,12 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
needMock: {
|
||||||
|
type: Boolean,
|
||||||
|
default() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<ms-json-code-edit
|
<ms-json-code-edit
|
||||||
v-if="body.format==='JSON-SCHEMA'"
|
v-if="body.format==='JSON-SCHEMA'"
|
||||||
:body="body"
|
:body="body"
|
||||||
|
:need-mock="needMock"
|
||||||
ref="jsonCodeEdit"/>
|
ref="jsonCodeEdit"/>
|
||||||
<ms-code-edit
|
<ms-code-edit
|
||||||
v-else-if="codeEditActive"
|
v-else-if="codeEditActive"
|
||||||
|
@ -103,6 +104,10 @@ export default {
|
||||||
isShowEnable: {
|
isShowEnable: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
needMock: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
v-if="body.format==='JSON-SCHEMA'"
|
v-if="body.format==='JSON-SCHEMA'"
|
||||||
:body="body"
|
:body="body"
|
||||||
:show-mock-vars="true"
|
:show-mock-vars="true"
|
||||||
|
:need-mock="needMock"
|
||||||
ref="jsonCodeEdit"/>
|
ref="jsonCodeEdit"/>
|
||||||
<ms-code-edit
|
<ms-code-edit
|
||||||
v-else-if="codeEditActive && loadIsOver"
|
v-else-if="codeEditActive && loadIsOver"
|
||||||
|
@ -109,6 +110,10 @@ export default {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
needMock: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -73,6 +73,7 @@
|
||||||
:suggestions="apiParams.form"
|
:suggestions="apiParams.form"
|
||||||
:is-read-only="isReadOnly"
|
:is-read-only="isReadOnly"
|
||||||
:isShowEnable="isShowEnable"
|
:isShowEnable="isShowEnable"
|
||||||
|
:need-mock="false"
|
||||||
:headers="request.headers" :body="request.body"/>
|
:headers="request.headers" :body="request.body"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane name="create"
|
<el-tab-pane name="create"
|
||||||
|
|
|
@ -12,7 +12,8 @@
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
|
<el-tab-pane :label="$t('api_test.definition.request.response_body')" name="body" class="pane">
|
||||||
<mock-api-response-body :isReadOnly="false" :isShowEnable="false" :api-id="apiId" :body="response.body"
|
<mock-api-response-body :isReadOnly="false" :isShowEnable="false" :api-id="apiId" :body="response.body"
|
||||||
:headers="response.headers" :use-post-script="response.usePostScript"/>
|
:headers="response.headers" :use-post-script="response.usePostScript"
|
||||||
|
:need-mock="false"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane v-if="!isTcp" :label="$t('api_test.definition.request.status_code')" name="status_code"
|
<el-tab-pane v-if="!isTcp" :label="$t('api_test.definition.request.status_code')" name="status_code"
|
||||||
|
@ -66,8 +67,7 @@ import BatchAddParameter from "@/business/definition/components/basis/BatchAddPa
|
||||||
import MsApiAdvancedConfig from "@/business/definition/components/request/http/ApiAdvancedConfig";
|
import MsApiAdvancedConfig from "@/business/definition/components/request/http/ApiAdvancedConfig";
|
||||||
import MsJsr233Processor from "@/business/automation/scenario/component/Jsr233Processor";
|
import MsJsr233Processor from "@/business/automation/scenario/component/Jsr233Processor";
|
||||||
import MockApiScriptEditor from "@/business/definition/components/mock/Components/MockApiScriptEditor";
|
import MockApiScriptEditor from "@/business/definition/components/mock/Components/MockApiScriptEditor";
|
||||||
import ApiDefinitionStepButton
|
import ApiDefinitionStepButton from "@/business/definition/components/request/components/ApiDefinitionStepButton";
|
||||||
from "@/business/definition/components/request/components/ApiDefinitionStepButton";
|
|
||||||
import {Body, BODY_FORMAT} from "@/business/definition/model/ApiTestModel";
|
import {Body, BODY_FORMAT} from "@/business/definition/model/ApiTestModel";
|
||||||
import {REQUEST_HEADERS} from "metersphere-frontend/src/utils/constants";
|
import {REQUEST_HEADERS} from "metersphere-frontend/src/utils/constants";
|
||||||
|
|
||||||
|
@ -208,8 +208,8 @@ export default {
|
||||||
this.response.vars = "";
|
this.response.vars = "";
|
||||||
}
|
}
|
||||||
this.reqMessages = this.$t('api_test.request.address') + ":\n" + this.response.url + "\n" +
|
this.reqMessages = this.$t('api_test.request.address') + ":\n" + this.response.url + "\n" +
|
||||||
this.$t('api_test.scenario.headers') + ":\n" + this.response.headers + "\n" + "Cookies :\n" +
|
this.$t('api_test.scenario.headers') + ":\n" + this.response.headers + "\n" + "Cookies :\n" +
|
||||||
this.response.cookies + "\n" + "Body:" + "\n" + this.response.body;
|
this.response.cookies + "\n" + "Body:" + "\n" + this.response.body;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue