refactor: 【测试计划】-步骤描述格式优化;

This commit is contained in:
wenyann 2021-07-23 14:31:26 +08:00 committed by 刘瑞斌
parent 1182aa78bf
commit fadc226307
2 changed files with 114 additions and 82 deletions

View File

@ -308,6 +308,7 @@ public class TestCaseService {
testCaseTestMapper.deleteByExample(examples); testCaseTestMapper.deleteByExample(examples);
return testCaseMapper.deleteByPrimaryKey(testCaseId); return testCaseMapper.deleteByPrimaryKey(testCaseId);
} }
public int deleteTestCaseToGc(String testCaseId) { public int deleteTestCaseToGc(String testCaseId) {
TestCase testCase = new TestCase(); TestCase testCase = new TestCase();
testCase.setId(testCaseId); testCase.setId(testCaseId);
@ -805,6 +806,7 @@ public class TestCaseService {
} }
return list; return list;
} }
private List<TestCaseExcelData> generateExportTemplate() { private List<TestCaseExcelData> generateExportTemplate() {
List<TestCaseExcelData> list = new ArrayList<>(); List<TestCaseExcelData> list = new ArrayList<>();
StringBuilder path = new StringBuilder(""); StringBuilder path = new StringBuilder("");
@ -966,6 +968,7 @@ public class TestCaseService {
/** /**
* 更新自定义字段 * 更新自定义字段
*
* @param request * @param request
*/ */
public void editTestCaseBath(TestCaseBatchRequest request) { public void editTestCaseBath(TestCaseBatchRequest request) {
@ -1146,12 +1149,15 @@ public class TestCaseService {
MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId()); MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId());
} }
//插入测试与用例关系表 //插入测试与用例关系表
if (!CollectionUtils.isEmpty(request.getSelected())) {
TestCaseTestExample example = new TestCaseTestExample(); TestCaseTestExample example = new TestCaseTestExample();
example.createCriteria().andTestCaseIdEqualTo(request.getId()); example.createCriteria().andTestCaseIdEqualTo(request.getId());
List<TestCaseTest> list = testCaseTestMapper.selectByExample(example);
if (list.size() > 0) {
testCaseTestMapper.deleteByExample(example); testCaseTestMapper.deleteByExample(example);
}
List<List<String>> selecteds = request.getSelected(); List<List<String>> selecteds = request.getSelected();
TestCaseTest test = new TestCaseTest(); TestCaseTest test = new TestCaseTest();
LogUtil.info("关联的测试用例:" + selecteds);
selecteds.forEach(id -> { selecteds.forEach(id -> {
test.setTestType(id.get(0)); test.setTestType(id.get(0));
test.setTestId(id.get(id.size() - 1)); test.setTestId(id.get(id.size() - 1));
@ -1160,7 +1166,7 @@ public class TestCaseService {
test.setTestCaseId(request.getId()); test.setTestCaseId(request.getId());
testCaseTestMapper.insert(test); testCaseTestMapper.insert(test);
}); });
}
// 新选择了一个文件删除原来的文件 // 新选择了一个文件删除原来的文件
List<FileMetadata> updatedFiles = request.getUpdatedFileList(); List<FileMetadata> updatedFiles = request.getUpdatedFileList();
List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(request.getId()); List<FileMetadata> originFiles = fileService.getFileMetadataByCaseId(request.getId());
@ -1276,7 +1282,8 @@ public class TestCaseService {
TestCaseWithBLOBs dbCase = finalTestCaseMap.get(item.getId()); TestCaseWithBLOBs dbCase = finalTestCaseMap.get(item.getId());
if (editCustomFieldsPriority(dbCase, item.getPriority())) { if (editCustomFieldsPriority(dbCase, item.getPriority())) {
item.setCustomFields(dbCase.getCustomFields()); item.setCustomFields(dbCase.getCustomFields());
}; }
;
editTestCase(item); editTestCase(item);
} }
}); });
@ -1290,6 +1297,7 @@ public class TestCaseService {
/** /**
* 脑图编辑之后修改用例等级同时修改自定义字段的用例等级 * 脑图编辑之后修改用例等级同时修改自定义字段的用例等级
*
* @param dbCase * @param dbCase
* @param priority * @param priority
* @return * @return
@ -1623,6 +1631,7 @@ public class TestCaseService {
} }
} }
} }
public String getCaseLogDetails(TestCaseMinderEditRequest request) { public String getCaseLogDetails(TestCaseMinderEditRequest request) {
if (CollectionUtils.isNotEmpty(request.getData())) { if (CollectionUtils.isNotEmpty(request.getData())) {
List<String> ids = request.getData().stream().map(TestCase::getId).collect(Collectors.toList()); List<String> ids = request.getData().stream().map(TestCase::getId).collect(Collectors.toList());

View File

@ -72,21 +72,34 @@
class="case-form"> class="case-form">
<el-row> <el-row>
<el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index"> <el-col :span="7" v-for="(item, index) in testCaseTemplate.customFields" :key="index">
<el-form-item :label-width="formLabelWidth" :label="item.system ? $t(systemNameMap[item.name]) : item.name" :prop="item.name"> <el-form-item :label-width="formLabelWidth"
:label="item.system ? $t(systemNameMap[item.name]) : item.name"
:prop="item.name">
<custom-filed-component :disabled="true" :data="item" :form="{}" prop="defaultValue"/> <custom-filed-component :disabled="true" :data="item" :form="{}" prop="defaultValue"/>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form>
<form-rich-text-item :label-width="formLabelWidth" :disabled="true" :title="$t('test_track.case.prerequisite')" :data="testCase" prop="prerequisite"/> <form-rich-text-item :label-width="formLabelWidth" :disabled="true"
:title="$t('test_track.case.prerequisite')" :data="testCase"
prop="prerequisite"/>
<step-change-item :disable="true" :label-width="formLabelWidth" :form="testCase"/> <step-change-item :disable="true" :label-width="formLabelWidth" :form="testCase"/>
<test-plan-case-step-results-item :label-width="formLabelWidth" :is-read-only="isReadOnly" v-if="testCase.stepModel === 'STEP'" :test-case="testCase"/> <test-plan-case-step-results-item :label-width="formLabelWidth" :is-read-only="isReadOnly"
<form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'" :disabled="true" :title="$t('test_track.case.step_desc')" :data="testCase" prop="stepDescription"/> v-if="testCase.stepModel === 'STEP'" :test-case="testCase"/>
<form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'" :disabled="true" :title="$t('test_track.case.expected_results')" :data="testCase" prop="expectedResult"/> <form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'"
<form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'" :title="$t('test_track.plan_view.actual_result')" :data="testCase" prop="actualResult"/> :disabled="true" :title="$t('test_track.case.step_desc')" :data="testCase"
prop="stepDescription"/>
<form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'"
:disabled="true" :title="$t('test_track.case.expected_results')"
:data="testCase" prop="expectedResult"/>
<form-rich-text-item :label-width="formLabelWidth" v-if="testCase.stepModel === 'TEXT'"
:disabled="true" :title="$t('test_track.plan_view.actual_result')"
:data="testCase" prop="actualResult"/>
<test-case-edit-other-info :plan-id="testCase.planId" v-if="otherInfoActive" @openTest="openTest" :read-only="true" :is-test-plan="true" :project-id="testCase.projectId" :form="testCase" :case-id="testCase.caseId" ref="otherInfo"/> <test-case-edit-other-info :plan-id="testCase.planId" v-if="otherInfoActive" @openTest="openTest"
:read-only="true" :is-test-plan="true" :project-id="testCase.projectId"
:form="testCase" :case-id="testCase.caseId" ref="otherInfo"/>
</el-form> </el-form>
</div> </div>
@ -532,6 +545,16 @@ p {
.head-bar { .head-bar {
z-index: 999; z-index: 999;
} }
/deep/ .el-textarea.is-disabled .el-textarea__inner {
background-color: #FBFBFB !important;
color: #606266 !important;
height: 48px !important;
}
/deep/ .table-edit-input .el-textarea__inner, .table-edit-input .el-input__inner {
border-style: solid;
}
</style> </style>
<style> <style>