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 {
margin-right: 5px;
}
:deep(.el-tabs__nav-wrap) {
width: calc(100% - 50px);
}
</style>

View File

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

View File

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