fix(测试用例): 用例模板图片问题
--bug=1046616 --user=王旭 【测试计划】项目未集成三方-功能用例-新建缺陷-自定义模版-创建报SQL异常 https://www.tapd.cn/55049933/s/1582334
This commit is contained in:
parent
c372e44f9b
commit
4fe35c8578
|
@ -190,6 +190,7 @@ public class FunctionalCaseService {
|
|||
List<String> uploadFileIds = functionalCaseAttachmentService.uploadFile(request.getProjectId(), caseId, files, true, userId);
|
||||
|
||||
//上传富文本里的文件
|
||||
filterCaseDetailTmpFile(request);
|
||||
functionalCaseAttachmentService.uploadMinioFile(caseId, request.getProjectId(), request.getCaseDetailFileIds(), userId, CaseFileSourceType.CASE_DETAIL.toString());
|
||||
|
||||
//关联附件
|
||||
|
@ -211,6 +212,16 @@ public class FunctionalCaseService {
|
|||
return functionalCase;
|
||||
}
|
||||
|
||||
private void filterCaseDetailTmpFile(FunctionalCaseAddRequest request) {
|
||||
// 非用例上传的图片文件不处理
|
||||
if (CollectionUtils.isNotEmpty(request.getCaseDetailFileIds())) {
|
||||
request.getCaseDetailFileIds().removeIf(tmpFileId -> !request.getDescription().contains("/attachment/download/file/" + request.getProjectId() + "/" + tmpFileId));
|
||||
request.getCaseDetailFileIds().removeIf(tmpFileId -> !request.getTextDescription().contains("/attachment/download/file/" + request.getProjectId() + "/" + tmpFileId));
|
||||
request.getCaseDetailFileIds().removeIf(tmpFileId -> !request.getExpectedResult().contains("/attachment/download/file/" + request.getProjectId() + "/" + tmpFileId));
|
||||
request.getCaseDetailFileIds().removeIf(tmpFileId -> !request.getPrerequisite().contains("/attachment/download/file/" + request.getProjectId() + "/" + tmpFileId));
|
||||
}
|
||||
}
|
||||
|
||||
private void copyAttachment(FunctionalCaseAddRequest request, String userId, List<String> uploadFileIds, String caseId) {
|
||||
//获取用例已经上传的文件ID
|
||||
Map<String, FunctionalCaseAttachmentDTO> attachmentDTOMap = request.getAttachments().stream().collect(Collectors.toMap(FunctionalCaseAttachmentDTO::getId, t -> t));
|
||||
|
@ -1277,7 +1288,7 @@ public class FunctionalCaseService {
|
|||
}
|
||||
|
||||
private void setCustomFieldValue(Object value, FunctionalCaseCustomField caseCustomField) {
|
||||
if (value !=null && (StringUtils.equalsIgnoreCase(value.toString(), "[]") || value instanceof List)) {
|
||||
if (value != null && (StringUtils.equalsIgnoreCase(value.toString(), "[]") || value instanceof List)) {
|
||||
//数组类型
|
||||
caseCustomField.setValue(JSON.toJSONString(value));
|
||||
} else {
|
||||
|
|
|
@ -353,6 +353,10 @@ public class FunctionalCaseControllerTests extends BaseTest {
|
|||
functionalCaseAddRequest.setName("测试用例新增");
|
||||
functionalCaseAddRequest.setCaseEditType("STEP");
|
||||
functionalCaseAddRequest.setModuleId("default_module_id");
|
||||
functionalCaseAddRequest.setDescription("");
|
||||
functionalCaseAddRequest.setExpectedResult("");
|
||||
functionalCaseAddRequest.setTextDescription("");
|
||||
functionalCaseAddRequest.setPrerequisite("");
|
||||
return functionalCaseAddRequest;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue