refactor(接口测试): 优化文件变更后提示消息

Signed-off-by: fit2-zhao <yong.zhao@fit2cloud.com>
This commit is contained in:
fit2-zhao 2023-03-14 11:43:09 +08:00 committed by fit2-zhao
parent 6c15adab2c
commit 68a3092e62
1 changed files with 7 additions and 6 deletions

View File

@ -82,15 +82,15 @@ async function checkFile(scenarioFiles) {
.slice(0, 1) .slice(0, 1)
.arrayBuffer() .arrayBuffer()
.then(() => { .then(() => {
resolve(false); resolve();
}) })
.catch(() => { .catch(() => {
resolve(true); resolve(item.name);
}); });
return func; return func;
}); });
if (!scenarioFiles || scenarioFiles.length == 0) { if (!scenarioFiles || scenarioFiles.length == 0) {
resolve(false); resolve();
} }
}); });
} }
@ -106,9 +106,10 @@ export async function saveScenario(url, scenario, scenarioDefinition, _this, suc
} }
let scenarioFiles = getScenarioFiles(scenario); let scenarioFiles = getScenarioFiles(scenario);
let isUpdated = await checkFile(scenarioFiles); let fileName = await checkFile(scenarioFiles);
if (isUpdated) { fileName = fileName || (await checkFile(bodyFiles));
_this.$error(_this.$t('automation.document_validity_msg')); if (fileName) {
_this.$error('[ ' + fileName + ' ]' + _this.$t('automation.document_validity_msg'));
_this.isPreventReClick = false; _this.isPreventReClick = false;
_this.errorRefresh(); _this.errorRefresh();
return; return;