From 4cddc437708f10e021f4be094dd6fba4d7149760 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 20 Dec 2023 15:50:10 +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=E8=BF=94=E5=9B=9E=E7=BB=93=E6=9E=9C=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E6=97=B6=E5=80=99=E6=8E=A8=E8=8D=90jsonPath?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E9=94=99=E8=AF=AF=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1033315 --user=王孝刚 【接口测试】github#27779,【接口自动化】接口自动化-复制其他场景进行调试,返回内容为空时,点击“推荐JSONPath断言”,页面会有“请先执行调试获取响应结果”提示 https://www.tapd.cn/55049933/s/1446209 --- .../definition/components/assertion/ApiAssertions.vue | 6 +++++- .../definition/components/assertion/GlobalAssertions.vue | 6 +++++- .../definition/components/assertion/ScenarioAssertions.vue | 6 +++++- .../business/definition/components/extract/ApiExtract.vue | 6 +++++- .../src/components/environment/assertion/ApiAssertions.vue | 6 +++++- .../components/environment/assertion/GlobalAssertions.vue | 6 +++++- framework/sdk-parent/frontend/src/i18n/lang/en-US.js | 2 ++ framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js | 1 + framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js | 1 + 9 files changed, 34 insertions(+), 6 deletions(-) diff --git a/api-test/frontend/src/business/definition/components/assertion/ApiAssertions.vue b/api-test/frontend/src/business/definition/components/assertion/ApiAssertions.vue index 0ca0d17a7b..45bfd70bef 100644 --- a/api-test/frontend/src/business/definition/components/assertion/ApiAssertions.vue +++ b/api-test/frontend/src/business/definition/components/assertion/ApiAssertions.vue @@ -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); }); }, diff --git a/api-test/frontend/src/business/definition/components/assertion/GlobalAssertions.vue b/api-test/frontend/src/business/definition/components/assertion/GlobalAssertions.vue index 881fd06573..b900efd354 100644 --- a/api-test/frontend/src/business/definition/components/assertion/GlobalAssertions.vue +++ b/api-test/frontend/src/business/definition/components/assertion/GlobalAssertions.vue @@ -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); }); }, diff --git a/api-test/frontend/src/business/definition/components/assertion/ScenarioAssertions.vue b/api-test/frontend/src/business/definition/components/assertion/ScenarioAssertions.vue index f1e5d2ee92..7a3cf0d6a7 100644 --- a/api-test/frontend/src/business/definition/components/assertion/ScenarioAssertions.vue +++ b/api-test/frontend/src/business/definition/components/assertion/ScenarioAssertions.vue @@ -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); }); }, diff --git a/api-test/frontend/src/business/definition/components/extract/ApiExtract.vue b/api-test/frontend/src/business/definition/components/extract/ApiExtract.vue index 59fcfbde04..4cbf403a6e 100644 --- a/api-test/frontend/src/business/definition/components/extract/ApiExtract.vue +++ b/api-test/frontend/src/business/definition/components/extract/ApiExtract.vue @@ -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); }); }, diff --git a/framework/sdk-parent/frontend/src/components/environment/assertion/ApiAssertions.vue b/framework/sdk-parent/frontend/src/components/environment/assertion/ApiAssertions.vue index 569daa3b9c..a87b140370 100644 --- a/framework/sdk-parent/frontend/src/components/environment/assertion/ApiAssertions.vue +++ b/framework/sdk-parent/frontend/src/components/environment/assertion/ApiAssertions.vue @@ -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); }) }, diff --git a/framework/sdk-parent/frontend/src/components/environment/assertion/GlobalAssertions.vue b/framework/sdk-parent/frontend/src/components/environment/assertion/GlobalAssertions.vue index 07835c21c7..c64e10f8ae 100644 --- a/framework/sdk-parent/frontend/src/components/environment/assertion/GlobalAssertions.vue +++ b/framework/sdk-parent/frontend/src/components/environment/assertion/GlobalAssertions.vue @@ -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); }); }, diff --git a/framework/sdk-parent/frontend/src/i18n/lang/en-US.js b/framework/sdk-parent/frontend/src/i18n/lang/en-US.js index 965a3891e3..be6a4621c1 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/en-US.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/en-US.js @@ -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 "\\$"', diff --git a/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js b/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js index a5412dc967..9ff3442df5 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/zh-CN.js @@ -1861,6 +1861,7 @@ const message = { json_path_suggest: "推荐JSONPath断言", json_path_clear: "清空JSONPath断言", debug_first: "请先执行调试获取响应结果", + body_is_null: "未检测到响应数据,请运行接口并确保产生了响应数据", ignore_status: "忽略状态", add: "添加", script_name: "脚本名称", diff --git a/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js b/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js index b5df011a4d..bd1ab3434f 100644 --- a/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js +++ b/framework/sdk-parent/frontend/src/i18n/lang/zh-TW.js @@ -1860,6 +1860,7 @@ const message = { json_path_suggest: "推薦JSONPath斷言", json_path_clear: "清空JSONPath斷言", debug_first: "請先執行調試獲取響應結果", + body_is_null: "未檢測到響應數據,請運行介面並確保產生了響應數據", ignore_status: "忽略狀態", add: "添加", script_name: "腳本名稱",