From c645d4752c4f945b77a5044db09617d2f9d8d9c9 Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Mon, 8 Aug 2022 10:01:20 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9C=BA=E6=99=AF=E5=8F=98=E9=87=8F=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0csv=E6=9C=AA=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E4=B8=8D=E6=8F=90=E7=A4=BA=E7=9A=84=E7=BC=BA=E9=99=B7=20(#1665?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1015662 --user=王孝刚 【接口测试】github#16644,场景变量csv只添加变量名,未添加csv文件,场景内接口不执行,生成报告也无步骤数,场景数 https://www.tapd.cn/55049933/s/1218845 Co-authored-by: wxg0103 <727495428@qq.com> --- .../api/automation/scenario/variable/VariableList.vue | 10 +++++++++- frontend/src/i18n/en-US.js | 4 +++- frontend/src/i18n/zh-CN.js | 4 +++- frontend/src/i18n/zh-TW.js | 4 +++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue index 6918a61b50..cd62a99e2c 100644 --- a/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue +++ b/frontend/src/business/components/api/automation/scenario/variable/VariableList.vue @@ -359,6 +359,8 @@ export default { }); this.selectVariable = ""; this.searchType = ""; + this.selectType = "CONSTANT"; + this.editData = {}; if (jsondiffpatch.diff(JSON.parse(JSON.stringify(this.variables)), this.variablesOld) || jsondiffpatch.diff(JSON.parse(JSON.stringify(this.headers)), this.headersOld)) { this.$emit('setVariables', saveVariables, this.headers); } @@ -374,9 +376,15 @@ export default { }, confirmVariable() { if (this.editData && (this.editData.name == undefined || this.editData.name == '')) { - this.$warning("变量名不能为空"); + this.$warning(this.$t('api_test.automation.variable_warning')); return; } + if (this.editData.type === 'CSV' && this.$refs.csv) { + if (this.editData.files.length === 0) { + this.$warning(this.$t('api_test.automation.csv_warning')); + return; + } + } // 更新场景,修改左边数据 if (this.showDelete) { this.updateParameters(this.editData); diff --git a/frontend/src/i18n/en-US.js b/frontend/src/i18n/en-US.js index 275ca6837f..c709f0f936 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1468,7 +1468,9 @@ export default { generate_report: "Generate report", rerun: "fail and rerun", rerun_warning: "The connection is abnormal, please check the environment configuration", - rerun_success: "Rerun has already started, refresh the results later to view" + rerun_success: "Rerun has already started, refresh the results later to view", + csv_warning: "Please add csv file", + variable_warning: "Variable name cannot be empty" }, environment: { id: 'Environment ID', diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index eb582afaca..d18af1301c 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1476,7 +1476,9 @@ export default { generate_report: "生成报告", rerun: "失败重跑", rerun_warning: "连接异常,请检查环境配置", - rerun_success: "已经开始重跑,稍后刷新结果查看" + rerun_success: "已经开始重跑,稍后刷新结果查看", + csv_warning: "请添加 csv 文件", + variable_warning: "变量名不能为空" }, environment: { id: '环境ID', diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 5a7722b13e..54d28a687d 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1473,7 +1473,9 @@ export default { generate_report: "生成報告", rerun: "失敗重跑", rerun_warning: "連接異常,請檢查環境配置", - rerun_success: "已經開始重跑,稍後重繪結果查看" + rerun_success: "已經開始重跑,稍後重繪結果查看", + csv_warning: "請添加 csv 文件", + variable_warning: "變量名不能為空" }, environment: { id: '環境ID',