From 812697d61a073eb20671128fbdc813492378d920 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Wed, 30 Mar 2022 15:51:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ui=E6=8A=A5=E5=91=8A=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE=20(#12117)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: chenjianxing --- .../ApiScenarioReportStructureService.java | 24 +++++++++++++++++++ .../automation/report/SysnApiReportDetail.vue | 3 +++ frontend/src/business/components/xpack | 2 +- .../src/common/js/default-table-header.js | 17 +++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java index 131c3e18d7..4455f92a2d 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioReportStructureService.java @@ -507,6 +507,8 @@ public class ApiScenarioReportStructureService { example.createCriteria().andReportIdEqualTo(reportId); List reportResults = reportResultMapper.selectByExampleWithBLOBs(example); + removeUiResultIfNotStep(reportResults, reportId); + ApiScenarioReportStructureExample structureExample = new ApiScenarioReportStructureExample(); structureExample.createCriteria().andReportIdEqualTo(reportId); List reportStructureWithBLOBs = mapper.selectByExampleWithBLOBs(structureExample); @@ -553,6 +555,28 @@ public class ApiScenarioReportStructureService { return reportDTO; } + /** + * UI 测试结果统计去掉前后置或其他不算步骤的执行结果 + * @param reportResults + * @param reportId + */ + private void removeUiResultIfNotStep(List reportResults, String reportId) { + ApiScenarioReport report = scenarioReportMapper.selectByPrimaryKey(reportId); + if (report.getReportType() != null && report.getReportType().startsWith("UI")) { + Iterator iterator = reportResults.iterator(); + while (iterator.hasNext()) { + ApiScenarioReportResult item = iterator.next(); + String result = new String(item.getContent(), StandardCharsets.UTF_8); + if (StringUtils.isNotBlank(result)) { + Boolean isNoStep = JSONObject.parseObject(result).getBoolean("isNoStep"); + if (BooleanUtils.isTrue(isNoStep)) { + iterator.remove(); + } + } + } + } + } + private void countAllUnexecute(List stepList, AtomicLong allUnExecute) { for (StepTreeDTO step : stepList) { if (step.getValue() != null) { diff --git a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue index 1be9be3cfa..34a7b6c374 100644 --- a/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue +++ b/frontend/src/business/components/api/automation/report/SysnApiReportDetail.vue @@ -310,6 +310,9 @@ export default { this.recursiveSorting(this.fullTreeNodes); this.reload(); } + if ("Running" !== this.report.status) { + this.$emit('finish'); + } }); }, runningNodeChild(arr, resourceId) { diff --git a/frontend/src/business/components/xpack b/frontend/src/business/components/xpack index 69707e80dc..dc96e7cba5 160000 --- a/frontend/src/business/components/xpack +++ b/frontend/src/business/components/xpack @@ -1 +1 @@ -Subproject commit 69707e80dc499a74a74165896649c2d4a2de8b4e +Subproject commit dc96e7cba5560b3d9d67b6c9a9bcb3f53cc50bb8 diff --git a/frontend/src/common/js/default-table-header.js b/frontend/src/common/js/default-table-header.js index 55551e3fa7..0c96756104 100644 --- a/frontend/src/common/js/default-table-header.js +++ b/frontend/src/common/js/default-table-header.js @@ -82,6 +82,23 @@ export let CUSTOM_TABLE_HEADER = { {id: 'passRate', key: 'b', label: 'api_test.automation.passing_rate'}, {id: 'createTime', key: 'c', label: 'commons.create_time'}, ], + //场景测试 + UI_SCENARIO: [ + {id: 'num', key: '1', label: "ID"}, + {id: 'name', key: '2', label: 'api_report.scenario_name'}, + {id: 'level', key: '3', label: 'api_test.automation.case_level'}, + {id: 'status', key: '4', label: 'test_track.plan.plan_status'}, + {id: 'tags', key: '5', label: 'commons.tag'}, + {id: 'versionId', key: 'f', label: 'project.version.name', xpack: true}, + {id: 'creatorName', key: 'd', label: 'api_test.automation.creator'}, + {id: 'principalName', key: '6', label: 'api_test.definition.api_principal'}, + {id: 'environmentMap', key: 'e', label: 'commons.environment'}, + {id: 'updateTime', key: '7', label: 'api_test.definition.api_last_time'}, + {id: 'stepTotal', key: '8', label: 'api_test.automation.step'}, + {id: 'lastResult', key: 'a', label: 'api_test.automation.last_result'}, + {id: 'passRate', key: 'b', label: 'api_test.automation.passing_rate'}, + {id: 'createTime', key: 'c', label: 'commons.create_time'}, + ], //用例评审 TEST_CASE_REVIEW: [ {id: 'name', key: '1', label: 'test_track.review.review_name'},