fix(测试计划): 修改测试计划规划关联测试集参数调整
This commit is contained in:
parent
149b233f9c
commit
2820fdf6ec
|
@ -297,7 +297,7 @@
|
|||
children: 'children',
|
||||
}"
|
||||
class="w-[200px]"
|
||||
:data="apiSetTree"
|
||||
:data="nodeApiTestSet"
|
||||
allow-clear
|
||||
>
|
||||
<template #prefix>
|
||||
|
@ -319,7 +319,7 @@
|
|||
}"
|
||||
class="ml-[12px] w-[200px]"
|
||||
allow-clear
|
||||
:data="scenarioSetTree"
|
||||
:data="nodeScenarioTestSet"
|
||||
>
|
||||
<template #prefix>
|
||||
<div class="text-[var(--color-text-brand)]">{{ t('ms.case.associate.scenario') }}</div>
|
||||
|
@ -350,6 +350,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { type SelectOptionData } from '@arco-design/web-vue';
|
||||
import { isEqual } from 'lodash-es';
|
||||
|
||||
import { MsAdvanceFilter } from '@/components/pure/ms-advance-filter';
|
||||
|
@ -362,14 +363,13 @@
|
|||
import TotalCount from './totalCount.vue';
|
||||
|
||||
import { getAssociatedProjectOptions } from '@/api/modules/case-management/featureCase';
|
||||
import { getApiCaseModule, getApiScenarioModule } from '@/api/modules/test-plan/testPlan';
|
||||
import { useI18n } from '@/hooks/useI18n';
|
||||
import useVisit from '@/hooks/useVisit';
|
||||
import useAppStore from '@/store/modules/app';
|
||||
|
||||
import type { ModuleTreeNode, TableQueryParams } from '@/models/common';
|
||||
import type { ProjectListItem } from '@/models/setting/project';
|
||||
import type { AssociateCaseRequestParams, PlanDetailApiCaseTreeParams } from '@/models/testPlan/testPlan';
|
||||
import type { AssociateCaseRequestParams } from '@/models/testPlan/testPlan';
|
||||
import { CaseModulesApiTypeEnum, CasePageApiTypeEnum } from '@/enums/associateCaseEnum';
|
||||
import { CaseLinkEnum } from '@/enums/caseEnum';
|
||||
|
||||
|
@ -400,6 +400,8 @@
|
|||
hideProjectSelect?: boolean; // 是否隐藏项目选择
|
||||
associatedType: keyof typeof CaseLinkEnum; // 关联类型
|
||||
protocols?: string[]; // 上一次选择的协议
|
||||
nodeApiTestSet?: SelectOptionData[]; // 接口测试集
|
||||
nodeScenarioTestSet?: SelectOptionData[]; // 场景测试集
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
|
@ -635,35 +637,12 @@
|
|||
selectedProtocols.value = _protocols || [];
|
||||
}
|
||||
|
||||
const apiSetTree = ref<ModuleTreeNode[]>();
|
||||
const scenarioSetTree = ref<ModuleTreeNode[]>();
|
||||
|
||||
async function initTestSet() {
|
||||
if (props.extraTableParams?.testPlanId) {
|
||||
const params: PlanDetailApiCaseTreeParams = {
|
||||
testPlanId: props.extraTableParams.testPlanId,
|
||||
treeType: 'COLLECTION',
|
||||
};
|
||||
try {
|
||||
const [apiSetTreeResult, scenarioSetTreeResult] = await Promise.all([
|
||||
getApiCaseModule(params),
|
||||
getApiScenarioModule(params),
|
||||
]);
|
||||
|
||||
apiSetTree.value = apiSetTreeResult;
|
||||
scenarioSetTree.value = scenarioSetTreeResult;
|
||||
apiCaseCollectionId.value = apiSetTree.value[0].id;
|
||||
apiScenarioCollectionId.value = scenarioSetTree.value[0].id;
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function changeSyncCase(value: string | number | boolean, ev: Event) {
|
||||
if (value) {
|
||||
initTestSet();
|
||||
if (props.nodeApiTestSet && props.nodeScenarioTestSet) {
|
||||
apiCaseCollectionId.value = props.nodeApiTestSet?.[0]?.id ?? '';
|
||||
apiScenarioCollectionId.value = props.nodeScenarioTestSet?.[0]?.id ?? '';
|
||||
}
|
||||
} else {
|
||||
apiCaseCollectionId.value = '';
|
||||
apiScenarioCollectionId.value = '';
|
||||
|
|
|
@ -14,12 +14,16 @@
|
|||
}"
|
||||
:modules-maps="props.modulesMaps"
|
||||
:associated-type="associationType"
|
||||
:node-api-test-set="nodeApiTestSet"
|
||||
:node-scenario-test-set="nodeScenarioTestSet"
|
||||
@save="saveHandler"
|
||||
>
|
||||
</MsCaseAssociate>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { type SelectOptionData } from '@arco-design/web-vue';
|
||||
|
||||
import MsCaseAssociate from '@/components/business/ms-associate-case/index.vue';
|
||||
import type { saveParams } from '@/components/business/ms-associate-case/types';
|
||||
|
||||
|
@ -33,6 +37,8 @@
|
|||
associationType: CaseLinkEnum;
|
||||
modulesMaps?: Record<string, saveParams>;
|
||||
testPlanId?: string;
|
||||
nodeApiTestSet?: SelectOptionData[];
|
||||
nodeScenarioTestSet?: SelectOptionData[];
|
||||
}>();
|
||||
const innerVisible = defineModel<boolean>('visible', {
|
||||
required: true,
|
||||
|
|
|
@ -227,6 +227,8 @@
|
|||
:test-plan-id="props.planId"
|
||||
:modules-maps="selectedAssociateCasesParams.moduleMaps"
|
||||
:protocols="selectedAssociateCasesParams.protocols"
|
||||
:node-api-test-set="nodeApiTestSet"
|
||||
:node-scenario-test-set="nodeScenarioTestSet"
|
||||
@success="writeAssociateCases"
|
||||
/>
|
||||
</template>
|
||||
|
@ -369,6 +371,29 @@
|
|||
}
|
||||
}
|
||||
|
||||
const nodeApiTestSet = ref<SelectOptionData[]>([]);
|
||||
const nodeScenarioTestSet = ref<SelectOptionData[]>([]);
|
||||
|
||||
function getTestNodeSet(nodeSet: PlanMinderNode[] = []): { name: string; id: string }[] {
|
||||
return nodeSet.map((node) => ({
|
||||
name: node.data?.text ?? '',
|
||||
id: node.data?.id ?? '',
|
||||
}));
|
||||
}
|
||||
|
||||
function setCaseSelectedSet() {
|
||||
const minderJson = window.minder.exportJson()?.root;
|
||||
if (minderJson) {
|
||||
const testApiNode =
|
||||
minderJson?.children?.find((item: PlanMinderNode) => item.data.type === 'API')?.children ?? [];
|
||||
const testScenarioNode =
|
||||
minderJson?.children?.find((item: PlanMinderNode) => item.data.type === 'SCENARIO')?.children ?? [];
|
||||
|
||||
nodeApiTestSet.value = getTestNodeSet(testApiNode);
|
||||
nodeScenarioTestSet.value = getTestNodeSet(testScenarioNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 插入节点
|
||||
* @param node 目标节点
|
||||
|
@ -581,7 +606,7 @@
|
|||
selectedAssociateCasesParams.value = { ...param };
|
||||
const node: PlanMinderNode = window.minder.getSelectedNode();
|
||||
let associateType: string = '';
|
||||
if (node.data.type === PlanMinderCollectionType.SCENARIO) {
|
||||
if (node && node.data?.type === PlanMinderCollectionType.SCENARIO) {
|
||||
associateType = PlanMinderAssociateType.SCENARIO_CASE;
|
||||
} else {
|
||||
associateType = param?.associateType ?? node.data.type;
|
||||
|
@ -623,6 +648,7 @@
|
|||
configForm.value = cloneDeep(activePlanSet.value?.data);
|
||||
extraVisible.value = true;
|
||||
currentSelectCase.value = (activePlanSet.value?.data.type as unknown as CaseLinkEnum) || CaseLinkEnum.FUNCTIONAL;
|
||||
setCaseSelectedSet();
|
||||
caseAssociateVisible.value = true;
|
||||
nextTick(() => {
|
||||
switchingConfigFormData.value = false;
|
||||
|
@ -631,6 +657,7 @@
|
|||
|
||||
function openCaseAssociateDrawer() {
|
||||
currentSelectCase.value = (activePlanSet.value?.data?.type as unknown as CaseLinkEnum) || CaseLinkEnum.FUNCTIONAL;
|
||||
setCaseSelectedSet();
|
||||
caseAssociateVisible.value = true;
|
||||
}
|
||||
|
||||
|
@ -878,9 +905,9 @@
|
|||
if (node.data.isNew) {
|
||||
tempMinderParams.value.editList.push({
|
||||
...node.data,
|
||||
id: undefined,
|
||||
num: nodeIndex,
|
||||
executeMethod: getExecuteMethod(node.data),
|
||||
tempCollectionNode: true,
|
||||
});
|
||||
} else {
|
||||
tempMinderParams.value.editList.push({
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<MsIcon
|
||||
type="icon-icon_full_screen_one"
|
||||
class="input-suffix-icon ml-[8px]"
|
||||
@click.stop="emit('quickInput', 'conditionValue')"
|
||||
@click.stop="handleQuickInput"
|
||||
/>
|
||||
</template>
|
||||
</a-input>
|
||||
|
@ -245,6 +245,15 @@
|
|||
},
|
||||
];
|
||||
|
||||
function handleQuickInput() {
|
||||
emit(
|
||||
'quickInput',
|
||||
innerData.value.whileController.conditionType === WhileConditionType.CONDITION
|
||||
? 'msWhileVariableValue'
|
||||
: 'msWhileVariableScriptValue'
|
||||
);
|
||||
}
|
||||
|
||||
watchEffect(() => {
|
||||
innerData.value = props.data;
|
||||
});
|
||||
|
|
|
@ -91,7 +91,7 @@ export default {
|
|||
'testPlan.planForm.enableAutomaticStatusTip':
|
||||
'Enable: function case execution successful cases associated interface, function of the use case status automatically updated to success',
|
||||
'testPlan.planForm.closeAutomaticStatusTip':
|
||||
'Close: The result of execution of a functional use case is not affected by the interface',
|
||||
'Close: Function of use case execution result is not affected by the interface use case/scenario use case',
|
||||
'testPlan.planForm.passThresholdTip': 'If the pass rate reaches the specified pass threshold, the result is passed',
|
||||
'testPlan.planForm.pickCases': 'Select cases',
|
||||
'testPlan.testPlanDetail.executed': 'Executed',
|
||||
|
|
|
@ -85,8 +85,9 @@ export default {
|
|||
'testPlan.planForm.selectPlanGroup': '选择计划组',
|
||||
'testPlan.planForm.repeatCaseTip1': '开启:可重复关联同一个用例',
|
||||
'testPlan.planForm.repeatCaseTip2': '关闭:不可重复关联同一用例',
|
||||
'testPlan.planForm.enableAutomaticStatusTip': '开启:功能用例关联的接口用例执行成功,功能用例的状态自动更新为成功',
|
||||
'testPlan.planForm.closeAutomaticStatusTip': '关闭:功能用例的执行结果不受接口的影响',
|
||||
'testPlan.planForm.enableAutomaticStatusTip':
|
||||
'开启:Function cases the interface associated use case/scenario use case implementation success, function of the use case status automatically updated to success',
|
||||
'testPlan.planForm.closeAutomaticStatusTip': '关闭:功能用例的执行结果不受接口用例/场景用例的影响',
|
||||
'testPlan.planForm.passThresholdTip': '通过率达到设置的通过阈值时,报告结果为通过',
|
||||
'testPlan.planForm.pickCases': '选择用例',
|
||||
'testPlan.testPlanDetail.executed': '已执行',
|
||||
|
|
Loading…
Reference in New Issue