refactor(接口测试): 去掉mock的小铅笔

--bug=1017964 --user=王孝刚 【接口测试】mock期望 - 响应体中的mock和jmeter函数不生效
https://www.tapd.cn/55049933/s/1288723
This commit is contained in:
wxg0103 2022-11-04 11:46:37 +08:00 committed by wxg0103
parent f60fd53ffe
commit 6bd21b3314
7 changed files with 38 additions and 6 deletions

View File

@ -13,6 +13,7 @@
:show-mock-vars="showMockVars"
:scenario-definition="scenarioDefinition"
@editScenarioAdvance="editScenarioAdvance"
:need-mock="needMock"
lang="zh_CN" custom/>
</div>
</el-tab-pane>
@ -54,6 +55,12 @@ export default {
}
},
scenarioDefinition: Array,
needMock: {
type: Boolean,
default() {
return true;
}
}
},
created() {
if (!this.body.jsonSchema && this.body.raw && this.checkIsJson(this.body.raw)) {

View File

@ -30,6 +30,7 @@
:schema="pickValue"
:scenario-definition="scenarioDefinition"
:show-mock-vars="showMockVars"
:need-mock="needMock"
@editScenarioAdvance="editScenarioAdvance"/>
</el-col>
<el-col :span="4">
@ -57,6 +58,7 @@
:disabled="disabled"
@editScenarioAdvance="editScenarioAdvance"
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"
:need-mock="needMock"
@reloadItems="reloadItems"/>
</template>
<template v-if="!hidden && isArray(pickValue) && reloadItemOver">
@ -66,6 +68,7 @@
:scenario-definition="scenarioDefinition"
:show-mock-vars="showMockVars"
:disabled="disabled"
:need-mock="needMock"
@editScenarioAdvance="editScenarioAdvance"
:lang="lang" :custom="custom" @changeAllItemsType="changeAllItemsType"/>
</template>
@ -165,6 +168,10 @@ export default {
default: 'zh_CN'
},
scenarioDefinition: Array,
needMock: {
type: Boolean,
default: true
},
},
computed: {
pickValue() {

View File

@ -10,7 +10,8 @@
value-key="name"
highlight-first-item
@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>
<ms-api-variable-advance :show-mock-vars="showMockVars" :scenario-definition="scenarioDefinition"
:current-item="mock" ref="variableAdvance"/>
@ -39,6 +40,12 @@ export default {
return false;
}
},
needMock: {
type: Boolean,
default() {
return true;
}
}
},
data() {
return {

View File

@ -39,6 +39,7 @@
<ms-json-code-edit
v-if="body.format==='JSON-SCHEMA'"
:body="body"
:need-mock="needMock"
ref="jsonCodeEdit"/>
<ms-code-edit
v-else-if="codeEditActive"
@ -103,6 +104,10 @@ export default {
isShowEnable: {
type: Boolean,
default: true
},
needMock: {
type: Boolean,
default: true
}
},
data() {

View File

@ -22,6 +22,7 @@
v-if="body.format==='JSON-SCHEMA'"
:body="body"
:show-mock-vars="true"
:need-mock="needMock"
ref="jsonCodeEdit"/>
<ms-code-edit
v-else-if="codeEditActive && loadIsOver"
@ -109,6 +110,10 @@ export default {
type: Boolean,
default: false
},
needMock: {
type: Boolean,
default: true
},
},
data() {
return {

View File

@ -73,6 +73,7 @@
:suggestions="apiParams.form"
:is-read-only="isReadOnly"
:isShowEnable="isShowEnable"
:need-mock="false"
:headers="request.headers" :body="request.body"/>
</el-tab-pane>
<el-tab-pane name="create"

View File

@ -12,7 +12,8 @@
</el-tab-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"
: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 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 MsJsr233Processor from "@/business/automation/scenario/component/Jsr233Processor";
import MockApiScriptEditor from "@/business/definition/components/mock/Components/MockApiScriptEditor";
import ApiDefinitionStepButton
from "@/business/definition/components/request/components/ApiDefinitionStepButton";
import ApiDefinitionStepButton from "@/business/definition/components/request/components/ApiDefinitionStepButton";
import {Body, BODY_FORMAT} from "@/business/definition/model/ApiTestModel";
import {REQUEST_HEADERS} from "metersphere-frontend/src/utils/constants";
@ -208,8 +208,8 @@ export default {
this.response.vars = "";
}
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.response.cookies + "\n" + "Body:" + "\n" + this.response.body;
this.$t('api_test.scenario.headers') + ":\n" + this.response.headers + "\n" + "Cookies :\n" +
this.response.cookies + "\n" + "Body:" + "\n" + this.response.body;
}
},
},