fix(接口测试): 修复前后置脚本序号发生变化问题

【【接口测试】github#34598,接口场景中步骤的前置后置操作序号发生变更】
https://www.tapd.cn/55049933/bugtrace/bugs/view/1155049933001050316
This commit is contained in:
fit2-zhao 2024-12-12 18:05:17 +08:00 committed by Craftsman
parent 0638aa5d38
commit 3ef3cf258c
1 changed files with 32 additions and 13 deletions

View File

@ -1594,18 +1594,31 @@ export default {
stepArray = stepArray || this.scenarioDefinition; stepArray = stepArray || this.scenarioDefinition;
this.recursionStep(stepArray); this.recursionStep(stepArray);
}, },
recursionStep(stepArray, scenarioProjectId, fullPath, isGeneric) { recursionStep(stepArray, scenarioProjectId, fullPath, isGeneric) {
for (let i in stepArray) { for (let i = 0; i < stepArray.length; i++) {
let step = stepArray[i]; let step = stepArray[i];
step.index = !isGeneric ? Number(i) + 1 : step.index;
if (step.type === 'GenericController') { // index projectId
this.pluginOrder(step); if (!isGeneric && !this.stepFilter.get('ALlSamplerStep').includes(step.type)) {
step.index = Number(i) + 1;
} }
step.resourceId = step.resourceId || getUUID(); step.projectId = step.projectId || scenarioProjectId || this.projectId;
//
// clazzName
step.clazzName = step.clazzName || TYPE_TO_C.get(step.type);
//
if (step.authManager && !step.authManager.clazzName) {
step.authManager.clazzName = TYPE_TO_C.get(step.authManager.type);
}
//
if (step.type === 'HTTPSamplerProxy' && !step.headers) { if (step.type === 'HTTPSamplerProxy' && !step.headers) {
step.headers = [new KeyValue()]; step.headers = [new KeyValue()];
} }
// LoopController
if ( if (
step.type === ELEMENT_TYPE.LoopController && step.type === ELEMENT_TYPE.LoopController &&
step.loopType === 'LOOP_COUNT' && step.loopType === 'LOOP_COUNT' &&
@ -1614,19 +1627,25 @@ export default {
) { ) {
step.countController.proceed = true; step.countController.proceed = true;
} }
step.clazzName = step.clazzName || TYPE_TO_C.get(step.type);
if (step && step.authManager && !step.authManager.clazzName) { // ID
step.authManager.clazzName = TYPE_TO_C.get(step.authManager.type); step.resourceId = step.resourceId || getUUID();
// parentIndex
step.parentIndex = fullPath ? `${fullPath}_${step.index}` : step.index;
// GenericController
if (step.type === 'GenericController') {
this.pluginOrder(step);
} }
// IDIDIDID
step.projectId = step.projectId || scenarioProjectId || this.projectId; //
// debug
step.parentIndex = fullPath ? fullPath + '_' + step.index : step.index;
if (step.hashTree && step.hashTree.length > 0) { if (step.hashTree && step.hashTree.length > 0) {
this.recursionStep(step.hashTree, step.projectId, step.parentIndex, step.type === 'GenericController'); this.recursionStep(step.hashTree, step.projectId, step.parentIndex, step.type === 'GenericController');
} }
} }
}, },
addCustomizeApi(request) { addCustomizeApi(request) {
this.customizeVisible = false; this.customizeVisible = false;
request.enable === undefined ? (request.enable = true) : request.enable; request.enable === undefined ? (request.enable = true) : request.enable;