fix(测试跟踪): 版本对比没有步骤描述的差异

--bug=1025935 --user=陈建星 【测试跟踪】github#24059,测试跟踪>>功能测试用例>>版本对比:一个用例的两个版本,并且不同版本的操作步骤有差异,但是在对比中,看不到这块的差异 https://www.tapd.cn/55049933/s/1368276
This commit is contained in:
chenjianxing 2023-05-04 13:49:38 +08:00 committed by jianxing
parent c584953122
commit 29ae358db0
2 changed files with 104 additions and 37 deletions

View File

@ -69,48 +69,82 @@
</div>
</div>
<!-- step description -->
<!-- 步骤类型 -->
<div class="step-desc-row">
<!-- 类型切换 -->
<div class="step-desc-name case-title-wrap case-content-wrap">
<div class="name title-wrap">
{{
contentDiffData.stepModel === "TEXT"
? $t("test_track.case.text_describe")
: $t("test_track.case.step_describe")
}}
</div>
<div class="update-type-row title-wrap"></div>
<div class="name title-wrap">{{ $t("ui.step_type") }}</div>
</div>
<!-- 文本描述 -->
<div class="content-wrap">
<div class="opt-row">
<case-diff-text
:diffInfo="contentDiffData.stepDescription"
:diffInfo="contentDiffData.stepModel"
></case-diff-text>
</div>
</div>
</div>
<!-- expect -->
<div
class="expect-row"
v-if="contentDiffData.stepModel === 'TEXT'"
>
<div class="expect-name case-title-wrap case-content-wrap">
<div class="name title-wrap">
{{ $t("test_track.case.expected_results") }}
</div>
<div class="step-desc-row" v-if="!isSameStepType">
<!-- 文本描述和步骤描述的对比 -->
<div class="step-desc-name case-title-wrap case-content-wrap">
<div class="name title-wrap">{{ $t("test_track.case.step_info") }}</div>
</div>
<div class="content-wrap">
<div class="opt-row">
<case-diff-text
:diffInfo="contentDiffData.expectedResult"
:diffInfo="contentDiffData.diffStep"
></case-diff-text>
</div>
</div>
</div>
<div v-else>
<div class="step-desc-row" v-if="isStep">
<!-- 步骤描述 -->
<div class="step-desc-name case-title-wrap case-content-wrap">
<div class="name title-wrap">{{ $t("test_track.case.step_describe") }}</div>
</div>
<div class="content-wrap">
<div class="opt-row">
<case-diff-text
:diffInfo="contentDiffData.steps"
></case-diff-text>
</div>
</div>
</div>
<div class="step-desc-row" v-if="!isStep">
<!-- 文本描述 -->
<div class="step-desc-name case-title-wrap case-content-wrap">
<div class="name title-wrap">{{ $t("test_track.case.text_describe") }}</div>
</div>
<div class="content-wrap">
<div class="opt-row">
<case-diff-text
:diffInfo="contentDiffData.stepDescription"
></case-diff-text>
</div>
</div>
</div>
<!-- expect -->
<div
class="expect-row"
v-if="!isStep">
<div class="expect-name case-title-wrap case-content-wrap">
<div class="name title-wrap">
{{ $t("test_track.case.expected_results") }}
</div>
</div>
<div class="content-wrap">
<div class="opt-row">
<case-diff-text
:diffInfo="contentDiffData.expectedResult"
></case-diff-text>
</div>
</div>
</div>
</div>
<!-- remark -->
<div class="remark-row">
<div class="remark-name case-title-wrap case-content-wrap">
@ -388,6 +422,12 @@ export default {
}
return this.nextBtn;
},
isStep() {
return this.isSameStepType && this.contentDiffData.targetStepModel === 'STEP';
},
isSameStepType() {
return this.contentDiffData.originStepModel === this.contentDiffData.targetStepModel;
}
},
methods: {
/**

View File

@ -1,3 +1,4 @@
import i18n from "@/i18n";
/**
* 存储版本信息的数据结构
*/
@ -133,15 +134,8 @@ export default class DefaultDiffExecutor extends AbstractVersionDiffExecutor {
},
];
// // 自定义信息处理
// this.customDiffData = DiffUtil.diffCustomData(
// this.origin.customFieldForm,
// this.target.customFieldForm
// );
// 详细信息对比
//名称对比
this.contentDiffData.stepModel = "TEXT";
this.contentDiffData.caseName = [
{
diffArr: DiffUtil.diffText(this.origin.name, this.target.name),
@ -156,7 +150,45 @@ export default class DefaultDiffExecutor extends AbstractVersionDiffExecutor {
),
},
];
//文本描述
let originStepModel = this.origin.stepModel === 'STEP' ? i18n.t('test_track.case.step_describe') : i18n.t('test_track.case.text_describe');
let targetStepModel = this.target.stepModel === 'STEP' ? i18n.t('test_track.case.step_describe') : i18n.t('test_track.case.text_describe');
this.contentDiffData.originStepModel = this.origin.stepModel;
this.contentDiffData.targetStepModel = this.target.stepModel;
this.contentDiffData.stepModel = [
{
diffArr: DiffUtil.diffText(originStepModel, targetStepModel),
},
];
// 步骤描述不一致
if (this.origin.stepModel !== this.target.stepModel) {
if (this.origin.stepModel === 'STEP') {
this.contentDiffData.diffStep = [
{
diffArr: DiffUtil.diffText(this.origin.steps, this.target.stepDescription + '\n' + this.target.expectedResult),
},
];
} else {
this.contentDiffData.diffStep = [
{
diffArr: DiffUtil.diffText(this.origin.stepDescription + '\n' + this.origin.expectedResult, this.target.steps),
},
];
}
}
// 步骤描述
this.contentDiffData.steps = [
{
diffArr: DiffUtil.diffText(
this.origin.steps,
this.target.steps
),
},
];
// 文本描述
this.contentDiffData.stepDescription = [
{
diffArr: DiffUtil.diffText(
@ -165,7 +197,7 @@ export default class DefaultDiffExecutor extends AbstractVersionDiffExecutor {
),
},
];
//预期结果
// 预期结果
this.contentDiffData.expectedResult = [
{
diffArr: DiffUtil.diffText(
@ -174,6 +206,7 @@ export default class DefaultDiffExecutor extends AbstractVersionDiffExecutor {
),
},
];
//备注
this.contentDiffData.remark = [
{
@ -183,12 +216,6 @@ export default class DefaultDiffExecutor extends AbstractVersionDiffExecutor {
),
},
];
// {"name":"open——2614e2dd-bcf9-4bb1-88ec-9737940ad7fc——1673837163926——screenshot.png","size":"0 B","updateTime":1675700468279,"progress":100,"status":"error","creator":"Administrator","type":"PNG","isLocal":true}
// this.attachmentDiffData.attachment = DiffUtil.diffAttachment(
// this.origin,
// this.target
// );
}
diffAttachment(origin, target) {