fix(接口测试): 修复场景变量添加csv未上传文件不提示的缺陷 (#16659)

--bug=1015662 --user=王孝刚
【接口测试】github#16644,场景变量csv只添加变量名,未添加csv文件,场景内接口不执行,生成报告也无步骤数,场景数
https://www.tapd.cn/55049933/s/1218845

Co-authored-by: wxg0103 <727495428@qq.com>
This commit is contained in:
MeterSphere Bot 2022-08-08 10:01:20 +08:00 committed by GitHub
parent 47a682100b
commit c645d4752c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 4 deletions

View File

@ -359,6 +359,8 @@ export default {
}); });
this.selectVariable = ""; this.selectVariable = "";
this.searchType = ""; 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)) { 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); this.$emit('setVariables', saveVariables, this.headers);
} }
@ -374,9 +376,15 @@ export default {
}, },
confirmVariable() { confirmVariable() {
if (this.editData && (this.editData.name == undefined || this.editData.name == '')) { if (this.editData && (this.editData.name == undefined || this.editData.name == '')) {
this.$warning("变量名不能为空"); this.$warning(this.$t('api_test.automation.variable_warning'));
return; 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) { if (this.showDelete) {
this.updateParameters(this.editData); this.updateParameters(this.editData);

View File

@ -1468,7 +1468,9 @@ export default {
generate_report: "Generate report", generate_report: "Generate report",
rerun: "fail and rerun", rerun: "fail and rerun",
rerun_warning: "The connection is abnormal, please check the environment configuration", 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: { environment: {
id: 'Environment ID', id: 'Environment ID',

View File

@ -1476,7 +1476,9 @@ export default {
generate_report: "生成报告", generate_report: "生成报告",
rerun: "失败重跑", rerun: "失败重跑",
rerun_warning: "连接异常,请检查环境配置", rerun_warning: "连接异常,请检查环境配置",
rerun_success: "已经开始重跑,稍后刷新结果查看" rerun_success: "已经开始重跑,稍后刷新结果查看",
csv_warning: "请添加 csv 文件",
variable_warning: "变量名不能为空"
}, },
environment: { environment: {
id: '环境ID', id: '环境ID',

View File

@ -1473,7 +1473,9 @@ export default {
generate_report: "生成報告", generate_report: "生成報告",
rerun: "失敗重跑", rerun: "失敗重跑",
rerun_warning: "連接異常,請檢查環境配置", rerun_warning: "連接異常,請檢查環境配置",
rerun_success: "已經開始重跑,稍後重繪結果查看" rerun_success: "已經開始重跑,稍後重繪結果查看",
csv_warning: "請添加 csv 文件",
variable_warning: "變量名不能為空"
}, },
environment: { environment: {
id: '環境ID', id: '環境ID',