fix(接口测试): 修复执行复制的场景,新增的接口拿不到场景变量的缺陷

--bug=1031752 --user=王孝刚
【接口测试】github#27044,接口自动化,复制的场景新增接口后,执行这个场景,新增接口无法拿到场景变量中的值
https://www.tapd.cn/55049933/s/1426644
This commit is contained in:
wxg0103 2023-10-16 16:36:41 +08:00 committed by Craftsman
parent 6abf461f4f
commit 98a8ec1a29
3 changed files with 14 additions and 13 deletions

View File

@ -517,4 +517,8 @@ fieldset {
.is-text { .is-text {
margin-right: 5px; margin-right: 5px;
} }
:deep(.el-tabs__nav-wrap) {
width: calc(100% - 50px);
}
</style> </style>

View File

@ -742,8 +742,4 @@ export default {
font-size: 15px; font-size: 15px;
color: #de9d1c; color: #de9d1c;
} }
:deep(.el-tabs__nav-wrap) {
width: calc(100% - 50px);
}
</style> </style>

View File

@ -213,19 +213,20 @@ export default {
// //
if (runScenario && runScenario.variableEnable && runScenario.variables) { if (runScenario && runScenario.variableEnable && runScenario.variables) {
if (variables) { if (variables) {
// runScenario.variables = [...runScenario.variables, ...variables].reduce((acc, cur) => {
runScenario.variables.forEach((data) => { const index = acc.findIndex(item => item.name === cur.name && item.type === cur.type);
variables.forEach((item) => { if (index !== -1) {
if (data.type === item.type && data.name === item.name) { acc[index] = cur;
Object.assign(data, item); } else {
} acc.push(cur);
}); }
}); return acc;
}, []);
} }
} else { } else {
runScenario.variables = variables; runScenario.variables = variables;
} }
runScenario.id = this.currentScenario.id;
runScenario.hashTree = [this.scenario]; runScenario.hashTree = [this.scenario];
runScenario.stepScenario = true; runScenario.stepScenario = true;
this.$emit('runScenario', runScenario); this.$emit('runScenario', runScenario);