Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
489077ad08
|
@ -86,7 +86,7 @@ public class ApiAutomationController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/getApiScenario/{id}")
|
@GetMapping("/getApiScenario/{id}")
|
||||||
public ApiScenario getScenarioDefinition(@PathVariable String id) {
|
public ApiScenarioDTO getScenarioDefinition(@PathVariable String id) {
|
||||||
return apiAutomationService.getApiScenario(id);
|
return apiAutomationService.getApiScenario(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,4 +18,6 @@ public class ApiScenarioDTO extends ApiScenarioWithBLOBs {
|
||||||
* 场景跨项目ID
|
* 场景跨项目ID
|
||||||
*/
|
*/
|
||||||
private List<String> projectIds;
|
private List<String> projectIds;
|
||||||
|
|
||||||
|
private String caseId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,18 +94,15 @@ public class ApiAutomationService {
|
||||||
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
public List<ApiScenarioDTO> list(ApiScenarioRequest request) {
|
||||||
request = this.initRequest(request, true, true);
|
request = this.initRequest(request, true, true);
|
||||||
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
List<ApiScenarioDTO> list = extApiScenarioMapper.list(request);
|
||||||
setApiScenarioProjectIds(list);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
public List<ApiScenarioDTO> listReview(ApiScenarioRequest request) {
|
public List<ApiScenarioDTO> listReview(ApiScenarioRequest request) {
|
||||||
request = this.initRequest(request, true, true);
|
request = this.initRequest(request, true, true);
|
||||||
List<ApiScenarioDTO> list = extApiScenarioMapper.listReview(request);
|
List<ApiScenarioDTO> list = extApiScenarioMapper.listReview(request);
|
||||||
setApiScenarioProjectIds(list);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
private void setApiScenarioProjectIds(List<ApiScenarioDTO> list) {
|
private void setApiScenarioProjectIds(ApiScenarioDTO data) {
|
||||||
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
|
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
|
||||||
list.forEach(data -> {
|
|
||||||
List<String> idList = new ArrayList<>();
|
List<String> idList = new ArrayList<>();
|
||||||
String definition = data.getScenarioDefinition();
|
String definition = data.getScenarioDefinition();
|
||||||
if (StringUtils.isNotBlank(definition)) {
|
if (StringUtils.isNotBlank(definition)) {
|
||||||
|
@ -129,7 +126,6 @@ public class ApiAutomationService {
|
||||||
|
|
||||||
}
|
}
|
||||||
data.setProjectIds(idList);
|
data.setProjectIds(idList);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -333,8 +329,12 @@ public class ApiAutomationService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ApiScenarioWithBLOBs getApiScenario(String id) {
|
public ApiScenarioDTO getApiScenario(String id) {
|
||||||
return apiScenarioMapper.selectByPrimaryKey(id);
|
ApiScenarioDTO apiScenarioDTO = new ApiScenarioDTO();
|
||||||
|
ApiScenarioWithBLOBs scenarioWithBLOBs = apiScenarioMapper.selectByPrimaryKey(id);
|
||||||
|
BeanUtils.copyBean(apiScenarioDTO, scenarioWithBLOBs);
|
||||||
|
setApiScenarioProjectIds(apiScenarioDTO);
|
||||||
|
return apiScenarioDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApiScenarioWithBLOBs> getApiScenarios(List<String> ids) {
|
public List<ApiScenarioWithBLOBs> getApiScenarios(List<String> ids) {
|
||||||
|
|
|
@ -134,7 +134,6 @@
|
||||||
</sql>
|
</sql>
|
||||||
<select id="list" resultMap="BaseResultMap">
|
<select id="list" resultMap="BaseResultMap">
|
||||||
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
|
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
|
||||||
api_scenario.scenario_definition,
|
|
||||||
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
|
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
|
||||||
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
|
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
|
||||||
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
|
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
|
||||||
|
@ -339,7 +338,6 @@
|
||||||
</select>
|
</select>
|
||||||
<select id="listReview" resultMap="BaseResultMap">
|
<select id="listReview" resultMap="BaseResultMap">
|
||||||
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
|
select api_scenario.id, api_scenario.project_id, api_scenario.tags, api_scenario.user_id, api_scenario.num,
|
||||||
api_scenario.scenario_definition,
|
|
||||||
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
|
api_scenario.api_scenario_module_id,api_scenario.module_path, api_scenario.name, api_scenario.level,
|
||||||
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
|
api_scenario.status, api_scenario.principal, api_scenario.step_total, api_scenario.follow_people,
|
||||||
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
|
api_scenario.last_result,api_scenario.pass_rate,api_scenario.report_id,
|
||||||
|
|
|
@ -101,6 +101,12 @@ public class TestPlanTestCaseController {
|
||||||
testPlanTestCaseService.editTestCase(testPlanTestCase);
|
testPlanTestCaseService.editTestCase(testPlanTestCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/minder/edit")
|
||||||
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
|
public void editTestCaseForMinder(@RequestBody List<TestPlanTestCaseWithBLOBs> testPlanTestCases) {
|
||||||
|
testPlanTestCaseService.editTestCaseForMinder(testPlanTestCases);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/batch/edit")
|
@PostMapping("/batch/edit")
|
||||||
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
@RequiresRoles(value = {RoleConstants.TEST_USER, RoleConstants.TEST_MANAGER}, logical = Logical.OR)
|
||||||
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
|
public void editTestCaseBath(@RequestBody TestPlanCaseBatchRequest request) {
|
||||||
|
|
|
@ -1,22 +1,16 @@
|
||||||
package io.metersphere.track.service;
|
package io.metersphere.track.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONPath;
|
|
||||||
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
import io.metersphere.api.dto.automation.ApiScenarioDTO;
|
||||||
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
import io.metersphere.api.dto.automation.ApiScenarioRequest;
|
||||||
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
import io.metersphere.api.dto.automation.RunScenarioRequest;
|
||||||
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
|
import io.metersphere.api.dto.automation.TestPlanScenarioRequest;
|
||||||
import io.metersphere.api.dto.definition.RunDefinitionRequest;
|
|
||||||
import io.metersphere.api.service.ApiAutomationService;
|
import io.metersphere.api.service.ApiAutomationService;
|
||||||
import io.metersphere.api.service.ApiScenarioReportService;
|
import io.metersphere.api.service.ApiScenarioReportService;
|
||||||
import io.metersphere.base.domain.TestCaseReviewScenario;
|
import io.metersphere.base.domain.TestCaseReviewScenario;
|
||||||
import io.metersphere.base.domain.TestCaseReviewScenarioExample;
|
import io.metersphere.base.domain.TestCaseReviewScenarioExample;
|
||||||
import io.metersphere.base.domain.TestPlanApiScenario;
|
|
||||||
import io.metersphere.base.domain.TestPlanApiScenarioExample;
|
|
||||||
import io.metersphere.base.mapper.TestCaseReviewScenarioMapper;
|
import io.metersphere.base.mapper.TestCaseReviewScenarioMapper;
|
||||||
import io.metersphere.base.mapper.TestPlanApiScenarioMapper;
|
|
||||||
import io.metersphere.base.mapper.ext.ExtTestCaseReviewScenarioCaseMapper;
|
import io.metersphere.base.mapper.ext.ExtTestCaseReviewScenarioCaseMapper;
|
||||||
import io.metersphere.base.mapper.ext.ExtTestPlanScenarioCaseMapper;
|
|
||||||
import io.metersphere.commons.constants.ApiRunMode;
|
import io.metersphere.commons.constants.ApiRunMode;
|
||||||
import io.metersphere.commons.utils.ServiceUtils;
|
import io.metersphere.commons.utils.ServiceUtils;
|
||||||
import io.metersphere.track.dto.RelevanceScenarioRequest;
|
import io.metersphere.track.dto.RelevanceScenarioRequest;
|
||||||
|
@ -45,46 +39,15 @@ public class TestCaseReviewScenarioCaseService {
|
||||||
request.setProjectId(null);
|
request.setProjectId(null);
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
List<ApiScenarioDTO> apiTestCases = extTestCaseReviewScenarioCaseMapper.list(request);
|
List<ApiScenarioDTO> apiTestCases = extTestCaseReviewScenarioCaseMapper.list(request);
|
||||||
setApiScenarioProjectIds(apiTestCases);
|
|
||||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setApiScenarioProjectIds(List<ApiScenarioDTO> list) {
|
|
||||||
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
|
|
||||||
list.forEach(data -> {
|
|
||||||
List<String> idList = new ArrayList<>();
|
|
||||||
String definition = data.getScenarioDefinition();
|
|
||||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(definition)) {
|
|
||||||
RunDefinitionRequest d = JSON.parseObject(definition, RunDefinitionRequest.class);
|
|
||||||
|
|
||||||
if (d != null) {
|
|
||||||
Map<String, String> map = d.getEnvironmentMap();
|
|
||||||
if (map != null) {
|
|
||||||
if (map.isEmpty()) {
|
|
||||||
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
|
|
||||||
idList.addAll(new HashSet<>(ids));
|
|
||||||
} else {
|
|
||||||
Set<String> set = d.getEnvironmentMap().keySet();
|
|
||||||
idList = new ArrayList<>(set);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
|
|
||||||
idList.add(data.getProjectId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
data.setProjectIds(idList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ApiScenarioDTO> relevanceList(ApiScenarioRequest request) {
|
public List<ApiScenarioDTO> relevanceList(ApiScenarioRequest request) {
|
||||||
request.setNotInTestPlan(true);
|
request.setNotInTestPlan(true);
|
||||||
List<ApiScenarioDTO> list = apiAutomationService.listReview(request);
|
List<ApiScenarioDTO> list = apiAutomationService.listReview(request);
|
||||||
setApiScenarioProjectIds(list);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,46 +42,15 @@ public class TestPlanScenarioCaseService {
|
||||||
request.setProjectId(null);
|
request.setProjectId(null);
|
||||||
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
|
||||||
List<ApiScenarioDTO> apiTestCases = extTestPlanScenarioCaseMapper.list(request);
|
List<ApiScenarioDTO> apiTestCases = extTestPlanScenarioCaseMapper.list(request);
|
||||||
setApiScenarioProjectIds(apiTestCases);
|
|
||||||
if (CollectionUtils.isEmpty(apiTestCases)) {
|
if (CollectionUtils.isEmpty(apiTestCases)) {
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
return apiTestCases;
|
return apiTestCases;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setApiScenarioProjectIds(List<ApiScenarioDTO> list) {
|
|
||||||
// 如果场景步骤涉及多项目,则把涉及到的项目ID保存在projectIds属性
|
|
||||||
list.forEach(data -> {
|
|
||||||
List<String> idList = new ArrayList<>();
|
|
||||||
String definition = data.getScenarioDefinition();
|
|
||||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(definition)) {
|
|
||||||
RunDefinitionRequest d = JSON.parseObject(definition, RunDefinitionRequest.class);
|
|
||||||
|
|
||||||
if (d != null) {
|
|
||||||
Map<String, String> map = d.getEnvironmentMap();
|
|
||||||
if (map != null) {
|
|
||||||
if (map.isEmpty()) {
|
|
||||||
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
|
|
||||||
idList.addAll(new HashSet<>(ids));
|
|
||||||
} else {
|
|
||||||
Set<String> set = d.getEnvironmentMap().keySet();
|
|
||||||
idList = new ArrayList<>(set);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// 兼容历史数据,无EnvironmentMap直接赋值场景所属项目
|
|
||||||
idList.add(data.getProjectId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
data.setProjectIds(idList);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ApiScenarioDTO> relevanceList(ApiScenarioRequest request) {
|
public List<ApiScenarioDTO> relevanceList(ApiScenarioRequest request) {
|
||||||
request.setNotInTestPlan(true);
|
request.setNotInTestPlan(true);
|
||||||
List<ApiScenarioDTO> list = apiAutomationService.list(request);
|
List<ApiScenarioDTO> list = apiAutomationService.list(request);
|
||||||
setApiScenarioProjectIds(list);
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,4 +154,11 @@ public class TestPlanTestCaseService {
|
||||||
public List<TestPlanCaseDTO> listForMinder(String planId) {
|
public List<TestPlanCaseDTO> listForMinder(String planId) {
|
||||||
return extTestPlanTestCaseMapper.listForMinder(planId);
|
return extTestPlanTestCaseMapper.listForMinder(planId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void editTestCaseForMinder(List<TestPlanTestCaseWithBLOBs> testPlanTestCases) {
|
||||||
|
testPlanTestCases.forEach(item -> {
|
||||||
|
item.setUpdateTime(System.currentTimeMillis());
|
||||||
|
testPlanTestCaseMapper.updateByPrimaryKeySelective(item);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,6 +172,8 @@ public class TestReviewTestCaseService {
|
||||||
testCase.setId(item.getCaseId());
|
testCase.setId(item.getCaseId());
|
||||||
testCase.setReviewStatus(item.getStatus());
|
testCase.setReviewStatus(item.getStatus());
|
||||||
testCaseList.add(testCase);
|
testCaseList.add(testCase);
|
||||||
|
testCase.setUpdateTime(System.currentTimeMillis());
|
||||||
|
item.setUpdateTime(System.currentTimeMillis());
|
||||||
testCaseReviewTestCaseMapper.updateByPrimaryKeySelective(item);
|
testCaseReviewTestCaseMapper.updateByPrimaryKeySelective(item);
|
||||||
});
|
});
|
||||||
testCaseList.forEach(testCaseMapper::updateByPrimaryKeySelective);
|
testCaseList.forEach(testCaseMapper::updateByPrimaryKeySelective);
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
"xml-js": "^1.6.11",
|
"xml-js": "^1.6.11",
|
||||||
"yan-progress": "^1.0.3",
|
"yan-progress": "^1.0.3",
|
||||||
"jsonpath": "^1.1.0",
|
"jsonpath": "^1.1.0",
|
||||||
"vue-minder-editor-plus": "^1.0.17",
|
"vue-minder-editor-plus": "^1.0.18",
|
||||||
"jsencrypt": "^3.1.0"
|
"jsencrypt": "^3.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
@ -439,7 +439,7 @@
|
||||||
},
|
},
|
||||||
handleBatchEdit() {
|
handleBatchEdit() {
|
||||||
this.$refs.batchEdit.open(this.selectDataCounts);
|
this.$refs.batchEdit.open(this.selectDataCounts);
|
||||||
this.$refs.batchEdit.setScenarioSelectRows(this.selectRows);
|
this.$refs.batchEdit.setScenarioSelectRows(this.selectRows, "scenario");
|
||||||
},
|
},
|
||||||
handleBatchMove() {
|
handleBatchMove() {
|
||||||
this.$refs.testBatchMove.open(this.moduleTree, [], this.moduleOptions);
|
this.$refs.testBatchMove.open(this.moduleTree, [], this.moduleOptions);
|
||||||
|
@ -457,11 +457,7 @@
|
||||||
// 批量修改环境
|
// 批量修改环境
|
||||||
if (form.type === 'projectEnv') {
|
if (form.type === 'projectEnv') {
|
||||||
let param = {};
|
let param = {};
|
||||||
let map = new Map();
|
param.mapping = strMapToObj(form.map);
|
||||||
this.selectRows.forEach(row => {
|
|
||||||
map.set(row.id, row.projectIds);
|
|
||||||
})
|
|
||||||
param.mapping = strMapToObj(map);
|
|
||||||
param.envMap = strMapToObj(form.projectEnvMap);
|
param.envMap = strMapToObj(form.projectEnvMap);
|
||||||
this.$post('/api/automation/batch/update/env', param, () => {
|
this.$post('/api/automation/batch/update/env', param, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
|
@ -519,11 +515,7 @@
|
||||||
|
|
||||||
this.planVisible = false;
|
this.planVisible = false;
|
||||||
|
|
||||||
let map = new Map();
|
obj.mapping = strMapToObj(params[2]);
|
||||||
this.selectRows.forEach(row => {
|
|
||||||
map.set(row.id, row.projectIds);
|
|
||||||
})
|
|
||||||
obj.mapping = strMapToObj(map);
|
|
||||||
obj.envMap = strMapToObj(params[1]);
|
obj.envMap = strMapToObj(params[1]);
|
||||||
|
|
||||||
this.$post("/api/automation/scenario/plan", obj, response => {
|
this.$post("/api/automation/scenario/plan", obj, response => {
|
||||||
|
|
|
@ -195,7 +195,8 @@ export default {
|
||||||
],
|
],
|
||||||
projectEnvMap: new Map(),
|
projectEnvMap: new Map(),
|
||||||
projectList: [],
|
projectList: [],
|
||||||
projectIds: new Set()
|
projectIds: new Set(),
|
||||||
|
map: new Map(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -221,7 +222,7 @@ export default {
|
||||||
if (!sign) {
|
if (!sign) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.$emit('addTestPlan', this.selection, this.projectEnvMap);
|
this.$emit('addTestPlan', this.selection, this.projectEnvMap, this.map);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cancel(){
|
cancel(){
|
||||||
|
@ -237,7 +238,11 @@ export default {
|
||||||
setScenarioSelectRows(rows) {
|
setScenarioSelectRows(rows) {
|
||||||
this.projectIds.clear();
|
this.projectIds.clear();
|
||||||
rows.forEach(row => {
|
rows.forEach(row => {
|
||||||
row.projectIds.forEach(id => this.projectIds.add(id));
|
this.result = this.$get('/api/automation/getApiScenario/' + row.id, res => {
|
||||||
|
let data = res.data;
|
||||||
|
data.projectIds.forEach(d => this.projectIds.add(d));
|
||||||
|
this.map.set(row.id, data.projectIds);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
initTableData() {
|
initTableData() {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
:height="700"
|
:height="700"
|
||||||
:progress-enable="false"
|
:progress-enable="false"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
|
:distinct-tags="distinctTags"
|
||||||
@save="save"
|
@save="save"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
@ -36,6 +37,12 @@ export default {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
distinctTags: {
|
||||||
|
type: Array,
|
||||||
|
default() {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -54,7 +54,6 @@ export default {
|
||||||
/*this.optionalField = items*/
|
/*this.optionalField = items*/
|
||||||
},
|
},
|
||||||
saveHeader() {
|
saveHeader() {
|
||||||
console.log(this.type)
|
|
||||||
let param = {
|
let param = {
|
||||||
userId: getCurrentUser().id,
|
userId: getCurrentUser().id,
|
||||||
type: this.type,
|
type: this.type,
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
class="batch-edit-dialog"
|
class="batch-edit-dialog"
|
||||||
:destroy-on-close="true"
|
:destroy-on-close="true"
|
||||||
@close="handleClose"
|
@close="handleClose"
|
||||||
|
v-loading="result.loading"
|
||||||
>
|
>
|
||||||
<el-form :model="form" label-position="right" label-width="150px" size="medium" ref="form" :rules="rules">
|
<el-form :model="form" label-position="right" label-width="150px" size="medium" ref="form" :rules="rules">
|
||||||
<el-form-item :label="$t('test_track.case.batch_update', [size])" prop="type">
|
<el-form-item :label="$t('test_track.case.batch_update', [size])" prop="type">
|
||||||
|
@ -72,7 +73,10 @@
|
||||||
projectList: [],
|
projectList: [],
|
||||||
projectIds: new Set(),
|
projectIds: new Set(),
|
||||||
selectRows: new Set(),
|
selectRows: new Set(),
|
||||||
projectEnvMap: new Map()
|
projectEnvMap: new Map(),
|
||||||
|
map: new Map(),
|
||||||
|
isScenario: '',
|
||||||
|
result: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -84,6 +88,7 @@
|
||||||
if (!this.$refs.envPopover.checkEnv()) {
|
if (!this.$refs.envPopover.checkEnv()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
this.form.map = this.map;
|
||||||
}
|
}
|
||||||
this.$emit("batchEdit", this.form);
|
this.$emit("batchEdit", this.form);
|
||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
|
@ -113,12 +118,9 @@
|
||||||
this.projectIds.add(row.projectId)
|
this.projectIds.add(row.projectId)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
setScenarioSelectRows(rows) {
|
setScenarioSelectRows(rows, sign) {
|
||||||
this.selectRows = rows;
|
this.selectRows = rows;
|
||||||
this.projectIds.clear();
|
this.isScenario = sign;
|
||||||
this.selectRows.forEach(row => {
|
|
||||||
row.projectIds.forEach(id => this.projectIds.add(id));
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
handleClose() {
|
handleClose() {
|
||||||
this.form = {};
|
this.form = {};
|
||||||
|
@ -127,6 +129,17 @@
|
||||||
},
|
},
|
||||||
changeType(val) {
|
changeType(val) {
|
||||||
this.$set(this.form, "value", "");
|
this.$set(this.form, "value", "");
|
||||||
|
if (val === 'projectEnv' && this.isScenario !== '') {
|
||||||
|
this.projectIds.clear();
|
||||||
|
this.selectRows.forEach(row => {
|
||||||
|
let id = this.isScenario === 'scenario' ? row.id : row.caseId;
|
||||||
|
this.result = this.$get('/api/automation/getApiScenario/' + id, res => {
|
||||||
|
let data = res.data;
|
||||||
|
data.projectIds.forEach(d => this.projectIds.add(d));
|
||||||
|
this.map.set(row.id, data.projectIds);
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
this.filterable = val === "maintainer" || val === "executor";
|
this.filterable = val === "maintainer" || val === "executor";
|
||||||
this.options = this.valueArr[val];
|
this.options = this.valueArr[val];
|
||||||
this.typeArr.forEach(item => {
|
this.typeArr.forEach(item => {
|
||||||
|
|
|
@ -679,8 +679,6 @@ export default {
|
||||||
return param;
|
return param;
|
||||||
},
|
},
|
||||||
getOption(param) {
|
getOption(param) {
|
||||||
console.log(this.type)
|
|
||||||
console.log("3452")
|
|
||||||
let formData = new FormData();
|
let formData = new FormData();
|
||||||
let type = this.type
|
let type = this.type
|
||||||
if (this.type === 'copy') {
|
if (this.type === 'copy') {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:data-map="dataMap"
|
:data-map="dataMap"
|
||||||
|
:tags="tags"
|
||||||
@save="save"
|
@save="save"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -17,6 +18,7 @@ name: "TestCaseMinder",
|
||||||
return{
|
return{
|
||||||
testCase: [],
|
testCase: [],
|
||||||
dataMap: new Map(),
|
dataMap: new Map(),
|
||||||
|
tags: ['用例', '前置条件', '备注'],
|
||||||
result: {}
|
result: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
v-loading="result.loading"
|
v-loading="result.loading"
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:data-map="dataMap"
|
:data-map="dataMap"
|
||||||
|
:tags="tags"
|
||||||
|
:distinct-tags="[...tags, '未开始']"
|
||||||
@save="save"
|
@save="save"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -15,9 +17,9 @@ name: "TestPlanMinder",
|
||||||
components: {MsModuleMinder},
|
components: {MsModuleMinder},
|
||||||
data() {
|
data() {
|
||||||
return{
|
return{
|
||||||
testCase: [],
|
|
||||||
dataMap: new Map(),
|
dataMap: new Map(),
|
||||||
result: {}
|
result: {},
|
||||||
|
tags: ['通过', '失败', '阻塞', '跳过'],
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@ -44,24 +46,30 @@ name: "TestPlanMinder",
|
||||||
getTestCases() {
|
getTestCases() {
|
||||||
if (this.projectId) {
|
if (this.projectId) {
|
||||||
this.result = this.$get('/test/plan/case/list/minder/' + this.planId, response => {
|
this.result = this.$get('/test/plan/case/list/minder/' + this.planId, response => {
|
||||||
this.testCase = response.data;
|
this.dataMap = getTestCaseDataMap(response.data, true, (data, item) => {
|
||||||
this.dataMap = getTestCaseDataMap(this.testCase);
|
if (item.stats === 'Pass') {
|
||||||
|
data.resource.push("通过");
|
||||||
|
} else if (item.reviewStatus === 'Failure') {
|
||||||
|
data.resource.push("失败");
|
||||||
|
} else if (item.reviewStatus === 'Blocking') {
|
||||||
|
data.resource.push("阻塞");
|
||||||
|
} else if (item.reviewStatus === 'Skip') {
|
||||||
|
data.resource.push("跳过");
|
||||||
|
} else {
|
||||||
|
data.resource.push("未开始");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
save(data) {
|
save(data) {
|
||||||
// let saveCases = [];
|
let saveCases = [];
|
||||||
// this.buildSaveCase(data.root, saveCases, undefined);
|
this.buildSaveCase(data.root, saveCases);
|
||||||
// console.log(saveCases);
|
this.result = this.$post('/test/plan/case/minder/edit', saveCases, () => {
|
||||||
// let param = {
|
this.$success(this.$t('commons.save_success'));
|
||||||
// projectId: this.projectId,
|
});
|
||||||
// data: saveCases
|
|
||||||
// }
|
|
||||||
// this.result = this.$post('/test/case/minder/edit', param, () => {
|
|
||||||
// this.$success(this.$t('commons.save_success'));
|
|
||||||
// });
|
|
||||||
},
|
},
|
||||||
buildSaveCase(root, saveCases, parent) {
|
buildSaveCase(root, saveCases) {
|
||||||
let data = root.data;
|
let data = root.data;
|
||||||
if (data.resource && data.resource.indexOf("用例") > -1) {
|
if (data.resource && data.resource.indexOf("用例") > -1) {
|
||||||
this._buildSaveCase(root, saveCases, parent);
|
this._buildSaveCase(root, saveCases, parent);
|
||||||
|
@ -73,52 +81,27 @@ name: "TestPlanMinder",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_buildSaveCase(node, saveCases, parent) {
|
_buildSaveCase(node, saveCases) {
|
||||||
let data = node.data;
|
let data = node.data;
|
||||||
let isChange = false;
|
if (!data.changed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let testCase = {
|
let testCase = {
|
||||||
id: data.id,
|
id: data.id,
|
||||||
name: data.text,
|
|
||||||
nodeId: parent ? parent.id : "",
|
|
||||||
nodePath: parent ? parent.path : "",
|
|
||||||
type: data.type ? data.type : 'functional',
|
|
||||||
method: data.method ? data.method : 'manual',
|
|
||||||
maintainer: data.maintainer,
|
|
||||||
priority: 'P' + data.priority,
|
|
||||||
};
|
};
|
||||||
if (data.changed) isChange = true;
|
if (data.resource.length > 1) {
|
||||||
let steps = [];
|
if (data.resource.indexOf('失败') > -1) {
|
||||||
let stepNum = 1;
|
testCase.status = 'Failure';
|
||||||
if (node.children) {
|
} else if (data.resource.indexOf('通过') > -1) {
|
||||||
node.children.forEach((childNode) => {
|
testCase.status = 'Pass';
|
||||||
let childData = childNode.data;
|
} else if (data.resource.indexOf('阻塞') > -1) {
|
||||||
if (childData.resource && childData.resource.indexOf('前置条件') > -1) {
|
testCase.status = 'Blocking';
|
||||||
testCase.prerequisite = childData.text;
|
} else if (data.resource.indexOf('跳过') > -1) {
|
||||||
} else if (childData.resource && childData.resource.indexOf('备注') > -1) {
|
testCase.status = 'Skip';
|
||||||
testCase.remark = childData.text;
|
|
||||||
} else {
|
|
||||||
// 测试步骤
|
|
||||||
let step = {};
|
|
||||||
step.num = stepNum++;
|
|
||||||
step.desc = childData.text;
|
|
||||||
if (childNode.children) {
|
|
||||||
let result = "";
|
|
||||||
childNode.children.forEach((child) => {
|
|
||||||
result += child.data.text;
|
|
||||||
if (child.data.changed) isChange = true;
|
|
||||||
})
|
|
||||||
step.result = result;
|
|
||||||
}
|
}
|
||||||
steps.push(step);
|
|
||||||
}
|
}
|
||||||
if (childData.changed) isChange = true;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
testCase.steps = JSON.stringify(steps);
|
|
||||||
if (isChange) {
|
|
||||||
saveCases.push(testCase);
|
saveCases.push(testCase);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
:tree-nodes="treeNodes"
|
:tree-nodes="treeNodes"
|
||||||
:data-map="dataMap"
|
:data-map="dataMap"
|
||||||
:tags="tags"
|
:tags="tags"
|
||||||
|
:distinct-tags="[...tags, '未开始']"
|
||||||
@save="save"
|
@save="save"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
@ -16,7 +17,6 @@ name: "TestReviewMinder",
|
||||||
components: {MsModuleMinder},
|
components: {MsModuleMinder},
|
||||||
data() {
|
data() {
|
||||||
return{
|
return{
|
||||||
testCase: [],
|
|
||||||
dataMap: new Map(),
|
dataMap: new Map(),
|
||||||
tags: ['通过', '不通过'],
|
tags: ['通过', '不通过'],
|
||||||
result: {}
|
result: {}
|
||||||
|
@ -60,10 +60,8 @@ name: "TestReviewMinder",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
save(data) {
|
save(data) {
|
||||||
console.log(data);
|
|
||||||
let saveCases = [];
|
let saveCases = [];
|
||||||
this.buildSaveCase(data.root, saveCases);
|
this.buildSaveCase(data.root, saveCases);
|
||||||
console.log(saveCases);
|
|
||||||
this.result = this.$post('/test/review/case/minder/edit', saveCases, () => {
|
this.result = this.$post('/test/review/case/minder/edit', saveCases, () => {
|
||||||
this.$success(this.$t('commons.save_success'));
|
this.$success(this.$t('commons.save_success'));
|
||||||
});
|
});
|
||||||
|
@ -91,9 +89,9 @@ name: "TestReviewMinder",
|
||||||
// name: data.text,
|
// name: data.text,
|
||||||
};
|
};
|
||||||
if (data.resource.length > 1) {
|
if (data.resource.length > 1) {
|
||||||
if (data.resource.indexOf('不通过')) {
|
if (data.resource.indexOf('不通过') > -1) {
|
||||||
testCase.status = 'UnPass';
|
testCase.status = 'UnPass';
|
||||||
} else if (data.resource.indexOf('通过')) {
|
} else if (data.resource.indexOf('通过') > -1) {
|
||||||
testCase.status = 'Pass';
|
testCase.status = 'Pass';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,11 @@ function parseChildren(nodeItem, item, isDisable) {
|
||||||
let children = [];
|
let children = [];
|
||||||
_parseChildren(children, item.prerequisite, "前置条件", isDisable);
|
_parseChildren(children, item.prerequisite, "前置条件", isDisable);
|
||||||
item.steps.forEach((step) => {
|
item.steps.forEach((step) => {
|
||||||
let descNode = _parseChildren(children, step.desc, "测试步骤", isDisable);
|
let descNode = _parseChildren(children, step.desc, undefined, isDisable);
|
||||||
if (descNode) {
|
if (descNode) {
|
||||||
descNode.data.num = step.num;
|
descNode.data.num = step.num;
|
||||||
descNode.children = [];
|
descNode.children = [];
|
||||||
_parseChildren(descNode.children, step.result, "预期结果", isDisable);
|
_parseChildren(descNode.children, step.result, undefined, isDisable);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_parseChildren(children, item.remark, "备注", isDisable);
|
_parseChildren(children, item.remark, "备注", isDisable);
|
||||||
|
@ -58,7 +58,7 @@ function _parseChildren(children, k, v, isDisable) {
|
||||||
let node = {
|
let node = {
|
||||||
data: {
|
data: {
|
||||||
text: k,
|
text: k,
|
||||||
resource: [v]
|
resource: v ? [v] : []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isDisable) {
|
if (isDisable) {
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
projectEnvMap: new Map(),
|
projectEnvMap: new Map(),
|
||||||
projectList: [],
|
projectList: [],
|
||||||
projectIds: new Set(),
|
projectIds: new Set(),
|
||||||
|
map: new Map()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
|
@ -159,8 +160,10 @@
|
||||||
initProjectIds() {
|
initProjectIds() {
|
||||||
this.projectIds.clear();
|
this.projectIds.clear();
|
||||||
this.selectRows.forEach(row => {
|
this.selectRows.forEach(row => {
|
||||||
row.projectIds.forEach(id => {
|
this.result = this.$get('/api/automation/getApiScenario/' + row.id, res => {
|
||||||
this.projectIds.add(id);
|
let data = res.data;
|
||||||
|
data.projectIds.forEach(d => this.projectIds.add(d));
|
||||||
|
this.map.set(row.id, data.projectIds);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -104,12 +104,8 @@
|
||||||
}
|
}
|
||||||
let param = {};
|
let param = {};
|
||||||
let url = '/api/automation/relevance';
|
let url = '/api/automation/relevance';
|
||||||
let rows = this.$refs.apiScenarioList.selectRows;
|
|
||||||
const envMap = this.$refs.apiScenarioList.projectEnvMap;
|
const envMap = this.$refs.apiScenarioList.projectEnvMap;
|
||||||
let map = new Map();
|
let map = this.$refs.apiScenarioList.map;
|
||||||
rows.forEach(row => {
|
|
||||||
map.set(row.id, row.projectIds);
|
|
||||||
})
|
|
||||||
param.planId = this.planId;
|
param.planId = this.planId;
|
||||||
param.mapping = strMapToObj(map);
|
param.mapping = strMapToObj(map);
|
||||||
param.envMap = strMapToObj(envMap);
|
param.envMap = strMapToObj(envMap);
|
||||||
|
|
|
@ -358,15 +358,11 @@ export default {
|
||||||
},
|
},
|
||||||
handleBatchEdit() {
|
handleBatchEdit() {
|
||||||
this.$refs.batchEdit.open(this.selectRows.size);
|
this.$refs.batchEdit.open(this.selectRows.size);
|
||||||
this.$refs.batchEdit.setScenarioSelectRows(this.selectRows);
|
this.$refs.batchEdit.setScenarioSelectRows(this.selectRows, "planScenario");
|
||||||
},
|
},
|
||||||
batchEdit(form) {
|
batchEdit(form) {
|
||||||
let param = {};
|
let param = {};
|
||||||
let map = new Map();
|
param.mapping = strMapToObj(form.map);
|
||||||
this.selectRows.forEach(row => {
|
|
||||||
map.set(row.id, row.projectIds);
|
|
||||||
})
|
|
||||||
param.mapping = strMapToObj(map);
|
|
||||||
param.envMap = strMapToObj(form.projectEnvMap);
|
param.envMap = strMapToObj(form.projectEnvMap);
|
||||||
if (this.planId) {
|
if (this.planId) {
|
||||||
this.$post('/test/plan/scenario/case/batch/update/env', param, () => {
|
this.$post('/test/plan/scenario/case/batch/update/env', param, () => {
|
||||||
|
|
Loading…
Reference in New Issue