fix(接口测试): 修复返回结果为空的时候推荐jsonPath提示错误的缺陷

--bug=1033315 --user=王孝刚 【接口测试】github#27779,【接口自动化】接口自动化-复制其他场景进行调试,返回内容为空时,点击“推荐JSONPath断言”,页面会有“请先执行调试获取响应结果”提示 https://www.tapd.cn/55049933/s/1446209
This commit is contained in:
wxg0103 2023-12-20 15:50:10 +08:00 committed by 刘瑞斌
parent 681eaebca0
commit 4cddc43770
9 changed files with 34 additions and 6 deletions

View File

@ -207,10 +207,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
});
},

View File

@ -167,10 +167,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
});
},

View File

@ -188,10 +188,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
});
},

View File

@ -154,10 +154,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
});
},

View File

@ -197,10 +197,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
})
},

View File

@ -169,10 +169,14 @@ export default {
suggestJsonOpen() {
this.$emit('suggestClick');
this.$nextTick(() => {
if (!this.response || !this.response.responseResult || !this.response.responseResult.body) {
if (!this.response || !this.response.responseResult) {
this.$message(this.$t('api_test.request.assertions.debug_first'));
return;
}
if (!this.response.responseResult.body) {
this.$message(this.$t('api_test.request.assertions.body_is_null'));
return;
}
this.$refs.jsonpathSuggest.open(this.response.responseResult.body);
});
},

View File

@ -1933,6 +1933,8 @@ const message = {
json_path_suggest: "JSONPath Assertion Suggest",
json_path_clear: "Clear JSONPath Assertion",
debug_first: "First, debug to get the response",
body_is_null:
"No response data detected, please run the interface and ensure response data is generated",
suggest_tip: "Click the note to add the JSONPath assertion",
regex_info:
'Special characters "$ () * +. [] \\ ^ {} |" need to be escaped as "\\ "+"special characters", such as "\\$"',

View File

@ -1861,6 +1861,7 @@ const message = {
json_path_suggest: "推荐JSONPath断言",
json_path_clear: "清空JSONPath断言",
debug_first: "请先执行调试获取响应结果",
body_is_null: "未检测到响应数据,请运行接口并确保产生了响应数据",
ignore_status: "忽略状态",
add: "添加",
script_name: "脚本名称",

View File

@ -1860,6 +1860,7 @@ const message = {
json_path_suggest: "推薦JSONPath斷言",
json_path_clear: "清空JSONPath斷言",
debug_first: "請先執行調試獲取響應結果",
body_is_null: "未檢測到響應數據,請運行介面並確保產生了響應數據",
ignore_status: "忽略狀態",
add: "添加",
script_name: "腳本名稱",