fix(测试跟踪): 脑图评审用例,用例未加载时批量评审失效
--bug=1015674 --user=陈建星 【测试跟踪】github #16680,用例评审-脑图批量评审- 用例状态未改变 https://www.tapd.cn/55049933/s/1220923
This commit is contained in:
parent
70058258e8
commit
352d1171ae
|
@ -140,7 +140,11 @@ name: "TestPlanMinder",
|
|||
}
|
||||
});
|
||||
|
||||
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]);
|
||||
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')], {
|
||||
param: this.getParam(),
|
||||
getCaseFuc: getPlanCasesForMinder,
|
||||
setParamCallback: this.setParamCallback
|
||||
});
|
||||
|
||||
addIssueHotBox(this);
|
||||
},
|
||||
|
|
|
@ -93,8 +93,11 @@ name: "TestReviewMinder",
|
|||
this.setIsChange(true);
|
||||
}
|
||||
});
|
||||
|
||||
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')]);
|
||||
tagBatch([...this.tags, this.$t('test_track.plan.plan_status_prepare')], {
|
||||
param: this.getParam(),
|
||||
getCaseFuc: getReviewCasesForMinder,
|
||||
setParamCallback: this.setParamCallback
|
||||
});
|
||||
},
|
||||
getParam() {
|
||||
return {
|
||||
|
|
|
@ -51,6 +51,7 @@ export function getSelectedNodes() {
|
|||
* @param result
|
||||
*/
|
||||
export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNodeFuc) {
|
||||
return new Promise((resolve) => {
|
||||
let data = node.data;
|
||||
if (!data.loaded && data.type === 'node') {
|
||||
if (param.result) {
|
||||
|
@ -62,18 +63,23 @@ export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNode
|
|||
request.nodeId = '';
|
||||
}
|
||||
if (getCaseFuc) {
|
||||
// 加载用例
|
||||
getCaseFuc(request, (testCases) => {
|
||||
initNodeCase(node, testCases, param, setParamCallback);
|
||||
|
||||
if (getExtraNodeFuc) {
|
||||
param.result.loading = true;
|
||||
// 加载临时节点
|
||||
getExtraNodeFuc(getCurrentProjectID(), data.id, (nodes) => {
|
||||
appendExtraNodes(node, nodes);
|
||||
param.result.loading = false;
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
} else if (data.type === 'nextPage') {
|
||||
// 分页处理,如果某个模块下用例太多,则分步加载
|
||||
|
@ -88,10 +94,16 @@ export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNode
|
|||
getCaseFuc(request, (testCases) => {
|
||||
appendNodeCases(node.parent, testCases, param, setParamCallback);
|
||||
window.minder.removeNode(node);
|
||||
resolve();
|
||||
});
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
} else {
|
||||
resolve();
|
||||
}
|
||||
data.loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,41 +179,50 @@ export function handTestCaeEdit(data) {
|
|||
});
|
||||
}
|
||||
|
||||
export function tagChildren(node, resourceName, distinctTags) {
|
||||
export async function tagChildren(node, resourceName, distinctTags, loadNodeParam) {
|
||||
|
||||
// 先加载当前模块下的用例再打标签
|
||||
if (isModuleNode(node)) {
|
||||
await loadNode(node, loadNodeParam.param,
|
||||
loadNodeParam.getCaseFuc, loadNodeParam.setParamCallback);
|
||||
}
|
||||
|
||||
let children = node.children;
|
||||
if (!children) {
|
||||
children = [];
|
||||
}
|
||||
if (!resourceName || !/\S/.test(resourceName)) {return;}
|
||||
children.forEach((item) => {
|
||||
|
||||
if (!resourceName || !/\S/.test(resourceName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const item of children) {
|
||||
let isCaseNode = item.data.resource && item.data.resource.indexOf(i18n.t('api_test.definition.request.case')) > -1;
|
||||
if (item.data.type === 'node' || isCaseNode) {
|
||||
let origin = item.data.resource;
|
||||
if (!origin) {
|
||||
origin = [];
|
||||
}
|
||||
let index = origin.indexOf(resourceName);
|
||||
// 先删除排他的标签
|
||||
if (distinctTags.indexOf(resourceName) > -1) {
|
||||
for (let i = 0; i < origin.length; i++) {
|
||||
if (distinctTags.indexOf(origin[i]) > -1) {
|
||||
if (distinctTags.indexOf(origin[i]) > -1 && origin[i] !== resourceName) {
|
||||
origin.splice(i, 1);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (index !== -1) {
|
||||
origin.splice(index, 1);
|
||||
} else {
|
||||
if (origin.indexOf(resourceName) < 0) {
|
||||
origin.push(resourceName);
|
||||
}
|
||||
item.data.resource = origin;
|
||||
if (isCaseNode) {
|
||||
item.data.changed = true;
|
||||
}
|
||||
tagChildren(item, resourceName, distinctTags);
|
||||
await tagChildren(item, resourceName, distinctTags, loadNodeParam);
|
||||
}
|
||||
});
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
@ -424,20 +445,19 @@ function expandNode(node) {
|
|||
* 测试计划和评审支持给模块批量打标签
|
||||
* @param distinctTags
|
||||
*/
|
||||
export function tagBatch(distinctTags) {
|
||||
export function tagBatch(distinctTags, loadNodeParam) {
|
||||
listenBeforeExecCommand((even) => {
|
||||
let minder = window.minder;
|
||||
let selectNodes = window.minder.getSelectedNodes();
|
||||
let args = even.commandArgs;
|
||||
if (selectNodes) {
|
||||
selectNodes.forEach((node) => {
|
||||
selectNodes.forEach(async (node) => {
|
||||
if (node.data.type === 'node' && even.commandName === 'resource') {
|
||||
// let origin = minder.queryCommandValue('resource');
|
||||
if (args && args.length > 0) {
|
||||
let origin = args[0];
|
||||
if (origin && origin.length > 0) {
|
||||
let resourceName = origin[0];
|
||||
tagChildren(node, resourceName, distinctTags);
|
||||
await tagChildren(node, resourceName, distinctTags, loadNodeParam);
|
||||
let modifyTopNode = modifyParentNodeTag(node, resourceName);
|
||||
if (modifyTopNode) {
|
||||
modifyTopNode.renderTree();
|
||||
|
|
Loading…
Reference in New Issue