Merge remote-tracking branch 'origin/v1.8' into v1.8
This commit is contained in:
commit
c4cf9b2848
|
@ -160,14 +160,16 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
sampler.setProtocol(urlObject.getProtocol());
|
||||
sampler.setPath(urlObject.getPath());
|
||||
} else {
|
||||
String configStr = config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket();
|
||||
sampler.setDomain(configStr);
|
||||
if (config.getConfig().get(this.getProjectId()).getHttpConfig().getPort() > 0) {
|
||||
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
|
||||
sampler.setDomain(config.getConfig().get(this.getProjectId()).getHttpConfig().getDomain());
|
||||
url = config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol() + "://" + config.getConfig().get(this.getProjectId()).getHttpConfig().getSocket();
|
||||
URL urlObject = new URL(url);
|
||||
String envPath = StringUtils.equals(urlObject.getPath(), "/") ? "" : urlObject.getPath();
|
||||
if (StringUtils.isNotBlank(this.getPath())) {
|
||||
envPath += this.getPath();
|
||||
}
|
||||
sampler.setPort(config.getConfig().get(this.getProjectId()).getHttpConfig().getPort());
|
||||
sampler.setProtocol(config.getConfig().get(this.getProjectId()).getHttpConfig().getProtocol());
|
||||
sampler.setPath(this.getPath());
|
||||
sampler.setPath(envPath);
|
||||
}
|
||||
String envPath = sampler.getPath();
|
||||
if (CollectionUtils.isNotEmpty(this.getRest()) && this.isRest()) {
|
||||
|
@ -187,7 +189,7 @@ public class MsHTTPSamplerProxy extends MsTestElement {
|
|||
}
|
||||
} else {
|
||||
String url = this.getUrl();
|
||||
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
if (StringUtils.isNotEmpty(url) && !url.startsWith("http://") && !url.startsWith("https://")) {
|
||||
url = "http://" + url;
|
||||
}
|
||||
if (StringUtils.isNotEmpty(this.getPort()) && this.getPort().startsWith("${")) {
|
||||
|
|
|
@ -30,6 +30,7 @@ import io.metersphere.commons.utils.*;
|
|||
import io.metersphere.controller.request.ScheduleRequest;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.job.sechedule.ApiScenarioTestJob;
|
||||
import io.metersphere.job.sechedule.SwaggerUrlImportJob;
|
||||
import io.metersphere.job.sechedule.TestPlanTestJob;
|
||||
import io.metersphere.service.ScheduleService;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
|
@ -231,6 +232,7 @@ public class ApiAutomationService {
|
|||
scenario.setPrincipal(request.getPrincipal());
|
||||
scenario.setStepTotal(request.getStepTotal());
|
||||
scenario.setUpdateTime(System.currentTimeMillis());
|
||||
scenario.setDescription(request.getDescription());
|
||||
scenario.setScenarioDefinition(JSON.toJSONString(request.getScenarioDefinition()));
|
||||
if (StringUtils.isNotEmpty(request.getStatus())) {
|
||||
scenario.setStatus(request.getStatus());
|
||||
|
@ -816,7 +818,9 @@ public class ApiAutomationService {
|
|||
if (StringUtils.equals(request.getGroup(), ScheduleGroup.TEST_PLAN_TEST.name())) {
|
||||
scheduleService.addOrUpdateCronJob(
|
||||
request, TestPlanTestJob.getJobKey(request.getResourceId()), TestPlanTestJob.getTriggerKey(request.getResourceId()), TestPlanTestJob.class);
|
||||
} else {
|
||||
}else if(StringUtils.equals(request.getGroup(), ScheduleGroup.SWAGGER_IMPORT.name())){
|
||||
scheduleService.addOrUpdateCronJob(request, SwaggerUrlImportJob.getJobKey(request.getResourceId()), SwaggerUrlImportJob.getTriggerKey(request.getResourceId()), SwaggerUrlImportJob.class);
|
||||
} else{
|
||||
scheduleService.addOrUpdateCronJob(
|
||||
request, ApiScenarioTestJob.getJobKey(request.getResourceId()), ApiScenarioTestJob.getTriggerKey(request.getResourceId()), ApiScenarioTestJob.class);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,16 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
|
|||
break;
|
||||
}
|
||||
}
|
||||
//增加字数校验,每一层不能超过100字
|
||||
for (int i = 0; i < nodes.length; i++) {
|
||||
String nodeStr = nodes[i];
|
||||
if(StringUtils.isNotEmpty(nodeStr)){
|
||||
if(nodeStr.trim().length()>100){
|
||||
stringBuilder.append(Translator.get("module") + Translator.get("test_track.length_less_than") + "100:"+nodeStr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (StringUtils.equals(data.getType(), TestCaseConstants.Type.Functional.getValue()) && StringUtils.equals(data.getMethod(), TestCaseConstants.Method.Auto.getValue())) {
|
||||
|
|
|
@ -91,8 +91,8 @@ public class TestPlanController {
|
|||
|
||||
@PostMapping("/edit")
|
||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||
public void editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
|
||||
testPlanService.editTestPlan(testPlanDTO, true);
|
||||
public String editTestPlan(@RequestBody TestPlanDTO testPlanDTO) {
|
||||
return testPlanService.editTestPlan(testPlanDTO, true);
|
||||
}
|
||||
|
||||
@PostMapping("/edit/status/{planId}")
|
||||
|
|
|
@ -176,7 +176,7 @@ public class TestPlanService {
|
|||
return Optional.ofNullable(testPlanMapper.selectByPrimaryKey(testPlanId)).orElse(new TestPlan());
|
||||
}
|
||||
|
||||
public int editTestPlan(TestPlanDTO testPlan, Boolean isSendMessage) {
|
||||
public String editTestPlan(TestPlanDTO testPlan, Boolean isSendMessage) {
|
||||
checkTestPlanExist(testPlan);
|
||||
TestPlan res = testPlanMapper.selectByPrimaryKey(testPlan.getId()); // 先查一次库
|
||||
testPlan.setUpdateTime(System.currentTimeMillis());
|
||||
|
@ -230,7 +230,7 @@ public class TestPlanService {
|
|||
.build();
|
||||
noticeSendService.send(NoticeConstants.TaskType.TEST_PLAN_TASK, noticeModel);
|
||||
}
|
||||
return i;
|
||||
return testPlan.getId();
|
||||
}
|
||||
|
||||
//计划内容
|
||||
|
|
|
@ -392,8 +392,8 @@
|
|||
}
|
||||
},
|
||||
runTest(data) {
|
||||
this.setTabTitle(data);
|
||||
this.handleTabsEdit(this.$t("commons.api"), "TEST", data);
|
||||
this.setTabTitle(data);
|
||||
},
|
||||
saveApi(data) {
|
||||
this.setTabTitle(data);
|
||||
|
|
|
@ -58,22 +58,26 @@
|
|||
}
|
||||
},
|
||||
run() {
|
||||
let testPlan = new TestPlan();
|
||||
let threadGroup = new ThreadGroup();
|
||||
threadGroup.hashTree = [];
|
||||
testPlan.hashTree = [threadGroup];
|
||||
this.runData.forEach(item => {
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
|
||||
let projectId = "";
|
||||
let projectId = this.$store.state.projectId;
|
||||
// 如果envMap不存在,是单接口调用
|
||||
if (!this.envMap || this.envMap.size === 0) {
|
||||
projectId = this.$store.state.projectId;
|
||||
} else {
|
||||
// 场景步骤下接口调用
|
||||
projectId = this.runData.projectId;
|
||||
if(this.runData.projectId){
|
||||
projectId = this.runData.projectId;
|
||||
}
|
||||
}
|
||||
|
||||
let testPlan = new TestPlan();
|
||||
let threadGroup = new ThreadGroup();
|
||||
threadGroup.hashTree = [];
|
||||
testPlan.hashTree = [threadGroup];
|
||||
this.runData.forEach(item => {
|
||||
item.projectId = projectId;
|
||||
threadGroup.hashTree.push(item);
|
||||
})
|
||||
|
||||
let reqObj = {id: this.reportId, testElement: testPlan, type: this.type,projectId: projectId, environmentMap: strMapToObj(this.envMap)};
|
||||
let bodyFiles = getBodyUploadFiles(reqObj, this.runData);
|
||||
let url = "";
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<i class="icon el-icon-arrow-right" :class="{'is-active': apiCase.active}" @click="active(apiCase)"/>
|
||||
<el-input v-if="!apiCase.id || isShowInput" size="small" v-model="apiCase.name" :name="index" :key="index"
|
||||
class="ms-api-header-select" style="width: 180px"
|
||||
@blur="saveTestCase(apiCase)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
|
||||
@blur="saveTestCase(apiCase,true)" :placeholder="$t('commons.input_name')" ref="nameEdit"/>
|
||||
<span v-else>
|
||||
{{ apiCase.id ? apiCase.name : '' }}
|
||||
<i class="el-icon-edit" style="cursor:pointer" @click="showInput(apiCase)" v-tester/>
|
||||
|
@ -48,7 +48,7 @@
|
|||
|
||||
<el-col :span="4">
|
||||
<div class="tag-item" @click.stop>
|
||||
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase)"/>
|
||||
<ms-input-tag :currentScenario="apiCase" ref="tag" @keyup.enter.native="saveTestCase(apiCase,true)"/>
|
||||
</div>
|
||||
</el-col>
|
||||
|
||||
|
@ -291,7 +291,7 @@
|
|||
}
|
||||
});
|
||||
},
|
||||
saveCase(row) {
|
||||
saveCase(row,hideAlert) {
|
||||
let tmp = JSON.parse(JSON.stringify(row));
|
||||
this.isShowInput = false;
|
||||
if (this.validate(tmp)) {
|
||||
|
@ -328,16 +328,18 @@
|
|||
row.createTime = data.createTime;
|
||||
row.updateTime = data.updateTime;
|
||||
if (!row.message) {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('refresh');
|
||||
if(!hideAlert){
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.$emit('refresh');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
saveTestCase(row) {
|
||||
saveTestCase(row,hideAlert) {
|
||||
if (this.api.saved) {
|
||||
this.addModule(row);
|
||||
} else {
|
||||
this.saveCase(row);
|
||||
this.saveCase(row,hideAlert);
|
||||
}
|
||||
},
|
||||
showInput(row) {
|
||||
|
|
|
@ -306,6 +306,8 @@
|
|||
this.$warning(this.$t('api_test.environment.select_environment'));
|
||||
return;
|
||||
}
|
||||
this.envMap = new Map();
|
||||
this.envMap.set(this.$store.state.projectId,this.environment);
|
||||
this.runData = [];
|
||||
this.batchLoadingIds = [];
|
||||
this.selectdCases = [];
|
||||
|
|
|
@ -248,6 +248,7 @@ import {Api_List} from "@/business/components/common/model/JsonData";
|
|||
import HeaderCustom from "@/business/components/common/head/HeaderCustom";
|
||||
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
|
||||
import {Body} from "@/business/components/api/definition/model/ApiTestModel";
|
||||
import {buildNodePath} from "@/business/components/api/definition/model/NodeTree";
|
||||
|
||||
|
||||
export default {
|
||||
|
@ -768,13 +769,21 @@ export default {
|
|||
});
|
||||
},
|
||||
buildApiPath(apis) {
|
||||
apis.forEach((api) => {
|
||||
try {
|
||||
let options = [];
|
||||
this.moduleOptions.forEach(item => {
|
||||
if (api.moduleId === item.id) {
|
||||
api.modulePath = item.path;
|
||||
}
|
||||
buildNodePath(item, {path: ''}, options);
|
||||
});
|
||||
});
|
||||
apis.forEach((api) => {
|
||||
options.forEach((item) => {
|
||||
if (api.moduleId === item.id) {
|
||||
api.modulePath = item.path;
|
||||
}
|
||||
})
|
||||
});
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
sort(column) {
|
||||
// 每次只对一个字段排序
|
||||
|
|
|
@ -133,16 +133,11 @@
|
|||
this.data.forEach(node => {
|
||||
buildTree(node, {path: ''});
|
||||
});
|
||||
this.$emit('setModuleOptions', this.data);
|
||||
this.$emit('setNodeTree', this.data);
|
||||
if (this.$refs.nodeTree) {
|
||||
this.$refs.nodeTree.filter(this.condition.filterText);
|
||||
}
|
||||
let moduleOptions = [];
|
||||
this.data.forEach(node => {
|
||||
buildNodePath(node, {path: ''}, moduleOptions);
|
||||
});
|
||||
this.moduleOptions = moduleOptions;
|
||||
this.$emit('setModuleOptions', moduleOptions);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
</el-aside>
|
||||
<el-main style="padding: 0px 0px 0px 0px; line-height: 40px; text-align: center;">
|
||||
<span v-if="interfaceCoverage === 'waitting...'">
|
||||
{{interfaceCoverage}}
|
||||
<i class="el-icon-loading lading-icon"></i>
|
||||
</span>
|
||||
<span v-else class="rows-count-number">
|
||||
{{interfaceCoverage}}
|
||||
|
@ -161,7 +161,11 @@ export default {
|
|||
color: var(--count_number);
|
||||
margin:20px auto;
|
||||
}
|
||||
|
||||
.lading-icon{
|
||||
font-size: 25px;
|
||||
color: var(--count_number);
|
||||
font-weight: bold;
|
||||
}
|
||||
.main-number-show {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
|
|
|
@ -379,14 +379,17 @@
|
|||
|
||||
.common-tree {
|
||||
overflow: auto;
|
||||
height: 200px;
|
||||
min-height: 200px;
|
||||
max-height: 400px;
|
||||
}
|
||||
|
||||
.ms-tree-select {
|
||||
width: 100%;
|
||||
z-index: 111;
|
||||
}
|
||||
|
||||
/deep/.el-tree-node__children{
|
||||
overflow: inherit;
|
||||
}
|
||||
.ok {
|
||||
float: right;
|
||||
}
|
||||
|
|
|
@ -711,7 +711,7 @@ export default {
|
|||
.border-hidden >>> .el-textarea__inner {
|
||||
border-style: hidden;
|
||||
background-color: white;
|
||||
color: #606266;
|
||||
color: #060505;
|
||||
}
|
||||
|
||||
.cast_label {
|
||||
|
@ -785,4 +785,5 @@ p {
|
|||
height: 550px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -549,4 +549,10 @@ export default {
|
|||
.comment-card >>> .el-card__body {
|
||||
height: calc(100vh - 120px);
|
||||
}
|
||||
|
||||
.tb-edit >>> .el-textarea__inner {
|
||||
border-style: hidden;
|
||||
background-color: white;
|
||||
color: #060505;
|
||||
}
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue