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);
|
addIssueHotBox(this);
|
||||||
},
|
},
|
||||||
|
|
|
@ -93,8 +93,11 @@ name: "TestReviewMinder",
|
||||||
this.setIsChange(true);
|
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() {
|
getParam() {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -51,6 +51,7 @@ export function getSelectedNodes() {
|
||||||
* @param result
|
* @param result
|
||||||
*/
|
*/
|
||||||
export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNodeFuc) {
|
export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNodeFuc) {
|
||||||
|
return new Promise((resolve) => {
|
||||||
let data = node.data;
|
let data = node.data;
|
||||||
if (!data.loaded && data.type === 'node') {
|
if (!data.loaded && data.type === 'node') {
|
||||||
if (param.result) {
|
if (param.result) {
|
||||||
|
@ -62,18 +63,23 @@ export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNode
|
||||||
request.nodeId = '';
|
request.nodeId = '';
|
||||||
}
|
}
|
||||||
if (getCaseFuc) {
|
if (getCaseFuc) {
|
||||||
|
// 加载用例
|
||||||
getCaseFuc(request, (testCases) => {
|
getCaseFuc(request, (testCases) => {
|
||||||
initNodeCase(node, testCases, param, setParamCallback);
|
initNodeCase(node, testCases, param, setParamCallback);
|
||||||
|
|
||||||
if (getExtraNodeFuc) {
|
if (getExtraNodeFuc) {
|
||||||
param.result.loading = true;
|
param.result.loading = true;
|
||||||
|
// 加载临时节点
|
||||||
getExtraNodeFuc(getCurrentProjectID(), data.id, (nodes) => {
|
getExtraNodeFuc(getCurrentProjectID(), data.id, (nodes) => {
|
||||||
appendExtraNodes(node, nodes);
|
appendExtraNodes(node, nodes);
|
||||||
param.result.loading = false;
|
param.result.loading = false;
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
} else if (data.type === 'nextPage') {
|
} else if (data.type === 'nextPage') {
|
||||||
// 分页处理,如果某个模块下用例太多,则分步加载
|
// 分页处理,如果某个模块下用例太多,则分步加载
|
||||||
|
@ -88,10 +94,16 @@ export function loadNode(node, param, getCaseFuc, setParamCallback, getExtraNode
|
||||||
getCaseFuc(request, (testCases) => {
|
getCaseFuc(request, (testCases) => {
|
||||||
appendNodeCases(node.parent, testCases, param, setParamCallback);
|
appendNodeCases(node.parent, testCases, param, setParamCallback);
|
||||||
window.minder.removeNode(node);
|
window.minder.removeNode(node);
|
||||||
|
resolve();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
data.loaded = true;
|
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;
|
let children = node.children;
|
||||||
if (!children) {
|
if (!children) {
|
||||||
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;
|
let isCaseNode = item.data.resource && item.data.resource.indexOf(i18n.t('api_test.definition.request.case')) > -1;
|
||||||
if (item.data.type === 'node' || isCaseNode) {
|
if (item.data.type === 'node' || isCaseNode) {
|
||||||
let origin = item.data.resource;
|
let origin = item.data.resource;
|
||||||
if (!origin) {
|
if (!origin) {
|
||||||
origin = [];
|
origin = [];
|
||||||
}
|
}
|
||||||
let index = origin.indexOf(resourceName);
|
|
||||||
// 先删除排他的标签
|
// 先删除排他的标签
|
||||||
if (distinctTags.indexOf(resourceName) > -1) {
|
if (distinctTags.indexOf(resourceName) > -1) {
|
||||||
for (let i = 0; i < origin.length; i++) {
|
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);
|
origin.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (index !== -1) {
|
if (origin.indexOf(resourceName) < 0) {
|
||||||
origin.splice(index, 1);
|
|
||||||
} else {
|
|
||||||
origin.push(resourceName);
|
origin.push(resourceName);
|
||||||
}
|
}
|
||||||
item.data.resource = origin;
|
item.data.resource = origin;
|
||||||
if (isCaseNode) {
|
if (isCaseNode) {
|
||||||
item.data.changed = true;
|
item.data.changed = true;
|
||||||
}
|
}
|
||||||
tagChildren(item, resourceName, distinctTags);
|
await tagChildren(item, resourceName, distinctTags, loadNodeParam);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,20 +445,19 @@ function expandNode(node) {
|
||||||
* 测试计划和评审支持给模块批量打标签
|
* 测试计划和评审支持给模块批量打标签
|
||||||
* @param distinctTags
|
* @param distinctTags
|
||||||
*/
|
*/
|
||||||
export function tagBatch(distinctTags) {
|
export function tagBatch(distinctTags, loadNodeParam) {
|
||||||
listenBeforeExecCommand((even) => {
|
listenBeforeExecCommand((even) => {
|
||||||
let minder = window.minder;
|
let minder = window.minder;
|
||||||
let selectNodes = window.minder.getSelectedNodes();
|
let selectNodes = window.minder.getSelectedNodes();
|
||||||
let args = even.commandArgs;
|
let args = even.commandArgs;
|
||||||
if (selectNodes) {
|
if (selectNodes) {
|
||||||
selectNodes.forEach((node) => {
|
selectNodes.forEach(async (node) => {
|
||||||
if (node.data.type === 'node' && even.commandName === 'resource') {
|
if (node.data.type === 'node' && even.commandName === 'resource') {
|
||||||
// let origin = minder.queryCommandValue('resource');
|
|
||||||
if (args && args.length > 0) {
|
if (args && args.length > 0) {
|
||||||
let origin = args[0];
|
let origin = args[0];
|
||||||
if (origin && origin.length > 0) {
|
if (origin && origin.length > 0) {
|
||||||
let resourceName = origin[0];
|
let resourceName = origin[0];
|
||||||
tagChildren(node, resourceName, distinctTags);
|
await tagChildren(node, resourceName, distinctTags, loadNodeParam);
|
||||||
let modifyTopNode = modifyParentNodeTag(node, resourceName);
|
let modifyTopNode = modifyParentNodeTag(node, resourceName);
|
||||||
if (modifyTopNode) {
|
if (modifyTopNode) {
|
||||||
modifyTopNode.renderTree();
|
modifyTopNode.renderTree();
|
||||||
|
|
Loading…
Reference in New Issue