fix(UI 自动化): ui 报告集合图片兼容v2.1版本

This commit is contained in:
zhangdahai112 2022-08-31 18:27:34 +08:00 committed by zhangdahai112
parent 7474a12661
commit cc1d7ca5ab
1 changed files with 20 additions and 2 deletions

View File

@ -298,8 +298,7 @@ public class ApiScenarioReportStructureService {
RequestResult result = new RequestResultExpandDTO(reportResult);
if (reportResult.getContent() != null) {
if (reportType.startsWith(SystemConstants.TestTypeEnum.UI.name())) {
result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), UiCommandResult.class);
((UiCommandResult)result).calTime();
result = getUIRequestResult(reportResults, i, result);
} else {
result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), RequestResult.class);
}
@ -398,6 +397,25 @@ public class ApiScenarioReportStructureService {
}
}
/**
* ui 的报告内容不进行懒加载统一从 content 中取由于 v2.1 中合并图片存在 baseInfo
* 这里做一个兼容处理
*
* @param reportResults
* @param i
* @param result
* @return
*/
private RequestResult getUIRequestResult(List<ApiScenarioReportResultWithBLOBs> reportResults, int i, RequestResult result) {
String combinationImg = ((RequestResultExpandDTO) result).getCombinationImg();
result = JSON.parseObject(new String(reportResults.get(i).getContent(), StandardCharsets.UTF_8), UiCommandResult.class);
((UiCommandResult) result).calTime();
if (StringUtils.isNotBlank(combinationImg)) {
((UiCommandResult) result).setCombinationImg(combinationImg);
}
return result;
}
/**
* 循环步骤请求从新排序
*/