--bug=1007715 --user=宋天阳 【接口定义】mock参数多了一个键 https://www.tapd.cn/55049933/s/1064027;--bug=1007716 --user=宋天阳 【接口测试】mock调试报错后,再编辑mock规则,不能自动带出来请求参数下拉框 https://www.tapd.cn/55049933/s/1064025;--bug=1007717 --user=宋天阳 【接口定义】mock规则部分匹配,没有返回mock信息 https://www.tapd.cn/55049933/s/1064023;--bug=1007711 --user=宋天阳 【接口定义】mock服务的URL会自动补一个“/” https://www.tapd.cn/55049933/s/1064026
This commit is contained in:
parent
f48db748fa
commit
8002dc2c4f
|
@ -625,6 +625,7 @@ public class ApiDefinitionService {
|
||||||
batchMapper.insert(apiDefinition);
|
batchMapper.insert(apiDefinition);
|
||||||
String requestStr = setImportHashTree(apiDefinition);
|
String requestStr = setImportHashTree(apiDefinition);
|
||||||
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
|
reSetImportCasesApiId(cases, originId, apiDefinition.getId());
|
||||||
|
reSetImportMocksApiId(mocks, originId, apiDefinition.getId(), apiDefinition.getNum());
|
||||||
apiDefinition.setRequest(requestStr);
|
apiDefinition.setRequest(requestStr);
|
||||||
importApiCase(apiDefinition, apiTestImportRequest);
|
importApiCase(apiDefinition, apiTestImportRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class JsonStructUtils {
|
||||||
if(matchObj == null){
|
if(matchObj == null){
|
||||||
matchObj = new JSONObject();
|
matchObj = new JSONObject();
|
||||||
}
|
}
|
||||||
if (sourceObj .isEmpty() && matchObj.isEmpty()) {
|
if (matchObj.isEmpty()) {
|
||||||
return true;
|
return true;
|
||||||
} else if (sourceObj != null && matchObj != null) {
|
} else if (sourceObj != null && matchObj != null) {
|
||||||
boolean lastMatchResultIsTrue = false;
|
boolean lastMatchResultIsTrue = false;
|
||||||
|
|
|
@ -274,10 +274,6 @@
|
||||||
return this.mockBaseUrl;
|
return this.mockBaseUrl;
|
||||||
} else {
|
} else {
|
||||||
let path = this.httpForm.path;
|
let path = this.httpForm.path;
|
||||||
let prefix = "";
|
|
||||||
if (path.endsWith("/")) {
|
|
||||||
prefix = "/";
|
|
||||||
}
|
|
||||||
let protocol = this.httpForm.method;
|
let protocol = this.httpForm.method;
|
||||||
if (protocol === 'GET' || protocol === 'DELETE') {
|
if (protocol === 'GET' || protocol === 'DELETE') {
|
||||||
if (this.httpForm.request != null && this.httpForm.request.rest != null) {
|
if (this.httpForm.request != null && this.httpForm.request.rest != null) {
|
||||||
|
@ -303,8 +299,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return this.mockBaseUrl + path;
|
||||||
return this.mockBaseUrl + path + prefix;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,16 +3,8 @@
|
||||||
<span class="kv-description" v-if="description">
|
<span class="kv-description" v-if="description">
|
||||||
{{ description }}
|
{{ description }}
|
||||||
</span>
|
</span>
|
||||||
<!-- <el-row>-->
|
|
||||||
<!-- <el-checkbox v-model="isSelectAll" v-if="parameters.length > 1"/>-->
|
|
||||||
<!-- </el-row>-->
|
|
||||||
<div class="item kv-row" v-for="(item, index) in parameters" :key="index">
|
<div class="item kv-row" v-for="(item, index) in parameters" :key="index">
|
||||||
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
<el-row type="flex" :gutter="20" justify="space-between" align="middle">
|
||||||
<!-- <el-col class="kv-checkbox" v-if="isShowEnable">-->
|
|
||||||
<!-- <el-checkbox v-if="!isDisable(index)" v-model="item.enable"-->
|
|
||||||
<!-- :disabled="isReadOnly"/>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
<!-- <span style="margin-left: 10px" v-else></span>-->
|
|
||||||
<span style="margin-left: 10px"></span>
|
<span style="margin-left: 10px"></span>
|
||||||
<i class="el-icon-top" style="cursor:pointer" @click="moveTop(index)"/>
|
<i class="el-icon-top" style="cursor:pointer" @click="moveTop(index)"/>
|
||||||
<i class="el-icon-bottom" style="cursor:pointer;" @click="moveBottom(index)"/>
|
<i class="el-icon-bottom" style="cursor:pointer;" @click="moveBottom(index)"/>
|
||||||
|
@ -31,16 +23,19 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
|
|
||||||
<el-autocomplete :disabled="isReadOnly" v-if="suggestions" v-model="item.name" size="small"
|
<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" @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)">
|
||||||
|
<el-option value="text"/>
|
||||||
|
<el-option value="file"/>
|
||||||
|
<el-option value="json"/>
|
||||||
|
</el-select>
|
||||||
|
</template>
|
||||||
|
</el-autocomplete>
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<!-- <el-col class="item kv-select">-->
|
|
||||||
<!-- <el-select v-model="item.required" size="small">-->
|
|
||||||
<!-- <el-option v-for="req in requireds" :key="req.id" :label="req.name" :value="req.id"/>-->
|
|
||||||
<!-- </el-select>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
|
|
||||||
<el-col class="item" v-if="isActive && item.type !== 'file'">
|
<el-col class="item" v-if="isActive && item.type !== 'file'">
|
||||||
<el-autocomplete
|
<el-autocomplete
|
||||||
:disabled="isReadOnly"
|
:disabled="isReadOnly"
|
||||||
|
@ -60,10 +55,6 @@
|
||||||
<el-input v-model="item.description" size="small" maxlength="200"
|
<el-input v-model="item.description" size="small" maxlength="200"
|
||||||
:placeholder="$t('commons.description')" show-word-limit>
|
:placeholder="$t('commons.description')" show-word-limit>
|
||||||
</el-input>
|
</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/>
|
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<el-col v-if="isActive && item.type === 'file'" class="item">
|
<el-col v-if="isActive && item.type === 'file'" class="item">
|
||||||
|
@ -76,12 +67,6 @@
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
<!-- <el-col v-if="withMorSetting" class="item kv-setting">-->
|
|
||||||
<!-- <el-tooltip effect="dark" :content="$t('schema.adv_setting')" placement="top">-->
|
|
||||||
<!-- <i class="el-icon-setting" @click="openApiVariableSetting(item)"/>-->
|
|
||||||
<!-- </el-tooltip>-->
|
|
||||||
<!-- </el-col>-->
|
|
||||||
|
|
||||||
<el-col class="item kv-delete">
|
<el-col class="item kv-delete">
|
||||||
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
|
<el-button size="mini" class="el-icon-delete-solid" circle @click="remove(index)"
|
||||||
:disabled="isDisable(index) || isReadOnly"/>
|
:disabled="isDisable(index) || isReadOnly"/>
|
||||||
|
@ -102,13 +87,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import {KeyValue, Scenario} from "../model/ApiTestModel";
|
|
||||||
import {KeyValue,Scenario} from "@/business/components/api/definition/model/ApiTestModel";
|
import {KeyValue,Scenario} from "@/business/components/api/definition/model/ApiTestModel";
|
||||||
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
|
import {JMETER_FUNC, MOCKJS_FUNC} from "@/common/js/constants";
|
||||||
// import MsApiVariableAdvance from "./ApiVariableAdvance";
|
|
||||||
import MsApiVariableAdvance from "@/business/components/api/definition/components/ApiVariableAdvance";
|
import MsApiVariableAdvance from "@/business/components/api/definition/components/ApiVariableAdvance";
|
||||||
import MsApiVariableJson from "@/business/components/api/definition/components/ApiVariableJson";
|
import MsApiVariableJson from "@/business/components/api/definition/components/ApiVariableJson";
|
||||||
// import MsApiBodyFileUpload from "@/business/components/api/definition/body/ApiBodyFileUpload";
|
|
||||||
import MsApiBodyFileUpload from "@/business/components/api/definition/components/body/ApiBodyFileUpload";
|
import MsApiBodyFileUpload from "@/business/components/api/definition/components/body/ApiBodyFileUpload";
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import ApiVariableSetting from "@/business/components/api/definition/components/ApiVariableSetting";
|
import ApiVariableSetting from "@/business/components/api/definition/components/ApiVariableSetting";
|
||||||
|
|
|
@ -181,7 +181,11 @@ export default {
|
||||||
body: "",
|
body: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.$refs.mockEditDrawer.open(mockExpectConfig);
|
this.searchApiParams(this.mockConfigData.mockConfig.apiId);
|
||||||
|
this.$refs.mockEditDrawer.close();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.mockEditDrawer.open(mockExpectConfig);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
clickRow(row, column, event) {
|
clickRow(row, column, event) {
|
||||||
|
@ -204,12 +208,19 @@ export default {
|
||||||
body: "",
|
body: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
this.$refs.mockEditDrawer.open(mockExpectConfig);
|
this.searchApiParams(this.mockConfigData.mockConfig.apiId);
|
||||||
|
this.$refs.mockEditDrawer.close();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.mockEditDrawer.open(mockExpectConfig);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addApiMock(){
|
addApiMock(){
|
||||||
this.searchApiParams(this.mockConfigData.mockConfig.apiId);
|
this.searchApiParams(this.mockConfigData.mockConfig.apiId);
|
||||||
this.$refs.mockEditDrawer.open();
|
this.$refs.mockEditDrawer.close();
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.mockEditDrawer.open();
|
||||||
|
});
|
||||||
},
|
},
|
||||||
removeExpect(row) {
|
removeExpect(row) {
|
||||||
this.$confirm(this.$t('api_test.mock.delete_mock_expect'), this.$t('commons.prompt'), {
|
this.$confirm(this.$t('api_test.mock.delete_mock_expect'), this.$t('commons.prompt'), {
|
||||||
|
|
Loading…
Reference in New Issue