test(工作台): 补充工作台的测试用例
Some checks failed
MeterSphere 覆盖率统计 / 覆盖率统计 (push) Has been cancelled
MeterSphere 前端代码校验 / 前端代码校验 (push) Has been cancelled
SonarCloud / Build and analyze (push) Has been cancelled
Mirror GitHub Auto Queried Repos to Gitee / Sync-GitHub-to-Gitee (push) Has been cancelled
Check untimely handle issues / check-untimely-handle-issues (push) Has been cancelled

This commit is contained in:
song-cc-rock 2024-11-14 17:46:05 +08:00 committed by Craftsman
parent 315b9bc083
commit 7ccb733c4f
4 changed files with 23 additions and 5 deletions

View File

@ -1219,12 +1219,11 @@ public class DashboardService {
List<Bug> allSimpleList = extBugMapper.getSimpleList(projectId, null, null, handleUser, createUser, platforms);
List<String> localLastStepStatus = bugCommonService.getLocalLastStepStatus(projectId);
List<String> platformLastStepStatus = new ArrayList<>();
//TODO: 第三方的单元测试没成功
/*try {
try {
platformLastStepStatus = bugCommonService.getPlatformLastStepStatus(projectId);
} catch (Exception e) {
throw new RuntimeException(e);
}*/
}
localLastStepStatus.addAll(platformLastStepStatus);
List<Bug> statusList = allSimpleList.stream().filter(t -> !localLastStepStatus.contains(t.getStatus())).toList();
int statusSize = CollectionUtils.isEmpty(statusList) ? 0 : statusList.size();

View File

@ -15,8 +15,11 @@ import io.metersphere.dashboard.service.DashboardService;
import io.metersphere.functional.dto.CaseReviewDTO;
import io.metersphere.plugin.platform.dto.SelectOption;
import io.metersphere.project.domain.Project;
import io.metersphere.project.domain.ProjectApplication;
import io.metersphere.project.domain.ProjectApplicationExample;
import io.metersphere.project.domain.ProjectExample;
import io.metersphere.project.dto.ProjectUserDTO;
import io.metersphere.project.mapper.ProjectApplicationMapper;
import io.metersphere.project.mapper.ProjectMapper;
import io.metersphere.project.request.ProjectMemberRequest;
import io.metersphere.project.service.ProjectMemberService;
@ -55,6 +58,8 @@ public class DashboardFrontPageControllerTests extends BaseTest {
private DashboardService dashboardService;
@Resource
private ProjectMapper projectMapper;
@Resource
private ProjectApplicationMapper projectApplicationMapper;
@Resource
private ProjectMemberService projectMemberService;
@ -288,7 +293,7 @@ public class DashboardFrontPageControllerTests extends BaseTest {
.withHeaders(
new Header("Content-Type", "application/json; charset=utf-8"),
new Header("Cache-Control", "public, max-age=86400"))
.withBody("{\"id\":\"123456\",\"name\":\"test\", \"issues\": [{\"key\": \"TES-1\",\"fields\": {\"summary\": \"Test\"}}], \"total\": 1}")
.withBody("{\"id\":\"123456\",\"name\":\"test\", \"issues\": [], \"total\": 1}")
);
DashboardFrontPageRequest dashboardFrontPageRequest = new DashboardFrontPageRequest();
@ -331,6 +336,7 @@ public class DashboardFrontPageControllerTests extends BaseTest {
ResultHolder reviewResultHolder = JSON.parseObject(reviewContent, ResultHolder.class);
StatisticsDTO reviewCount = JSON.parseObject(JSON.toJSONString(reviewResultHolder.getData()), StatisticsDTO.class);
Assertions.assertNotNull(reviewCount);
enableDefaultPlatformConfig();
MvcResult bugMvcResult = this.requestPostWithOkAndReturn(BUG_COUNT, dashboardFrontPageRequest);
String bugContentAsString = bugMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8);
ResultHolder bugResultHolder = JSON.parseObject(bugContentAsString, ResultHolder.class);
@ -513,4 +519,12 @@ public class DashboardFrontPageControllerTests extends BaseTest {
List<SelectOption> list = JSON.parseArray(JSON.toJSONString(resultHolder.getData()), SelectOption.class);
Assertions.assertNotNull(list);
}
private void enableDefaultPlatformConfig() {
ProjectApplication record = new ProjectApplication();
record.setTypeValue("true");
ProjectApplicationExample example = new ProjectApplicationExample();
example.createCriteria().andProjectIdEqualTo(DEFAULT_PROJECT_ID).andTypeEqualTo("BUG_SYNC_SYNC_ENABLE");
projectApplicationMapper.updateByExampleSelective(record, example);
}
}

View File

@ -108,4 +108,9 @@ VALUES ('dashboard_scenario_four', 'api_scenario', 'p1', 'test-api-status', 'ER
INSERT INTO api_scenario_step(id, scenario_id, name, sort, enable, resource_id, resource_num, step_type, project_id, parent_id, version_id, ref_type, origin_project_id, config)
VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null)
VALUE ('dashboard_act_1', 'dashboard_sc_1', 'dd', 1, true, 'dashboard_api_definition_id_1', '1000', 'API', '100001100001', null, 'oasis_ac_version_id', 'REF', '100001100001', null);
INSERT INTO project_application (project_id, type, type_value) VALUES
('100001100001', 'BUG_SYNC_BUG_PLATFORM_CONFIG', '{"jiraKey":"TES","jiraBugTypeId":"10009"}'),
('100001100001', 'BUG_SYNC_PLATFORM_KEY', 'jira'),
('100001100001', 'BUG_SYNC_SYNC_ENABLE', 'false');