Merge remote-tracking branch 'origin/master' into master
# Conflicts: # backend/src/main/java/io/metersphere/xpack
This commit is contained in:
commit
6eb0a46edd
10
ROADMAP.md
10
ROADMAP.md
|
@ -55,11 +55,17 @@
|
|||
- [x] 测试跟踪:支持对接禅道同步缺陷
|
||||
- [x] 其他:Jenkins 插件支持 pipeline 方式调用
|
||||
|
||||
## v1.6 (开发中)
|
||||
- [ ] 新增接口管理功能
|
||||
- [ ] 全新接口自动化使用方式
|
||||
- [ ] 测试跟踪测试计划分类型展示
|
||||
- [ ] 优化消息通知配置及实现方式
|
||||
|
||||
## 规划中
|
||||
|
||||
- [ ] 接口测试支持添加 WebSocket 协议请求
|
||||
- [ ] 接口管理功能
|
||||
- [ ] 集成云平台动态管理测试资源池
|
||||
- [ ] 支持 K8s 集群作为测试资源池
|
||||
- [ ] 测试跟踪测试用例及接口测试增加版本管理
|
||||
- [ ] 测试跟踪测试用例增加思维导图展示形式
|
||||
- [ ] 移动端测试支持
|
||||
- [ ] UI 功能测试支持
|
||||
|
|
|
@ -58,6 +58,11 @@ public class ApiAutomationController {
|
|||
apiAutomationService.removeToGc(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
public void reduction(@RequestBody List<String> ids) {
|
||||
apiAutomationService.reduction(ids);
|
||||
}
|
||||
|
||||
@GetMapping("/getApiScenario/{id}")
|
||||
public ApiScenario getScenarioDefinition(@PathVariable String id) {
|
||||
return apiAutomationService.getApiScenario(id);
|
||||
|
|
|
@ -64,6 +64,11 @@ public class ApiDefinitionController {
|
|||
apiDefinitionService.removeToGc(ids);
|
||||
}
|
||||
|
||||
@PostMapping("/reduction")
|
||||
public void reduction(@RequestBody List<String> ids) {
|
||||
apiDefinitionService.reduction(ids);
|
||||
}
|
||||
|
||||
@GetMapping("/get/{id}")
|
||||
public ApiDefinition get(@PathVariable String id) {
|
||||
return apiDefinitionService.get(id);
|
||||
|
|
|
@ -4,11 +4,13 @@ import io.metersphere.base.domain.ApiScenario;
|
|||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ApiScenarioDTO extends ApiScenario {
|
||||
|
||||
private String projectName;
|
||||
private String userName;
|
||||
private String tagName;
|
||||
private List<String> tagNames;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import io.metersphere.commons.utils.CommonBeanFactory;
|
|||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.jmeter.save.SaveService;
|
||||
import org.apache.jmeter.testelement.TestElement;
|
||||
import org.apache.jorphan.collections.HashTree;
|
||||
|
@ -47,7 +48,7 @@ public class MsScenario extends MsTestElement {
|
|||
if (!this.isEnable()) {
|
||||
return;
|
||||
}
|
||||
if (environmentId != null) {
|
||||
if (StringUtils.isNotEmpty(environmentId)) {
|
||||
ApiTestEnvironmentService environmentService = CommonBeanFactory.getBean(ApiTestEnvironmentService.class);
|
||||
ApiTestEnvironmentWithBLOBs environment = environmentService.get(environmentId);
|
||||
config.setConfig(JSONObject.parseObject(environment.getConfig(), EnvironmentConfig.class));
|
||||
|
|
|
@ -22,6 +22,7 @@ import io.metersphere.commons.constants.APITestStatus;
|
|||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.ReportTriggerMode;
|
||||
import io.metersphere.commons.exception.MSException;
|
||||
import io.metersphere.commons.utils.ServiceUtils;
|
||||
import io.metersphere.commons.utils.SessionUtils;
|
||||
import io.metersphere.i18n.Translator;
|
||||
import io.metersphere.track.dto.TestPlanDTO;
|
||||
|
@ -67,11 +68,12 @@ public class ApiAutomationService {
|
|||
private static final String BODY_FILE_DIR = "/opt/metersphere/data/body";
|
||||
|
||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
||||
ApiTagExample example = new ApiTagExample();
|
||||
example.createCriteria().andProjectIdEqualTo(request.getProjectId());
|
||||
List<ApiTag> tags = apiTagMapper.selectByExample(example);
|
||||
Map<String, String> tagMap = tags.stream().collect(Collectors.toMap(ApiTag::getId, ApiTag::getName));
|
||||
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
||||
Gson gs = new Gson();
|
||||
list.forEach(item -> {
|
||||
if (item.getTagId() != null) {
|
||||
|
@ -81,7 +83,11 @@ public class ApiAutomationService {
|
|||
buf.append(",");
|
||||
});
|
||||
if (buf != null && buf.length() > 0) {
|
||||
item.setTagName(buf.toString().substring(0, buf.toString().length() - 1));
|
||||
String tagNames = buf.toString().substring(0, buf.toString().length() - 1);
|
||||
List<String> tagList = Arrays.asList(tagNames.split(","));
|
||||
item.setTagNames(tagList);
|
||||
} else {
|
||||
item.setTagNames(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -124,7 +130,7 @@ public class ApiAutomationService {
|
|||
scenario.setDescription(request.getDescription());
|
||||
apiScenarioMapper.insert(scenario);
|
||||
|
||||
List<String> bodyUploadIds = new ArrayList<>(request.getBodyUploadIds());
|
||||
List<String> bodyUploadIds = request.getBodyUploadIds();
|
||||
apiDefinitionService.createBodyFiles(bodyUploadIds, bodyFiles);
|
||||
}
|
||||
|
||||
|
@ -166,12 +172,12 @@ public class ApiAutomationService {
|
|||
apiScenarioMapper.deleteByExample(example);
|
||||
}
|
||||
|
||||
public void removeToGc(List<String> ids) {
|
||||
ApiScenario record = new ApiScenario();
|
||||
record.setStatus(ScenarioStatus.Trash.name());
|
||||
ApiScenarioExample example = new ApiScenarioExample();
|
||||
example.createCriteria().andIdIn(ids);
|
||||
apiScenarioMapper.updateByExampleSelective(record, example);
|
||||
public void removeToGc(List<String> apiIds) {
|
||||
extApiScenarioMapper.removeToGc(apiIds);
|
||||
}
|
||||
|
||||
public void reduction(List<String> apiIds) {
|
||||
extApiScenarioMapper.reduction(apiIds);
|
||||
}
|
||||
|
||||
private void checkNameExist(SaveApiScenarioRequest request) {
|
||||
|
@ -244,12 +250,14 @@ public class ApiAutomationService {
|
|||
// 多态JSON普通转换会丢失内容,需要通过 ObjectMapper 获取
|
||||
if (StringUtils.isNotEmpty(element.getString("hashTree"))) {
|
||||
LinkedList<MsTestElement> elements = mapper.readValue(element.getString("hashTree"),
|
||||
new TypeReference<LinkedList<MsTestElement>>() {});
|
||||
new TypeReference<LinkedList<MsTestElement>>() {
|
||||
});
|
||||
scenario.setHashTree(elements);
|
||||
}
|
||||
if (StringUtils.isNotEmpty(element.getString("variables"))) {
|
||||
LinkedList<KeyValue> variables = mapper.readValue(element.getString("variables"),
|
||||
new TypeReference<LinkedList<KeyValue>>() {});
|
||||
new TypeReference<LinkedList<KeyValue>>() {
|
||||
});
|
||||
scenario.setVariables(variables);
|
||||
}
|
||||
LinkedList<MsTestElement> scenarios = new LinkedList<>();
|
||||
|
|
|
@ -163,6 +163,10 @@ public class ApiDefinitionService {
|
|||
extApiDefinitionMapper.removeToGc(apiIds);
|
||||
}
|
||||
|
||||
public void reduction(List<String> apiIds) {
|
||||
extApiDefinitionMapper.reduction(apiIds);
|
||||
}
|
||||
|
||||
public void deleteBodyFiles(String apiId) {
|
||||
File file = new File(BODY_FILE_DIR + "/" + apiId);
|
||||
FileUtil.deleteContents(file);
|
||||
|
|
|
@ -21,11 +21,10 @@ import org.apache.ibatis.session.SqlSessionFactory;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class ApiScenarioModuleService {
|
||||
|
|
|
@ -15,4 +15,6 @@ public interface ExtApiDefinitionMapper {
|
|||
|
||||
int removeToGc(@Param("ids") List<String> ids);
|
||||
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
|
||||
}
|
|
@ -255,4 +255,15 @@
|
|||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="reduction">
|
||||
update api_definition
|
||||
set
|
||||
status = 'Underway'
|
||||
where id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -16,4 +16,7 @@ public interface ExtApiScenarioMapper {
|
|||
|
||||
List<ApiScenario> selectReference(@Param("request") ApiScenarioRequest request);
|
||||
|
||||
int removeToGc(@Param("ids") List<String> ids);
|
||||
|
||||
int reduction(@Param("ids") List<String> ids);
|
||||
}
|
||||
|
|
|
@ -88,5 +88,25 @@
|
|||
</where>
|
||||
</select>
|
||||
|
||||
<update id="removeToGc">
|
||||
update api_scenario
|
||||
set
|
||||
status = 'Trash'
|
||||
where id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="reduction">
|
||||
update api_scenario
|
||||
set
|
||||
status = 'Underway'
|
||||
where id in
|
||||
<foreach collection="ids" item="v" separator="," open="(" close=")">
|
||||
#{v}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
|
@ -57,74 +57,75 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID,getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
export default {
|
||||
name: "MsAddBasisScenario",
|
||||
components: {MsDialogFooter},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
scenarioForm: {},
|
||||
visible: false,
|
||||
currentModule: {},
|
||||
userOptions: [],
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
||||
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
||||
],
|
||||
principal: [{
|
||||
required: true,
|
||||
message: this.$t('api_test.automation.scenario.select_principal'),
|
||||
trigger: 'change'
|
||||
}],
|
||||
},
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {
|
||||
saveScenario(saveAs) {
|
||||
this.$refs['scenarioForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
let path = "/api/automation/create";
|
||||
this.setParameter();
|
||||
this.result = this.$post(path, this.scenarioForm, () => {
|
||||
this.visible = false;
|
||||
if (saveAs) {
|
||||
this.scenarioForm.request = JSON.stringify(this.scenarioForm.request);
|
||||
this.$parent.saveAsEdit(this.scenarioForm);
|
||||
} else {
|
||||
this.$parent.refresh(this.currentModule);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
setParameter() {
|
||||
this.scenarioForm.projectId = getCurrentProjectID();
|
||||
this.scenarioForm.id = getUUID().substring(0, 8);
|
||||
this.scenarioForm.protocol = this.currentProtocol;
|
||||
if (this.currentModule != null) {
|
||||
this.scenarioForm.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
|
||||
this.scenarioForm.apiScenarioModuleId = this.currentModule.id;
|
||||
import {WORKSPACE_ID} from '@/common/js/constants';
|
||||
import {getCurrentUser, getUUID, getCurrentProjectID} from "@/common/js/utils";
|
||||
import MsDialogFooter from "@/business/components/common/components/MsDialogFooter";
|
||||
|
||||
export default {
|
||||
name: "MsAddBasisScenario",
|
||||
components: {MsDialogFooter},
|
||||
props: {},
|
||||
data() {
|
||||
return {
|
||||
scenarioForm: {},
|
||||
visible: false,
|
||||
currentModule: {},
|
||||
userOptions: [],
|
||||
rule: {
|
||||
name: [
|
||||
{required: true, message: this.$t('test_track.case.input_name'), trigger: 'blur'},
|
||||
{max: 50, message: this.$t('test_track.length_less_than') + '50', trigger: 'blur'}
|
||||
],
|
||||
principal: [{
|
||||
required: true,
|
||||
message: this.$t('api_test.automation.scenario.select_principal'),
|
||||
trigger: 'change'
|
||||
}],
|
||||
},
|
||||
}
|
||||
}
|
||||
,
|
||||
methods: {
|
||||
saveScenario(saveAs) {
|
||||
this.$refs['scenarioForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
let path = "/api/automation/create";
|
||||
this.setParameter();
|
||||
this.$fileUpload(path, null, [], this.scenarioForm, () => {
|
||||
this.visible = false;
|
||||
if (saveAs) {
|
||||
this.scenarioForm.request = JSON.stringify(this.scenarioForm.request);
|
||||
this.$parent.saveAsEdit(this.scenarioForm);
|
||||
} else {
|
||||
this.$parent.refresh(this.currentModule);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
})
|
||||
},
|
||||
setParameter() {
|
||||
this.scenarioForm.projectId = getCurrentProjectID();
|
||||
this.scenarioForm.id = getUUID().substring(0, 8);
|
||||
this.scenarioForm.protocol = this.currentProtocol;
|
||||
if (this.currentModule != null && this.currentModule != "newId") {
|
||||
this.scenarioForm.modulePath = this.currentModule.method !== undefined ? this.currentModule.method : null;
|
||||
this.scenarioForm.apiScenarioModuleId = this.currentModule.id;
|
||||
}
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.userOptions = response.data;
|
||||
});
|
||||
},
|
||||
open(currentModule) {
|
||||
this.scenarioForm = {principal: getCurrentUser().id};
|
||||
this.currentModule = currentModule;
|
||||
this.getMaintainerOptions();
|
||||
this.visible = true;
|
||||
}
|
||||
},
|
||||
getMaintainerOptions() {
|
||||
let workspaceId = localStorage.getItem(WORKSPACE_ID);
|
||||
this.$post('/user/ws/member/tester/list', {workspaceId: workspaceId}, response => {
|
||||
this.userOptions = response.data;
|
||||
});
|
||||
},
|
||||
open(currentModule) {
|
||||
this.scenarioForm = {principal: getCurrentUser().id};
|
||||
this.currentModule = currentModule;
|
||||
this.getMaintainerOptions();
|
||||
this.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<el-input v-model="tagForm.name" autocomplete="off" :placeholder="$t('commons.name')"/>
|
||||
</el-col>
|
||||
<el-col :span="4">
|
||||
<el-button @click="saveTag">{{$t('commons.save')}}</el-button>
|
||||
<el-button style="margin-left: 20px" @click="saveTag">{{$t('commons.save')}}</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form-item>
|
||||
|
@ -72,7 +72,7 @@
|
|||
},
|
||||
methods: {
|
||||
saveTag() {
|
||||
if (this.tagData.id != undefined && this.tagForm.id != null) {
|
||||
if (this.tagForm.id != undefined && this.tagForm.id != null) {
|
||||
this.path = "/api/tag/update";
|
||||
} else {
|
||||
this.path = "/api/tag/create";
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
</el-input>
|
||||
</div>
|
||||
<p class="tip">{{$t('api_test.definition.request.req_param')}} </p>
|
||||
<ms-api-request-form :headers="request.headers " :request="request" v-if="request.protocol==='HTTP'"/>
|
||||
<ms-api-request-form :referenced="true" :headers="request.headers " :request="request" v-if="request.protocol==='HTTP'"/>
|
||||
<ms-tcp-basis-parameters :request="request" v-if="request.protocol==='TCP'"/>
|
||||
<ms-sql-basis-parameters :request="request" v-if="request.protocol==='SQL'"/>
|
||||
<ms-dubbo-basis-parameters :request="request" v-if="request.protocol==='DUBBO' || request.protocol==='dubbo://'"/>
|
||||
|
|
|
@ -25,9 +25,11 @@
|
|||
</template>
|
||||
|
||||
</el-table-column>
|
||||
<el-table-column prop="tagName" :label="$t('api_test.automation.tag')" show-overflow-tooltip>
|
||||
<el-table-column prop="tagNames" :label="$t('api_test.automation.tag')" width="200px">
|
||||
<template v-slot:default="scope">
|
||||
<ms-tag type="success" effect="plain" v-if="scope.row.tagName!=undefined" :content="scope.row.tagName"/>
|
||||
<div v-for="itemName in scope.row.tagNames" :key="itemName">
|
||||
<ms-tag type="success" effect="plain" :content="itemName"/>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="userId" :label="$t('api_test.automation.creator')" show-overflow-tooltip/>
|
||||
|
@ -210,8 +212,8 @@
|
|||
this.$emit('edit', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
let obj = {id: row.id, projectId: row.projectId, name: row.name, status: 'Underway'}
|
||||
this.$fileUpload("/api/automation/update", null, [], obj, () => {
|
||||
let obj = [row.id];
|
||||
this.$post("/api/automation/reduction", obj, response => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
})
|
||||
|
@ -265,7 +267,7 @@
|
|||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/.el-drawer__header{
|
||||
/deep/ .el-drawer__header {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -265,6 +265,7 @@
|
|||
const children = parent.data.children || parent.data
|
||||
const index = children.findIndex(d => d.id !== undefined && data.id !== undefined && d.id === data.id)
|
||||
children.splice(index, 1);
|
||||
this.getApiModuleTree();
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -352,6 +352,9 @@
|
|||
}
|
||||
},
|
||||
created() {
|
||||
if (!this.currentScenario.apiScenarioModuleId) {
|
||||
this.currentScenario.apiScenarioModuleId = "";
|
||||
}
|
||||
this.projectId = getCurrentProjectID();
|
||||
this.operatingElements = ELEMENTS.get("ALL");
|
||||
this.getMaintainerOptions();
|
||||
|
@ -450,7 +453,7 @@
|
|||
this.reload();
|
||||
},
|
||||
addScenario(arr) {
|
||||
if (arr.length > 0) {
|
||||
if (arr && arr.length > 0) {
|
||||
arr.forEach(item => {
|
||||
item.enable === undefined ? item.enable = true : item.enable;
|
||||
this.scenarioDefinition.push(item);
|
||||
|
@ -476,7 +479,7 @@
|
|||
request.enable === undefined ? request.enable = true : request.enable;
|
||||
request.active = false;
|
||||
request.resourceId = getUUID();
|
||||
if (referenced === 'REF') {
|
||||
if (referenced === 'REF' || !request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
if (this.selectedTreeNode != undefined) {
|
||||
|
@ -496,7 +499,7 @@
|
|||
request.enable === undefined ? request.enable = true : request.enable;
|
||||
request.active = false;
|
||||
request.resourceId = getUUID();
|
||||
if (referenced === 'REF') {
|
||||
if (referenced === 'REF' || !request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
if (this.selectedTreeNode != undefined) {
|
||||
|
@ -506,6 +509,8 @@
|
|||
}
|
||||
})
|
||||
this.apiListVisible = false;
|
||||
this.currentRow.cases = [];
|
||||
this.currentRow.apis = [];
|
||||
this.sort();
|
||||
this.reload();
|
||||
},
|
||||
|
@ -708,10 +713,6 @@
|
|||
}
|
||||
},
|
||||
setParameter() {
|
||||
this.currentScenario.projectId = this.projectId;
|
||||
if (!this.currentScenario.id) {
|
||||
this.currentScenario.id = getUUID();
|
||||
}
|
||||
this.currentScenario.stepTotal = this.scenarioDefinition.length;
|
||||
this.currentScenario.modulePath = this.getPath(this.currentScenario.apiScenarioModuleId);
|
||||
// 构建一个场景对象 方便引用处理
|
||||
|
@ -861,7 +862,8 @@
|
|||
/deep/ .el-step__icon.is-text {
|
||||
border: 1px solid;
|
||||
}
|
||||
/deep/.el-drawer__header{
|
||||
|
||||
/deep/ .el-drawer__header {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
if (response.data) {
|
||||
response.data.forEach(item => {
|
||||
let scenarioDefinition = JSON.parse(item.scenarioDefinition);
|
||||
let obj = {id: item.id, name: item.name, type: "scenario", referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition};
|
||||
let obj = {id: item.id, name: item.name, type: "scenario", referenced: 'Copy', resourceId: getUUID(), hashTree: scenarioDefinition.hashTree};
|
||||
scenarios.push(obj);
|
||||
})
|
||||
this.$emit('addScenario', scenarios);
|
||||
|
|
|
@ -193,6 +193,7 @@
|
|||
this.total = response.data.itemCount;
|
||||
this.tableData = response.data.listObject;
|
||||
});
|
||||
this.selectRows = new Set();
|
||||
},
|
||||
handleSelect(selection, row) {
|
||||
row.hashTree = [];
|
||||
|
|
|
@ -335,6 +335,9 @@
|
|||
for (let index in response.data) {
|
||||
let test = response.data[index];
|
||||
test.request = JSON.parse(test.request);
|
||||
if (!test.request.hashTree) {
|
||||
test.request.hashTree = [];
|
||||
}
|
||||
}
|
||||
this.apiCaseList = response.data;
|
||||
if (this.apiCaseList.length == 0) {
|
||||
|
|
|
@ -77,6 +77,9 @@
|
|||
} else {
|
||||
this.reqUrl = "/api/definition/create";
|
||||
}
|
||||
if (!this.request.hashTree) {
|
||||
this.request.hashTree = [];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
runTest(data) {
|
||||
|
|
|
@ -230,10 +230,8 @@
|
|||
this.$emit('editApi', row);
|
||||
},
|
||||
reductionApi(row) {
|
||||
row.status = 'Underway';
|
||||
row.request = null;
|
||||
row.response = null;
|
||||
this.$fileUpload("/api/definition/update", null, [], row, () => {
|
||||
let ids = [row.id];
|
||||
this.$post('/api/definition/reduction/', ids, () => {
|
||||
this.$success(this.$t('commons.save_success'));
|
||||
this.search();
|
||||
});
|
||||
|
@ -275,6 +273,9 @@
|
|||
handleTestCase(api) {
|
||||
this.selectApi = api;
|
||||
let request = JSON.parse(api.request);
|
||||
if (!request.hashTree) {
|
||||
request.hashTree = [];
|
||||
}
|
||||
this.selectApi.url = request.path;
|
||||
this.$refs.caseList.open(this.selectApi);
|
||||
},
|
||||
|
|
|
@ -138,6 +138,7 @@
|
|||
if (this.expandedNode.length === 0) {
|
||||
this.expandedNode.push("root");
|
||||
}
|
||||
this.nextFlag = true;
|
||||
this.result = this.$get("/api/module/list/" + this.projectId + "/" + this.protocol, response => {
|
||||
if (response.data != undefined && response.data != null) {
|
||||
this.data[1].children = response.data;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<el-row>
|
||||
<el-col :span="21">
|
||||
<!-- HTTP 请求参数 -->
|
||||
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100%">
|
||||
<div style="border:1px #DCDFE6 solid; height: 100%;border-radius: 4px ;width: 100%" v-loading="isReloadData">
|
||||
<el-tabs v-model="activeName" class="request-tabs">
|
||||
<!-- 请求头-->
|
||||
<el-tab-pane :label="$t('api_test.request.headers')" name="headers">
|
||||
|
@ -58,23 +58,23 @@
|
|||
|
||||
</el-tabs>
|
||||
</div>
|
||||
|
||||
<div v-for="row in request.hashTree" :key="row.id" v-loading="isReloadData">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
|
||||
<div v-if="!referenced">
|
||||
<div v-for="row in request.hashTree" :key="row.id">
|
||||
<!-- 前置脚本 -->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PreProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.pre_script')" style-type="color: #B8741A;background-color: #F9F1EA"
|
||||
:jsr223-processor="row"/>
|
||||
<!--后置脚本-->
|
||||
<ms-jsr233-processor v-if="row.label ==='JSR223 PostProcessor'" @copyRow="copyRow" @remove="remove" :is-read-only="false" :title="$t('api_test.definition.request.post_script')" style-type="color: #783887;background-color: #F2ECF3"
|
||||
:jsr223-processor="row"/>
|
||||
<!--断言规则-->
|
||||
<ms-api-assertions v-if="row.type==='Assertions'" @copyRow="copyRow" @remove="remove" :is-read-only="isReadOnly" :assertions="row"/>
|
||||
<!--提取规则-->
|
||||
<ms-api-extract :is-read-only="isReadOnly" @copyRow="copyRow" @remove="remove" v-if="row.type==='Extract'" :extract="row"/>
|
||||
</div>
|
||||
</div>
|
||||
</el-col>
|
||||
<!--操作按钮-->
|
||||
<el-col :span="3" class="ms-left-cell">
|
||||
<el-col :span="3" class="ms-left-cell" v-if="!referenced">
|
||||
<el-button class="ms-left-buttion" size="small" @click="addPre">+{{$t('api_test.definition.request.pre_script')}}</el-button>
|
||||
<br/>
|
||||
<el-button class="ms-left-buttion" size="small" @click="addPost">+{{$t('api_test.definition.request.post_script')}}</el-button>
|
||||
|
@ -116,6 +116,7 @@
|
|||
return [];
|
||||
}
|
||||
},
|
||||
referenced: Boolean,
|
||||
isShowEnable: Boolean,
|
||||
jsonPathList: Array,
|
||||
isReadOnly: {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="request-form">
|
||||
<component :is="component" :is-read-only="isReadOnly" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
||||
<component :is="component" :is-read-only="isReadOnly" :referenced="referenced" :request="request" :headers="headers" :isShowEnable="isShowEnable"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -17,6 +17,10 @@
|
|||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
referenced: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
|
|
Loading…
Reference in New Issue