From 6b6cea1db48d8b642bd4b4f10f748f2f6ccf3f6d Mon Sep 17 00:00:00 2001 From: MeterSphere Bot <78466014+metersphere-bot@users.noreply.github.com> Date: Fri, 5 Aug 2022 10:36:46 +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(#1666?= =?UTF-8?q?3)?= 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 716dcb004c..a02a2dbf17 100644 --- a/frontend/src/i18n/en-US.js +++ b/frontend/src/i18n/en-US.js @@ -1442,6 +1442,8 @@ export default { generate_report: "Generate report", rerun: "fail and rerun", rerun_warning: "The connection is abnormal, please check the environment configuration", + csv_warning: "Please add csv file", + variable_warning: "Variable name cannot be empty" }, environment: { id: 'Environment ID', @@ -1485,7 +1487,7 @@ export default { base_url: "Base URL", base_url_description: "Base URL as URL prefix for all requests", scenario_step_is_empty: "Scenario: {0} has none step!", - base_scenario_step_is_empty:"Scenario step is empty!", + base_scenario_step_is_empty: "Scenario step is empty!", url_invalid: "Invalid URL", variables: "Variables", headers: "Headers", diff --git a/frontend/src/i18n/zh-CN.js b/frontend/src/i18n/zh-CN.js index 5a78779dc7..a3b86d499d 100644 --- a/frontend/src/i18n/zh-CN.js +++ b/frontend/src/i18n/zh-CN.js @@ -1447,6 +1447,8 @@ export default { generate_report: "生成报告", rerun: "失败重跑", rerun_warning: "连接异常,请检查环境配置", + csv_warning: "请添加 csv 文件", + variable_warning: "变量名不能为空" }, environment: { id: '环境ID', @@ -1490,7 +1492,7 @@ export default { base_url: "基础URL", base_url_description: "基础URL作为所有请求的URL前缀", scenario_step_is_empty: "场景: {0} 的步骤为空,无法导入", - base_scenario_step_is_empty:"原场景步骤为空", + base_scenario_step_is_empty: "原场景步骤为空", variables: "自定义变量", headers: "请求头", kv_description: "所有请求可以使用自定义变量", diff --git a/frontend/src/i18n/zh-TW.js b/frontend/src/i18n/zh-TW.js index 89eb0933f4..654f4b8d58 100644 --- a/frontend/src/i18n/zh-TW.js +++ b/frontend/src/i18n/zh-TW.js @@ -1447,6 +1447,8 @@ export default { generate_report: "生成報告", rerun: "失敗重跑", rerun_warning: "連接異常,請檢查環境配置", + csv_warning: "請添加 csv 文件", + variable_warning: "變量名不能為空" }, environment: { id: '環境ID', @@ -1490,7 +1492,7 @@ export default { base_url: "基礎URL", base_url_description: "基礎URL作為所有請求的URL前綴", scenario_step_is_empty: "場景: {0} 的步驟為空,無法導入", - base_scenario_step_is_empty:"原場景步驟為空", + base_scenario_step_is_empty: "原場景步驟為空", variables: "自定義變量", headers: "請求頭", kv_description: "所有請求可以使用自定義變量",